fix: update the condition for generating the title (#3702)

This commit is contained in:
Faisal Amir 2024-09-20 10:06:20 +07:00 committed by GitHub
parent 17be901d1a
commit 194093d95d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,12 +14,14 @@ import {
ModelEvent,
Thread,
EngineManager,
InferenceEngine,
} from '@janhq/core'
import { useAtomValue, useSetAtom } from 'jotai'
import { ulid } from 'ulidx'
import { activeModelAtom, stateModelAtom } from '@/hooks/useActiveModel'
import { localEngines } from '@/utils/modelEngine'
import { extractInferenceParams } from '@/utils/modelParam'
import { extensionManager } from '@/extension'
@ -234,7 +236,11 @@ export default function EventHandler({ children }: { children: ReactNode }) {
return
}
if (!activeModelRef.current) {
// Check model engine; we don't want to generate a title when it's not a local engine.
if (
!activeModelRef.current ||
!localEngines.includes(activeModelRef.current?.engine as InferenceEngine)
) {
return
}