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