Skip to content

Conversation

@jiangwel
Copy link
Collaborator

No description provided.

@jiangwel jiangwel merged commit b8fc4ec into main Sep 16, 2025
2 checks passed
@jiangwel jiangwel deleted the chore-check branch September 16, 2025 10:44
@safe1ine
Copy link

来 review 一下
@MonkeyCode-AI

@MonkeyCode-AI
Copy link

Pull Request 概述

这个 Pull Request 主要进行了依赖更新和代码重构,具体包括:

  1. pnpm-lock.yaml 文件中移除了 @mui/utils 依赖项以及一些 @rollup 相关的 libc 限定条目。
  2. ui/ModelModal/src/utils/model.ts 文件中,对模型识别相关的正则表达式逻辑进行了重构,将原本从 ./regex 文件导入的正则表达式常量替换为直接在函数中定义的正则表达式,这样可以更灵活地使用来自 @/constants/models 的动态数据。

文件变更说明

  • ui/ModelModal/pnpm-lock.yaml:

    • 移除了 @mui/utils 依赖。
    • 清理了多个 @rollup 包中的 libc 限定信息。
  • ui/ModelModal/src/utils/model.ts:

    • 移除了对 ./regex 文件中正则表达式的导入。
    • 将模型识别函数中的正则表达式检查替换为直接在函数内定义的正则表达式,以增强灵活性。
    • 更新了 isRerankModel, isEmbeddingModel, isFunctionCallingModel, isVisionModel, isCodeModel, isReasoningModel, isWebSearchModelgetModelLogo 函数的实现。
  • ui/ModelModal/src/utils/regex.ts:

    • 删除了整个文件,因为其功能已被整合到 model.ts 中。

Copy link

@MonkeyCode-AI MonkeyCode-AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 Pull Request 的主要变更包括依赖更新和模型识别逻辑的重构。代码整体清晰,逻辑合理。建议将正则表达式的构建逻辑抽象为可复用的辅助函数,并在注释中说明复杂的正则表达式的作用,以提高代码的可维护性。


if (provider === 'doubao' || modelId.includes('doubao')) {
return FUNCTION_CALLING_CHECK.test(modelId) || FUNCTION_CALLING_CHECK.test(modelId)
return new RegExp(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isFunctionCallingModel 函数中,对于 doubao 模型提供商的检查,原先的代码重复调用了 FUNCTION_CALLING_CHECK.test(modelId)。现在修改为使用一个基于 NOT_TOOL_CALL_MODELSTOOL_CALL_MODELS 常量构建的正则表达式进行检查,这提高了代码的可维护性和灵活性。建议保持这种模式,将正则表达式的构建逻辑封装成一个独立的辅助函数,以避免在多个地方重复定义相似的正则表达式。

}

return VISION_CHECK.test(modelId) || false
return new RegExp(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isVisionModel 函数中,现在使用了动态构建的正则表达式来替代之前从 regex.ts 导入的 VISION_CHECK。这种重构使得模型检查逻辑更加灵活,因为它可以根据运行时的 visionModelsnotVisionModels 常量动态调整。建议继续沿用这种模式,并考虑将正则表达式的构建逻辑抽象为一个可复用的辅助函数。

if (/flux|diffusion|stabilityai|sd-|dall|cogview|janus|midjourney|mj-|image|gpt-image/i.test(modelId)) {
return false
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isReasoningModel 函数中,对于 doubao 模型提供商的检查,原先使用了 REASONING_CHECKDOUBAO_THINKING_MODEL_CHECK 两个正则表达式。现在修改为使用两个动态构建的正则表达式。这种重构提高了代码的可读性和可维护性。建议将这些正则表达式的构建逻辑封装成独立的辅助函数,以便在其他地方复用。

@MonkeyCode-AI
Copy link

⏳ MonkeyCode-AI 正在分析,请稍等片刻...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants