feat: Add Doubao provider support for model type detection
(cherry picked from commit 008b84e128484c98eb59c75d8f44cbc320509049)
This commit is contained in:
parent
e541c7b429
commit
29ba156b9a
@ -196,8 +196,8 @@ export function getModelLogo(modelId: string) {
|
||||
glm: isLight ? ChatGLMModelLogo : ChatGLMModelLogoDark,
|
||||
deepseek: isLight ? DeepSeekModelLogo : DeepSeekModelLogoDark,
|
||||
qwen: isLight ? QwenModelLogo : QwenModelLogoDark,
|
||||
"qwq-": isLight ? QwenModelLogo : QwenModelLogoDark,
|
||||
"qvq-": isLight ? QwenModelLogo : QwenModelLogoDark,
|
||||
'qwq-': isLight ? QwenModelLogo : QwenModelLogoDark,
|
||||
'qvq-': isLight ? QwenModelLogo : QwenModelLogoDark,
|
||||
Omni: isLight ? QwenModelLogo : QwenModelLogoDark,
|
||||
gemma: isLight ? GemmaModelLogo : GemmaModelLogoDark,
|
||||
'yi-': isLight ? YiModelLogo : YiModelLogoDark,
|
||||
@ -1604,6 +1604,10 @@ export function isEmbeddingModel(model: Model): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
if (model.provider === 'doubao') {
|
||||
return EMBEDDING_REGEX.test(model.name)
|
||||
}
|
||||
|
||||
return EMBEDDING_REGEX.test(model.id) || model.type?.includes('embedding') || false
|
||||
}
|
||||
|
||||
@ -1612,6 +1616,10 @@ export function isVisionModel(model: Model): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
if (model.provider === 'doubao') {
|
||||
return VISION_REGEX.test(model.name) || model.type?.includes('vision') || false
|
||||
}
|
||||
|
||||
return VISION_REGEX.test(model.id) || model.type?.includes('vision') || false
|
||||
}
|
||||
|
||||
@ -1620,6 +1628,10 @@ export function isReasoningModel(model: Model): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
if (model.provider === 'doubao') {
|
||||
return REASONING_REGEX.test(model.name) || model.type?.includes('reasoning') || false
|
||||
}
|
||||
|
||||
return REASONING_REGEX.test(model.id) || model.type?.includes('reasoning') || false
|
||||
}
|
||||
|
||||
|
||||
@ -192,9 +192,15 @@ const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
|
||||
const modelTypeContent = (model: Model) => {
|
||||
// 获取默认选中的类型
|
||||
const defaultTypes = [
|
||||
...(VISION_REGEX.test(model.id) ? ['vision'] : []),
|
||||
...(EMBEDDING_REGEX.test(model.id) ? ['embedding'] : []),
|
||||
...(REASONING_REGEX.test(model.id) ? ['reasoning'] : [])
|
||||
...((model.provider === 'doubao' ? VISION_REGEX.test(model.name) : VISION_REGEX.test(model.id))
|
||||
? ['vision']
|
||||
: []),
|
||||
...((model.provider === 'doubao' ? EMBEDDING_REGEX.test(model.name) : EMBEDDING_REGEX.test(model.id))
|
||||
? ['embedding']
|
||||
: []),
|
||||
...((model.provider === 'doubao' ? REASONING_REGEX.test(model.name) : REASONING_REGEX.test(model.id))
|
||||
? ['reasoning']
|
||||
: [])
|
||||
] as ModelType[]
|
||||
|
||||
// 合并现有选择和默认类型
|
||||
@ -206,9 +212,21 @@ const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
|
||||
value={selectedTypes}
|
||||
onChange={(types) => onUpdateModelTypes(model, types as ModelType[])}
|
||||
options={[
|
||||
{ label: t('models.type.vision'), value: 'vision', disabled: VISION_REGEX.test(model.id) },
|
||||
{ label: t('models.type.embedding'), value: 'embedding', disabled: EMBEDDING_REGEX.test(model.id) },
|
||||
{ label: t('models.type.reasoning'), value: 'reasoning', disabled: REASONING_REGEX.test(model.id) }
|
||||
{
|
||||
label: t('models.type.vision'),
|
||||
value: 'vision',
|
||||
disabled: model.provider === 'doubao' ? VISION_REGEX.test(model.name) : VISION_REGEX.test(model.id)
|
||||
},
|
||||
{
|
||||
label: t('models.type.embedding'),
|
||||
value: 'embedding',
|
||||
disabled: model.provider === 'doubao' ? EMBEDDING_REGEX.test(model.name) : EMBEDDING_REGEX.test(model.id)
|
||||
},
|
||||
{
|
||||
label: t('models.type.reasoning'),
|
||||
value: 'reasoning',
|
||||
disabled: model.provider === 'doubao' ? REASONING_REGEX.test(model.name) : REASONING_REGEX.test(model.id)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user