fix(useAiProvider): use DeepSeek provider if model name includes deepseek
This commit is contained in:
@ -8,34 +8,34 @@ import {
|
||||
} from 'ai'
|
||||
|
||||
export const useAiModel = () => {
|
||||
const config = useConfigStore()
|
||||
const { config, aiApiBase } = useConfigStore()
|
||||
let model: LanguageModelV1
|
||||
|
||||
switch (config.config.ai.provider) {
|
||||
case 'openrouter': {
|
||||
const openRouter = createOpenRouter({
|
||||
apiKey: config.config.ai.apiKey,
|
||||
baseURL: config.aiApiBase,
|
||||
})
|
||||
model = openRouter(config.config.ai.model, {
|
||||
includeReasoning: true,
|
||||
})
|
||||
}
|
||||
case 'deepseek': {
|
||||
const deepSeek = createDeepSeek({
|
||||
apiKey: config.config.ai.apiKey,
|
||||
baseURL: config.aiApiBase,
|
||||
})
|
||||
model = deepSeek(config.config.ai.model)
|
||||
}
|
||||
case 'openai-compatible':
|
||||
default: {
|
||||
const openai = createOpenAI({
|
||||
apiKey: config.config.ai.apiKey,
|
||||
baseURL: config.aiApiBase,
|
||||
})
|
||||
model = openai(config.config.ai.model)
|
||||
}
|
||||
if (config.ai.provider === 'openrouter') {
|
||||
const openRouter = createOpenRouter({
|
||||
apiKey: config.ai.apiKey,
|
||||
baseURL: aiApiBase,
|
||||
})
|
||||
model = openRouter(config.ai.model, {
|
||||
includeReasoning: true,
|
||||
})
|
||||
} else if (
|
||||
config.ai.provider === 'deepseek' ||
|
||||
// Special case if model name includes 'deepseek'
|
||||
// This ensures compatibilty with providers like Siliconflow
|
||||
config.ai.model?.toLowerCase().includes('deepseek')
|
||||
) {
|
||||
const deepSeek = createDeepSeek({
|
||||
apiKey: config.ai.apiKey,
|
||||
baseURL: aiApiBase,
|
||||
})
|
||||
model = deepSeek(config.ai.model)
|
||||
} else {
|
||||
const openai = createOpenAI({
|
||||
apiKey: config.ai.apiKey,
|
||||
baseURL: aiApiBase,
|
||||
})
|
||||
model = openai(config.ai.model)
|
||||
}
|
||||
|
||||
return wrapLanguageModel({
|
||||
|
Reference in New Issue
Block a user