Merge pull request #6008 from menloresearch/hotfix/regression-issue-with-colon-in-model-name

hotfix: regression issue with colon in model name
This commit is contained in:
Louis 2025-07-31 17:55:28 +07:00 committed by GitHub
parent 8a7edbf3a7
commit 4bcfa84d75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -88,7 +88,7 @@ describe('useThreads', () => {
})
expect(Object.keys(result.current.threads)).toHaveLength(2)
expect(result.current.threads['thread1'].model.id).toEqual('thread1:free')
expect(result.current.threads['thread1'].model.id).toEqual('thread1/free')
expect(result.current.threads['thread1'].model.provider).toEqual('llamacpp')
expect(result.current.threads['thread2'].model.id).toEqual('thread2/test')
expect(result.current.threads['thread2'].model.provider).toEqual('llamacpp')

View File

@ -44,9 +44,11 @@ export const useThreads = create<ThreadState>()((set, get) => ({
'llamacpp'
),
// Cortex migration: take first two parts of the ID (the last is file name which is not needed)
id: !thread.model?.id.endsWith(':free')
? thread.model?.id.split(':').slice(0, 2).join(sep())
: thread.model?.id,
id:
thread.model.provider === 'llama.cpp' ||
thread.model.provider === 'llamacpp'
? thread.model?.id.split(':').slice(0, 2).join(sep())
: thread.model?.id,
}
: undefined,
}