Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在解决 Ollama 提供商在使用 OpenAI 兼容接口时,通过 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
嗨——我已经审阅了你的改动,看起来非常不错!
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的审查。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| to_del.append(key) | ||
| for key in to_del: | ||
| del payloads[key] | ||
| self._apply_provider_specific_extra_body_overrides(extra_body) |
There was a problem hiding this comment.
您好,此处的改动是正确的,但在审查代码时,我注意到 _query_stream 方法中构造 extra_body 的逻辑与 _query 方法中不一致。
在 _query_stream 中(当前方法):
- 从
custom_extra_body更新extra_body。 - 从
payloads中的参数再次更新extra_body。
这意味着payloads中的参数会覆盖custom_extra_body中的同名参数。
在 _query 中:
- 从
payloads中的参数构造extra_body。 - 从
custom_extra_body更新extra_body。
这意味着custom_extra_body会覆盖payloads中的同名参数。
通常 custom_extra_body(来自静态配置)的优先级应该更高。为了保持行为一致性并避免潜在的 bug,建议将 _query_stream 中的逻辑调整为与 _query 一致。
虽然这超出了本次变更的核心范围,但由于您接触了这部分代码,这是一个很好的改进机会。
Feat #5714
当前 AstrBot 中的 Ollama 提供商走的是 OpenAI 兼容接口,但在该接口下直接使用
think:false不能稳定关闭 thinking。这个 PR 为 Ollama 提供商增加了一个专用开关,在启用时内部改为注入reasoning_effort=none,从而更稳定地关闭思考模式,减少模型响应延迟。顺带一提,#5769 其实也是相似的问题,这里应该都能解决。Modifications / 改动点
关闭思考模式开关reasoning_effort=nonereasoning/think额外请求参数文件变更说明
astrbot/core/config/default.pyastrbot/core/provider/sources/openai_source.pyreasoning_effort=nonedashboard/src/composables/useProviderSources.tsdashboard/src/i18n/locales/en-US/features/config-metadata.jsondashboard/src/i18n/locales/zh-CN/features/config-metadata.jsontests/test_openai_source.pyThis is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
配置界面截图如下:
测试视频如下:
freecompress-202603091727.mp4
视频中未显示 工具调用 是否会有影响,但是我实际测试过,开关思考模式不会对工具调用产生影响。
本地已完成以下验证:
验证结果:
ruff check .通过uv run pytest tests/test_openai_source.py通过,共12 passedpnpm build通过reasoning_effort=none能在 OpenAI 兼容接口下更稳定地关闭 thinkingthink:false在该接口下不稳定,不适合作为 AstrBot 的实现方案Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Summary by Sourcery
通过添加一个 Ollama 专用开关,更可靠地在 OpenAI 兼容提供方中禁用模型的思考模式,并确保现有的 Ollama 来源拥有安全的默认值。
New Features:
reasoning_effort=none。Enhancements:
extra_body覆盖逻辑,使得在禁用思考模式时,Ollama 请求会移除冲突的reasoning/think参数。Tests:
reasoning_effort=none,并移除冲突的reasoning/think字段。Original summary in English
Summary by Sourcery
Add an Ollama-specific toggle to more reliably disable the model’s thinking mode via the OpenAI-compatible provider, and ensure existing Ollama sources get a safe default.
New Features:
Enhancements:
Tests: