Skip to content

Commit b8fc4ec

Browse files
authored
chore: 更新依赖 (#75)
1 parent 4f1de83 commit b8fc4ec

File tree

3 files changed

+50
-90
lines changed

3 files changed

+50
-90
lines changed

ui/ModelModal/pnpm-lock.yaml

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/ModelModal/src/utils/model.ts

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getLowerBaseModelName } from "."
2-
import { CLAUDE_SUPPORTED_WEBSEARCH_CHECK, CODE_CHECK, DOUBAO_THINKING_MODEL_CHECK, EMBEDDING_CHECK, FUNCTION_CALLING_CHECK, GEMINI_SEARCH_CHECK, REASONING_CHECK, RERANKING_CHECK, TEXT_TO_IMAGE_CHECK, VISION_CHECK } from "./regex";
3-
import { PERPLEXITY_MODELS } from "@/constants/models";
2+
import { NOT_TOOL_CALL_MODELS, notVisionModels, PERPLEXITY_MODELS, TOOL_CALL_MODELS, visionModels } from "@/constants/models";
43

54
// Import all model logos using barrel exports
65
import {
@@ -26,7 +25,7 @@ import { YoudaoLogo, NomicLogo } from '@/assets/images/providers'
2625

2726
export function isRerankModel(model_id: string): boolean {
2827
const modelId = getLowerBaseModelName(model_id)
29-
return model_id ? RERANKING_CHECK.test(modelId) || false : false
28+
return model_id ? /(?:rerank|re-rank|re-ranker|re-ranking|retrieval|retriever)/i.test(modelId) || false : false
3029
}
3130

3231
export function isEmbeddingModel(model_id: string, provider: string): boolean {
@@ -41,10 +40,10 @@ export function isEmbeddingModel(model_id: string, provider: string): boolean {
4140
}
4241

4342
if (provider === 'doubao' || modelId.includes('doubao')) {
44-
return EMBEDDING_CHECK.test(modelId)
43+
return /(?:^text-|embed|bge-|e5-|LLM2Vec|retrieval|uae-|gte-|jina-clip|jina-embeddings|voyage-)/i.test(modelId)
4544
}
4645

47-
return EMBEDDING_CHECK.test(modelId) || false
46+
return /(?:^text-|embed|bge-|e5-|LLM2Vec|retrieval|uae-|gte-|jina-clip|jina-embeddings|voyage-)/i.test(modelId) || false
4847
}
4948

5049
export function isFunctionCallingModel(model_id: string, provider: string): boolean {
@@ -59,7 +58,10 @@ export function isFunctionCallingModel(model_id: string, provider: string): bool
5958
}
6059

6160
if (provider === 'doubao' || modelId.includes('doubao')) {
62-
return FUNCTION_CALLING_CHECK.test(modelId) || FUNCTION_CALLING_CHECK.test(modelId)
61+
return new RegExp(
62+
`\\b(?!(?:${NOT_TOOL_CALL_MODELS.join('|')})\\b)(?:${TOOL_CALL_MODELS.join('|')})\\b`,
63+
'i'
64+
).test(modelId)
6365
}
6466

6567
if (['deepseek', 'anthropic'].includes(provider)) {
@@ -70,7 +72,10 @@ export function isFunctionCallingModel(model_id: string, provider: string): bool
7072
return true
7173
}
7274

73-
return FUNCTION_CALLING_CHECK.test(modelId)
75+
return new RegExp(
76+
`\\b(?!(?:${NOT_TOOL_CALL_MODELS.join('|')})\\b)(?:${TOOL_CALL_MODELS.join('|')})\\b`,
77+
'i'
78+
).test(modelId)
7479
}
7580

7681
export function isVisionModel(model_id: string, provider: string): boolean {
@@ -79,11 +84,10 @@ export function isVisionModel(model_id: string, provider: string): boolean {
7984
}
8085

8186
const modelId = getLowerBaseModelName(model_id)
82-
if (provider === 'doubao' || modelId.includes('doubao')) {
83-
return VISION_CHECK.test(modelId) || false
84-
}
85-
86-
return VISION_CHECK.test(modelId) || false
87+
return new RegExp(
88+
`\\b(?!(?:${notVisionModels.join('|')})\\b)(${visionModels.join('|')})\\b`,
89+
'i'
90+
).test(modelId) || false
8791
}
8892

