Skip to content

Conversation

@Soulter
Copy link
Member

@Soulter Soulter commented Oct 2, 2025

fixes: #2912


Motivation / 动机

修复智谱提供商下工具调用无限循环的问题。这个问题是未及时更新 zhipu_source.py 的部分方法参数导致工具调用的响应未有正确被添加到上下文中导致的。

Modifications / 改动点

移除了对智谱模型的专门支持。

Verification Steps / 验证步骤

Screenshots or Test Results / 运行截图或测试结果

Compatibility & Breaking Changes / 兼容性与破坏性变更

  • 这是一个破坏性变更 (Breaking Change)。/ This is a breaking change.
  • 这不是一个破坏性变更。/ This is NOT a breaking change.

破坏性不大。


Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Sourcery 总结

修复智谱聊天补全(Zhipu Chat Completion)提供程序中的无限循环,并通过删除过时的方法重写并回退到基础的 OpenAI 实现来移除对 glm-4v-flash 的专门支持。

Bug 修复:

  • 解决智谱提供程序中由过时方法参数引起的工具调用无限循环问题。

改进:

  • 移除对 glm-4v-flash 模型的专门处理并停止支持。
  • 更新提供程序适配器注册元数据,以修正“智谱 Chat Completion”描述符。
Original summary in English

Summary by Sourcery

Fix infinite loop in Zhipu Chat Completion provider and remove specialized glm-4v-flash support by deleting the outdated method override and falling back to the base OpenAI implementation

Bug Fixes:

  • Resolve infinite loop in tool calls for Zhipu provider caused by outdated method parameters

Enhancements:

  • Remove specialized handling and stop support for glm-4v-flash model
  • Update provider adapter registration metadata to correct "智谱 Chat Completion" descriptor

@auto-assign auto-assign bot requested review from Larch-C and Raven95676 October 2, 2025 08:00
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

你好 - 我已经审查了你的更改,它们看起来很棒!

AI 代理提示
请处理此代码审查中的注释:

## 个别评论

### 评论 1
<location> `astrbot/core/provider/sources/zhipu_source.py:9` </location>
<code_context>
 from .openai_source import ProviderOpenAIOfficial


-@register_provider_adapter("zhipu_chat_completion", "智浦 Chat Completion 提供商适配器")
+@register_provider_adapter("zhipu_chat_completion", "智谱 Chat Completion 提供商适配器")
 class ProviderZhipu(ProviderOpenAIOfficial):
     def __init__(
</code_context>

<issue_to_address>
**吹毛求疵 (typo):** 提供商适配器名称中的拼写错误。

请验证在整个代码库和文档中都一致使用“智谱”以保持正确的品牌名称。
</issue_to_address>

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用这些反馈来改进你的评论。
Original comment in English

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `astrbot/core/provider/sources/zhipu_source.py:9` </location>
<code_context>
 from .openai_source import ProviderOpenAIOfficial


-@register_provider_adapter("zhipu_chat_completion", "智浦 Chat Completion 提供商适配器")
+@register_provider_adapter("zhipu_chat_completion", "智谱 Chat Completion 提供商适配器")
 class ProviderZhipu(ProviderOpenAIOfficial):
     def __init__(
</code_context>

<issue_to_address>
**nitpick (typo):** Typo correction in provider adapter name.

Please verify that '智谱' is used consistently throughout the codebase and documentation to maintain correct branding.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter Soulter merged commit baf5ad0 into master Oct 2, 2025
5 checks passed
@Soulter Soulter deleted the fix/2912 branch October 18, 2025 01:54
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.

[Bug] 关闭流式输出后部分模型调用部分MCP工具会陷入循环

2 participants