fix: wait for model start

This commit is contained in:
Louis 2025-06-23 18:19:18 +07:00
parent 54691044d4
commit 5edc773535
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2

View File

@ -1,5 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { AIEngine, EngineManager, SettingComponentProps } from '@janhq/core' import {
AIEngine,
EngineManager,
SessionInfo,
SettingComponentProps,
} from '@janhq/core'
import { Model as CoreModel } from '@janhq/core' import { Model as CoreModel } from '@janhq/core'
// TODO: Replace this with the actual provider later // TODO: Replace this with the actual provider later
@ -138,8 +143,8 @@ export const stopAllModels = async () => {
export const startModel = async ( export const startModel = async (
provider: ProviderObject, provider: ProviderObject,
model: string model: string
): Promise<void> => { ): Promise<SessionInfo> => {
getEngine(provider.provider) return getEngine(provider.provider)
.load(model) .load(model)
.catch((error) => { .catch((error) => {
console.error( console.error(