8993
export function isCodeModel(model_id: string, provider: string): boolean {
@@ -92,7 +96,7 @@ export function isCodeModel(model_id: string, provider: string): boolean {
9296
}
9397

9498
const modelId = getLowerBaseModelName(model_id)
95-
return CODE_CHECK.test(modelId) || false
99+
return /(?:^o3$|.*(code|claude\s+sonnet|claude\s+opus|gpt-4\.1|gpt-4o|gpt-5|gemini[\s-]+2\.5|o4-mini|kimi-k2).*)/i.test(modelId) || false
96100
}
97101

98102
export function isReasoningModel(model_id: string, provider: string): boolean {
@@ -103,14 +107,14 @@ export function isReasoningModel(model_id: string, provider: string): boolean {
103107
const modelId = getLowerBaseModelName(model_id)
104108

105109
// Check if it's a text-to-image model (merged from isTextToImageModel)
106-
if (TEXT_TO_IMAGE_CHECK.test(modelId)) {
110+
if (/flux|diffusion|stabilityai|sd-|dall|cogview|janus|midjourney|mj-|image|gpt-image/i.test(modelId)) {
107111
return false
108112
}
109113

110114
if (provider === 'doubao' || modelId.includes('doubao')) {
111115
return (
112-
REASONING_CHECK.test(modelId) ||
113-
DOUBAO_THINKING_MODEL_CHECK.test(getLowerBaseModelName(model_id, '/')) ||
116+
/^(o\d+(?:-[\w-]+)?|.*\b(?:reasoning|reasoner|thinking)\b.*|.*-[rR]\d+.*|.*\bqwq(?:-[\w-]+)?\b.*|.*\bhunyuan-t1(?:-[\w-]+)?\b.*|.*\bglm-zero-preview\b.*|.*\bgrok-(?:3-mini|4)(?:-[\w-]+)?\b.*)$/i.test(modelId) ||
117+
/doubao-(?:1[.-]5-thinking-vision-pro|1[.-]5-thinking-pro-m|seed-1[.-]6(?:-flash)?(?!-(?:thinking)(?:-|$)))(?:-[\w-]+)*/i.test(getLowerBaseModelName(model_id, '/')) ||
114118
false
115119
)
116120
}
@@ -163,7 +167,7 @@ export function isReasoningModel(model_id: string, provider: string): boolean {
163167
'qwen-plus-0714', 'qwen-plus-2025-07-14', 'qwen-turbo', 'qwen-turbo-latest',
164168
'qwen-turbo-0428', 'qwen-turbo-2025-04-28', 'qwen-turbo-0715', 'qwen-turbo-2025-07-15'
165169
].includes(qwenModelId)
166-
170+
167171
isQwenReasoning = isSupportedThinkingTokenQwen || qwenModelId.includes('qwq') || qwenModelId.includes('qvq')
168172
}
169173

@@ -207,7 +211,7 @@ export function isReasoningModel(model_id: string, provider: string): boolean {
207211
return true
208212
}
209213

210-
return REASONING_CHECK.test(modelId) || false
214+
return /^(o\d+(?:-[\w-]+)?|.*\b(?:reasoning|reasoner|thinking)\b.*|.*-[rR]\d+.*|.*\bqwq(?:-[\w-]+)?\b.*|.*\bhunyuan-t1(?:-[\w-]+)?\b.*|.*\bglm-zero-preview\b.*|.*\bgrok-(?:3-mini|4)(?:-[\w-]+)?\b.*)$/i.test(modelId) || false
211215
}
212216

213217
export function isWebSearchModel(model_id: string, provider: string): boolean {
@@ -219,7 +223,10 @@ export function isWebSearchModel(model_id: string, provider: string): boolean {
219223

220224
// Anthropic model check (merged from isAnthropicModel)
221225
if (modelId.startsWith('claude')) {
222-
return CLAUDE_SUPPORTED_WEBSEARCH_CHECK.test(modelId)
226+
return new RegExp(
227+
`\\b(?:claude-3(-|\\.)(7|5)-sonnet(?:-[\\w-]+)|claude-3(-|\\.)5-haiku(?:-[\\w-]+)|claude-sonnet-4(?:-[\\w-]+)?|claude-opus-4(?:-[\\w-]+)?)\\b`,
228+
'i'
229+
).test(modelId)
223230
}
224231

225232
if (provider === 'grok') {
@@ -232,13 +239,13 @@ export function isWebSearchModel(model_id: string, provider: string): boolean {
232239
}
233240

234241
if (provider === 'gemini' || provider === 'vertexai') {
235-
return GEMINI_SEARCH_CHECK.test(modelId)
242+
return new RegExp('gemini-2\\..*', 'i').test(modelId)
236243
}
237244

238245
if (provider === 'openai') {
239246
// OpenAI web search model check (merged from isOpenAIWebSearchModel)
240247
if (
241-
GEMINI_SEARCH_CHECK.test(modelId) ||
248+
new RegExp('gemini-2\\..*', 'i').test(modelId) ||
242249
modelId.includes('gpt-4o-search-preview') ||
243250
modelId.includes('gpt-4o-mini-search-preview') ||
244251
(modelId.includes('gpt-4.1') && !modelId.includes('gpt-4.1-nano')) ||
@@ -268,7 +275,7 @@ export function isWebSearchModel(model_id: string, provider: string): boolean {
268275
}
269276

270277
if (provider === 'aihubmix') {
271-
if (!modelId.endsWith('-search') && GEMINI_SEARCH_CHECK.test(modelId)) {
278+
if (!modelId.endsWith('-search') && new RegExp('gemini-2\\..*', 'i').test(modelId)) {
272279
return true
273280
}
274281

@@ -299,32 +306,32 @@ export function getModelLogo(modelId: string) {
299306
const logoMap = {
300307
pixtral: PixtralModelLogo,
301308
jina: JinaModelLogo,
302-
abab: MinimaxModelLogo ,
303-
minimax: MinimaxModelLogo ,
304-
o1: ChatGPTo1ModelLogo ,
305-
o3: ChatGPTo1ModelLogo ,
306-
o4: ChatGPTo1ModelLogo ,
309+
abab: MinimaxModelLogo,
310+
minimax: MinimaxModelLogo,
311+
o1: ChatGPTo1ModelLogo,
312+
o3: ChatGPTo1ModelLogo,
313+
o4: ChatGPTo1ModelLogo,
307314
'gpt-image': ChatGPTImageModelLogo,
308-
'gpt-3': ChatGPT35ModelLogo ,
309-
'gpt-4': ChatGPT4ModelLogo ,
315+
'gpt-3': ChatGPT35ModelLogo,
316+
'gpt-4': ChatGPT4ModelLogo,
310317
'gpt-5-mini': GPT5MiniModelLogo,
311318
'gpt-5-nano': GPT5NanoModelLogo,
312319
'gpt-5-chat': GPT5ChatModelLogo,
313320
'gpt-5': GPT5ModelLogo,
314-
gpts: ChatGPT4ModelLogo ,
315-
'gpt-oss(?:-[\\w-]+)': ChatGptModelLogo ,
316-
'text-moderation': ChatGptModelLogo ,
317-
'babbage-': ChatGptModelLogo ,
318-
'sora-': ChatGptModelLogo ,
319-
'(^|/)omni-': ChatGptModelLogo ,
320-
'Embedding-V1': WenxinModelLogo ,
321-
'text-embedding-v': QwenModelLogo ,
322-
'text-embedding': ChatGptModelLogo ,
323-
'davinci-': ChatGptModelLogo ,
324-
glm: ChatGLMModelLogo ,
325-
deepseek: DeepSeekModelLogo ,
326-
'(qwen|qwq|qwq-|qvq-)': QwenModelLogo ,
327-
gemma: GemmaModelLogo ,
321+
gpts: ChatGPT4ModelLogo,
322+
'gpt-oss(?:-[\\w-]+)': ChatGptModelLogo,
323+
'text-moderation': ChatGptModelLogo,
324+
'babbage-': ChatGptModelLogo,
325+
'sora-': ChatGptModelLogo,
326+
'(^|/)omni-': ChatGptModelLogo,
327+
'Embedding-V1': WenxinModelLogo,
328+
'text-embedding-v': QwenModelLogo,
329+
'text-embedding': ChatGptModelLogo,
330+
'davinci-': ChatGptModelLogo,
331+
glm: ChatGLMModelLogo,
332+
deepseek: DeepSeekModelLogo,
333+
'(qwen|qwq|qwq-|qvq-)': QwenModelLogo,
334+
gemma: GemmaModelLogo,
328335
'yi-': YiModelLogo,
329336
llama: LlamaModelLogo,
330337
mixtral: MistralModelLogo,

ui/ModelModal/src/utils/regex.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)