fix: Update dashscoop provider configuration and enhance model editing functionality (#4748)

* fix(provider config): update dashscoop new links

* feat(EditModelsPopup): add grouping function for bailian

* fix(isWebSearchModel): Correctly handle the priority of manually setting model support for web search
This commit is contained in:
George·Dong 2025-04-13 20:38:25 +08:00 committed by GitHub
parent 486ccc1a15
commit 412e8b03fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 5 deletions

View File

@ -2265,6 +2265,12 @@ export function isWebSearchModel(model: Model): boolean {
return false return false
} }
if (model.type) {
if (model.type.includes('web_search')) {
return true
}
}
const provider = getProviderByModel(model) const provider = getProviderByModel(model)
if (!provider) { if (!provider) {
@ -2301,7 +2307,7 @@ export function isWebSearchModel(model: Model): boolean {
} }
if (provider.id === 'dashscope') { if (provider.id === 'dashscope') {
const models = ['qwen-turbo', 'qwen-max', 'qwen-plus'] const models = ['qwen-turbo', 'qwen-max', 'qwen-plus', 'qwq']
// matches id like qwen-max-0919, qwen-max-latest // matches id like qwen-max-0919, qwen-max-latest
return models.some((i) => model.id.startsWith(i)) return models.some((i) => model.id.startsWith(i))
} }
@ -2310,7 +2316,7 @@ export function isWebSearchModel(model: Model): boolean {
return true return true
} }
return model.type?.includes('web_search') || false return false
} }
export function isGenerateImageModel(model: Model): boolean { export function isGenerateImageModel(model: Model): boolean {
@ -2406,3 +2412,27 @@ export function isHunyuanSearchModel(model?: Model): boolean {
return false return false
} }
/**
* Qwen
* @param models
* @returns
*/
export function groupQwenModels(models: Model[]): Record<string, Model[]> {
return models.reduce(
(groups, model) => {
// 匹配 Qwen 系列模型的前缀
const prefixMatch = model.id.match(/^(qwen(?:\d+\.\d+|2(?:\.\d+)?|-\d+b|-(?:max|coder|vl)))/i)
// 匹配 qwen2.5、qwen2、qwen-7b、qwen-max、qwen-coder 等
const groupKey = prefixMatch ? prefixMatch[1] : model.group || '其他'
if (!groups[groupKey]) {
groups[groupKey] = []
}
groups[groupKey].push(model)
return groups
},
{} as Record<string, Model[]>
)
}

View File

@ -319,9 +319,9 @@ export const PROVIDER_CONFIG = {
}, },
websites: { websites: {
official: 'https://www.aliyun.com/product/bailian', official: 'https://www.aliyun.com/product/bailian',
apiKey: 'https://bailian.console.aliyun.com/?apiKey=1#/api-key', apiKey: 'https://bailian.console.aliyun.com/?tab=model#/api-key',
docs: 'https://help.aliyun.com/zh/model-studio/getting-started/', docs: 'https://help.aliyun.com/zh/model-studio/getting-started/',
models: 'https://bailian.console.aliyun.com/model-market#/model-market' models: 'https://bailian.console.aliyun.com/?tab=model#/model-market'
} }
}, },
stepfun: { stepfun: {

View File

@ -4,6 +4,7 @@ import CustomTag from '@renderer/components/CustomTag'
import ModelTagsWithLabel from '@renderer/components/ModelTagsWithLabel' import ModelTagsWithLabel from '@renderer/components/ModelTagsWithLabel'
import { import {
getModelLogo, getModelLogo,
groupQwenModels,
isEmbeddingModel, isEmbeddingModel,
isFunctionCallingModel, isFunctionCallingModel,
isReasoningModel, isReasoningModel,
@ -81,7 +82,16 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
} }
}) })
const modelGroups = groupBy(list, 'group') const modelGroups =
provider.id === 'dashscope'
? {
...groupBy(
list.filter((model) => !model.id.startsWith('qwen')),
'group'
),
...groupQwenModels(list.filter((model) => model.id.startsWith('qwen')))
}
: groupBy(list, 'group')
const onOk = () => { const onOk = () => {
setOpen(false) setOpen(false)