Skip to content

feat: implement Aliyun Bailian Chat provider and coding plan support#5718

Open
WintryWind7 wants to merge 1 commit intoAstrBotDevs:masterfrom
WintryWind7:feat/bailian-chat-provider
Open

feat: implement Aliyun Bailian Chat provider and coding plan support#5718
WintryWind7 wants to merge 1 commit intoAstrBotDevs:masterfrom
WintryWind7:feat/bailian-chat-provider

Conversation

@WintryWind7
Copy link
Contributor

@WintryWind7 WintryWind7 commented Mar 3, 2026

因为我刚刚订阅了阿里云百炼的coding plan,且这里没有预设,为了降低其他用户的上手难度。添加对阿里云百炼 (Aliyun Bailian / DashScope) 对话模型的原生支持,包括专用的 Coding Plan 模式和 Thinking 深度推理模式。

Modifications / 改动点

  • 新增 astrbot/core/provider/sources/bailian_chat_source.py,实现百炼对话模型适配器,继承自 OpenAI 适配器并针对百炼特性进行优化。
  • 修改 astrbot/core/config/default.py,注册百炼配置模板,新增 bl_coding_plan (Coding Plan 开关) 和 bl_thinking (深度推理开关) 配置项。
  • 修改 astrbot/core/provider/manager.py,注册 bailian_chat_completion 提供商类型及其适配器映射。
  • 修改 astrbot/dashboard/routes/config.py,在更新配置时针对百炼提供商增加逻辑,
  • 更新 dashboard/src/i18n/locales/ 下的 zh-CNen-US 国际化文件,支持百炼专有配置项的中文/英文描述显示,并补全了前端切换通知词条。
  • This is NOT a breaking change. / 这不是一个破坏性变更。

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

e137d445-9af5-48b9-a93e-a349538a80cd cb31c62b-2ab3-47e2-b92a-748d4e8ca6c8

有一个问题:当点击按钮进行切换的时候,理论上应实时变化url地址,然而我尝试了多种修改方式依然无法实现实时变化,但是存储的数据是正确的,点下按钮后保存的时候后端会正确匹配,重新点击下这个provider就会正常显示。主要是我debug的时候发现前端写console.log显示不出来,我不太懂,可能我的调试方式有问题吧。因为我精力有限,一段时间内无法再修改了。如果您认为此功能有用但我的代码有问题,可以在这基础上修改一下,,或者等我后续有空。


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.

Summary by Sourcery

为阿里云百炼聊天补全新增原生 Provider 支持,包括 Coding Plan 和 Thinking 模式,并将其集成到配置和仪表盘流程中。

新功能:

  • 引入基于 OpenAI Provider 的百炼聊天补全适配器,支持 Coding Plan 和 Thinking 模式。
  • 注册一个默认的百炼 Provider 模板,并提供专用的 bl_coding_planbl_thinking 配置选项。

增强改进:

  • 将百炼聊天补全 Provider 接入 Provider 管理器,实现适配器的动态加载。
  • 确保在更新 Provider 时,可根据 Coding Plan 标志自动设置正确的百炼 API 基础 URL。
  • 扩展仪表盘配置元数据和国际化(i18n)字符串,使百炼相关设置可在中文和英文界面中呈现。
Original summary in English

Summary by Sourcery

Add native provider support for Aliyun Bailian chat completion, including Coding Plan and Thinking modes, and integrate it into configuration and dashboard flows.

New Features:

  • Introduce a Bailian chat completion provider adapter based on the OpenAI provider with support for Coding Plan and Thinking modes.
  • Register a default Bailian provider template with dedicated bl_coding_plan and bl_thinking configuration options.

Enhancements:

  • Wire the Bailian chat completion provider into the provider manager for dynamic adapter loading.
  • Ensure provider updates automatically set the correct Bailian API base URL based on the Coding Plan flag.
  • Extend dashboard configuration metadata and i18n strings to surface Bailian-specific settings in both Chinese and English.

@auto-assign auto-assign bot requested review from Raven95676 and anka-afk March 3, 2026 13:28
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 3, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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!

此拉取请求旨在通过集成阿里云百炼对话模型来扩展平台的AI提供商能力。它引入了对百炼特有功能的全面支持,例如 Coding Plan 模式和 Thinking 深度推理模式,从而降低了用户上手难度并提供了更灵活的AI交互选项。

Highlights

  • 新增阿里云百炼对话模型支持: 此拉取请求引入了对阿里云百炼 (Aliyun Bailian / DashScope) 对话模型的原生支持,扩展了平台的AI提供商能力。
  • 支持 Coding Plan 和 Thinking 模式: 为百炼对话模型集成了专用的 Coding Plan 模式和 Thinking 深度推理模式,以满足不同场景下的AI交互需求。
  • 引入新的百炼对话适配器: 新增了 bailian_chat_source.py 文件,实现了百炼对话模型适配器,该适配器继承自 OpenAI 适配器并针对百炼特性进行了优化,包括动态 API Base URL 切换和模型选择。
  • 配置和国际化更新: 更新了默认配置模板以注册百炼提供商及其特有的 bl_coding_planbl_thinking 配置项,并同步更新了中英文国际化文件以显示相关描述。
Changelog
  • astrbot/core/config/default.py
    • 添加了阿里云百炼对话模型的默认配置模板。
    • 新增了 bl_coding_planbl_thinking 配置项的布尔类型定义。
  • astrbot/core/provider/manager.py
    • 注册了 bailian_chat_completion 提供商类型,并将其映射到新的百炼聊天适配器。
  • astrbot/core/provider/sources/bailian_chat_source.py
    • 新增了 ProviderBailianChat 类,作为阿里云百炼对话模型的适配器,继承自 ProviderOpenAIOfficial
    • 实现了根据 bl_coding_plan 动态调整 api_base 的逻辑。
    • 实现了在 is_thinking 模式下自动设置默认模型(如 qwen3.5-plusqwen-plus)的逻辑。
    • 添加了在 _finally_convert_payload 中根据 is_thinking 设置 enable_thinking 参数的逻辑。
  • astrbot/dashboard/routes/config.py
    • 在更新提供商配置时,为 bailian_chat_completion 类型强制根据 bl_coding_plan 设置正确的 api_base
  • dashboard/src/i18n/locales/en-US/features/config-metadata.json
    • 添加了 bl_coding_planbl_thinking 的英文描述和提示信息。
  • dashboard/src/i18n/locales/zh-CN/features/config-metadata.json
    • 添加了 bl_coding_planbl_thinking 的中文描述和提示信息。
Activity
  • 作者 WintryWind7 提交了此拉取请求,旨在为阿里云百炼对话模型添加原生支持,包括 Coding Plan 和 Thinking 模式。
  • 作者提供了详细的修改点总结、运行截图和测试结果,以证明更改的有效性。
  • 作者指出一个已知的前端问题:切换按钮时 URL 未实时更新,但后端数据存储正确,并表示暂时无法修复。
  • 作者已确认这不是一个破坏性变更,并且代码经过了测试,没有引入新的依赖库或恶意代码。
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. label Mar 3, 2026
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.

你好——我发现了 1 个问题,并给出了一些整体性的反馈:

  • Bailian 的 API 基础 URL 同时在 update_provider_sourceProviderBailianChat.__init__ 中被设置;建议将这部分逻辑集中到一个地方(例如只放在 provider adapter 中),以避免配置分叉或引起混淆。
  • ProviderBailianChat.__init__ 中,你会修改传入的 provider_config 字典(覆盖其中的 api_basemodel);如果调用方在其他地方还依赖原始配置对象,建议基于副本进行操作,以避免产生意料之外的副作用。
  • DashScope 的端点(https://coding.dashscope.aliyuncs.com/v1https://dashscope.aliyuncs.com/compatible-mode/v1)在多个地方被硬编码;将它们抽取为共享常量可以减少重复,并让未来的端点调整更加容易。
给 AI 代理的提示词
Please address the comments from this code review:

## Overall Comments
- The API base URL for Bailian is being set both in `update_provider_source` and in `ProviderBailianChat.__init__`; consider centralizing this logic in one place (e.g., only in the provider adapter) to avoid divergence or confusion.
- In `ProviderBailianChat.__init__` you mutate the incoming `provider_config` dict (overwriting `api_base` and `model`); if callers rely on the original configuration object elsewhere, consider working on a copy to prevent unexpected side effects.
- The DashScope endpoints (`https://coding.dashscope.aliyuncs.com/v1` and `https://dashscope.aliyuncs.com/compatible-mode/v1`) are hard-coded in multiple places; extracting them into shared constants would reduce duplication and make future endpoint changes easier.

## Individual Comments

### Comment 1
<location path="astrbot/dashboard/routes/config.py" line_range="447-452" />
<code_context>
             return Response().error("缺少或错误的配置数据").__dict__

+        # 百炼 Chat Completion: 根据 bl_coding_plan 强制设置正确的 api_base
+        if new_source_config.get("type") == "bailian_chat_completion":
+            is_coding_plan = new_source_config.get("bl_coding_plan", False)
+            if is_coding_plan:
+                new_source_config["api_base"] = "https://coding.dashscope.aliyuncs.com/v1"
+            else:
+                new_source_config["api_base"] = "https://dashscope.aliyuncs.com/compatible-mode/v1"
+
         # 确保配置中有 id 字段
</code_context>
<issue_to_address>
**suggestion:** Avoid hard-coding the 百炼 base URLs in multiple places to reduce drift risk.

These dashscope base URLs are now defined both here and in `ProviderBailianChat.__init__`. If one is updated (e.g., versioned path, regional endpoint, proxy), the other may be missed. Please centralize them in a shared constant or helper (e.g., provider/config module) and reference that from both places to avoid drift.

Suggested implementation:

```python
        # 百炼 Chat Completion: 根据 bl_coding_plan 强制设置正确的 api_base
        if new_source_config.get("type") == "bailian_chat_completion":
            is_coding_plan = new_source_config.get("bl_coding_plan", False)
            if is_coding_plan:
                new_source_config["api_base"] = BAILIAN_CODING_API_BASE
            else:
                new_source_config["api_base"] = BAILIAN_COMPATIBLE_MODE_API_BASE

```

To fully implement the suggestion and avoid URL drift:

1. Define shared constants in a central provider/config module (for example, in `astrbot/providers/bailian_chat.py` or a dedicated `astrbot/providers/bailian_config.py`):

   ```python
   BAILIAN_CODING_API_BASE = "https://coding.dashscope.aliyuncs.com/v1"
   BAILIAN_COMPATIBLE_MODE_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
   ```

2. Update `ProviderBailianChat.__init__` to use these constants instead of hard-coded strings.

3. Add an import at the top of `astrbot/dashboard/routes/config.py` to bring the constants into scope, for example:

   ```python
   from astrbot.providers.bailian_chat import (
       BAILIAN_CODING_API_BASE,
       BAILIAN_COMPATIBLE_MODE_API_BASE,
   )
   ```

If the actual provider module path or naming differs in your codebase, adjust the module name in the import accordingly.
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得这个评审对你有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The API base URL for Bailian is being set both in update_provider_source and in ProviderBailianChat.__init__; consider centralizing this logic in one place (e.g., only in the provider adapter) to avoid divergence or confusion.
  • In ProviderBailianChat.__init__ you mutate the incoming provider_config dict (overwriting api_base and model); if callers rely on the original configuration object elsewhere, consider working on a copy to prevent unexpected side effects.
  • The DashScope endpoints (https://coding.dashscope.aliyuncs.com/v1 and https://dashscope.aliyuncs.com/compatible-mode/v1) are hard-coded in multiple places; extracting them into shared constants would reduce duplication and make future endpoint changes easier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The API base URL for Bailian is being set both in `update_provider_source` and in `ProviderBailianChat.__init__`; consider centralizing this logic in one place (e.g., only in the provider adapter) to avoid divergence or confusion.
- In `ProviderBailianChat.__init__` you mutate the incoming `provider_config` dict (overwriting `api_base` and `model`); if callers rely on the original configuration object elsewhere, consider working on a copy to prevent unexpected side effects.
- The DashScope endpoints (`https://coding.dashscope.aliyuncs.com/v1` and `https://dashscope.aliyuncs.com/compatible-mode/v1`) are hard-coded in multiple places; extracting them into shared constants would reduce duplication and make future endpoint changes easier.

## Individual Comments

### Comment 1
<location path="astrbot/dashboard/routes/config.py" line_range="447-452" />
<code_context>
             return Response().error("缺少或错误的配置数据").__dict__

+        # 百炼 Chat Completion: 根据 bl_coding_plan 强制设置正确的 api_base
+        if new_source_config.get("type") == "bailian_chat_completion":
+            is_coding_plan = new_source_config.get("bl_coding_plan", False)
+            if is_coding_plan:
+                new_source_config["api_base"] = "https://coding.dashscope.aliyuncs.com/v1"
+            else:
+                new_source_config["api_base"] = "https://dashscope.aliyuncs.com/compatible-mode/v1"
+
         # 确保配置中有 id 字段
</code_context>
<issue_to_address>
**suggestion:** Avoid hard-coding the 百炼 base URLs in multiple places to reduce drift risk.

These dashscope base URLs are now defined both here and in `ProviderBailianChat.__init__`. If one is updated (e.g., versioned path, regional endpoint, proxy), the other may be missed. Please centralize them in a shared constant or helper (e.g., provider/config module) and reference that from both places to avoid drift.

Suggested implementation:

```python
        # 百炼 Chat Completion: 根据 bl_coding_plan 强制设置正确的 api_base
        if new_source_config.get("type") == "bailian_chat_completion":
            is_coding_plan = new_source_config.get("bl_coding_plan", False)
            if is_coding_plan:
                new_source_config["api_base"] = BAILIAN_CODING_API_BASE
            else:
                new_source_config["api_base"] = BAILIAN_COMPATIBLE_MODE_API_BASE

```

To fully implement the suggestion and avoid URL drift:

1. Define shared constants in a central provider/config module (for example, in `astrbot/providers/bailian_chat.py` or a dedicated `astrbot/providers/bailian_config.py`):

   ```python
   BAILIAN_CODING_API_BASE = "https://coding.dashscope.aliyuncs.com/v1"
   BAILIAN_COMPATIBLE_MODE_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
   ```

2. Update `ProviderBailianChat.__init__` to use these constants instead of hard-coded strings.

3. Add an import at the top of `astrbot/dashboard/routes/config.py` to bring the constants into scope, for example:

   ```python
   from astrbot.providers.bailian_chat import (
       BAILIAN_CODING_API_BASE,
       BAILIAN_COMPATIBLE_MODE_API_BASE,
   )
   ```

If the actual provider module path or naming differs in your codebase, adjust the module name in the import accordingly.
</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.

Comment on lines +447 to +452
if new_source_config.get("type") == "bailian_chat_completion":
is_coding_plan = new_source_config.get("bl_coding_plan", False)
if is_coding_plan:
new_source_config["api_base"] = "https://coding.dashscope.aliyuncs.com/v1"
else:
new_source_config["api_base"] = "https://dashscope.aliyuncs.com/compatible-mode/v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: 避免在多个地方硬编码百炼的基础 URL,以降低配置漂移风险。

这些 dashscope 的基础 URL 目前在这里以及 ProviderBailianChat.__init__ 中都有定义。如果其中一个被更新(例如版本路径、区域端点或代理发生变化),另一个可能会被遗漏。请将它们集中到共享常量或辅助方法中(例如 provider/config 模块),并在两个地方都通过该常量/辅助方法引用,以避免配置漂移。

建议的实现方式:

        # 百炼 Chat Completion: 根据 bl_coding_plan 强制设置正确的 api_base
        if new_source_config.get("type") == "bailian_chat_completion":
            is_coding_plan = new_source_config.get("bl_coding_plan", False)
            if is_coding_plan:
                new_source_config["api_base"] = BAILIAN_CODING_API_BASE
            else:
                new_source_config["api_base"] = BAILIAN_COMPATIBLE_MODE_API_BASE

为了完整落实这一建议并避免 URL 漂移:

  1. 在一个中心化的 provider/config 模块中定义共享常量(例如在 astrbot/providers/bailian_chat.py 或单独的 astrbot/providers/bailian_config.py 中):

    BAILIAN_CODING_API_BASE = "https://coding.dashscope.aliyuncs.com/v1"
    BAILIAN_COMPATIBLE_MODE_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
  2. 更新 ProviderBailianChat.__init__,让其使用这些常量,而不是硬编码字符串。

  3. astrbot/dashboard/routes/config.py 文件顶部添加 import,将这些常量引入当前作用域,例如:

    from astrbot.providers.bailian_chat import (
        BAILIAN_CODING_API_BASE,
        BAILIAN_COMPATIBLE_MODE_API_BASE,
    )

如果你们代码库中实际的 provider 模块路径或命名不同,请相应调整上述 import 中的模块名。

Original comment in English

suggestion: Avoid hard-coding the 百炼 base URLs in multiple places to reduce drift risk.

These dashscope base URLs are now defined both here and in ProviderBailianChat.__init__. If one is updated (e.g., versioned path, regional endpoint, proxy), the other may be missed. Please centralize them in a shared constant or helper (e.g., provider/config module) and reference that from both places to avoid drift.

Suggested implementation:

        # 百炼 Chat Completion: 根据 bl_coding_plan 强制设置正确的 api_base
        if new_source_config.get("type") == "bailian_chat_completion":
            is_coding_plan = new_source_config.get("bl_coding_plan", False)
            if is_coding_plan:
                new_source_config["api_base"] = BAILIAN_CODING_API_BASE
            else:
                new_source_config["api_base"] = BAILIAN_COMPATIBLE_MODE_API_BASE

To fully implement the suggestion and avoid URL drift:

  1. Define shared constants in a central provider/config module (for example, in astrbot/providers/bailian_chat.py or a dedicated astrbot/providers/bailian_config.py):

    BAILIAN_CODING_API_BASE = "https://coding.dashscope.aliyuncs.com/v1"
    BAILIAN_COMPATIBLE_MODE_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
  2. Update ProviderBailianChat.__init__ to use these constants instead of hard-coded strings.

  3. Add an import at the top of astrbot/dashboard/routes/config.py to bring the constants into scope, for example:

    from astrbot.providers.bailian_chat import (
        BAILIAN_CODING_API_BASE,
        BAILIAN_COMPATIBLE_MODE_API_BASE,
    )

If the actual provider module path or naming differs in your codebase, adjust the module name in the import accordingly.

@dosubot
Copy link

dosubot bot commented Mar 3, 2026

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

您好,感谢您为项目添加对阿里云百炼(Aliyun Bailian)的支持。这是一个很棒的功能增强。
代码整体结构清晰,遵循了项目现有的模式。我主要有两个建议:

  1. bailian_chat_source.py 中,有一个可以移除的多余方法覆写。
  2. bailian_chat_source.pyconfig.py 中存在 API 端点 URL 的重复代码。我建议将它们提取为常量以提高可维护性。

具体的修改建议我已经以评论的形式提出。再次感谢您的贡献!

Comment on lines +447 to +452
if new_source_config.get("type") == "bailian_chat_completion":
is_coding_plan = new_source_config.get("bl_coding_plan", False)
if is_coding_plan:
new_source_config["api_base"] = "https://coding.dashscope.aliyuncs.com/v1"
else:
new_source_config["api_base"] = "https://dashscope.aliyuncs.com/compatible-mode/v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

您好,这部分用于确定阿里云百炼 api_base 的逻辑与 astrbot/core/provider/sources/bailian_chat_source.py 中的逻辑重复了。这可能会在未来导致维护困难,因为如果 URL 发生变化,需要同时修改两个地方。

为了提高代码的可维护性,建议将这些 URL 定义为常量,并在两处复用。一个好的实践是将常量定义在 bailian_chat_source.py 中,然后在这里导入使用。

建议修改:

  1. astrbot/core/provider/sources/bailian_chat_source.py 文件顶部添加常量定义:

    BAILIAN_CODING_PLAN_API_BASE = "https://coding.dashscope.aliyuncs.com/v1"
    BAILIAN_COMPATIBLE_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
  2. astrbot/core/provider/sources/bailian_chat_source.py__init__ 方法中使用这些常量:

    if is_coding_plan:
        provider_config["api_base"] = BAILIAN_CODING_PLAN_API_BASE
    else:
        provider_config["api_base"] = BAILIAN_COMPATIBLE_API_BASE
  3. 在此文件 (astrbot/dashboard/routes/config.py) 中,也导入并使用这些常量。

Suggested change
if new_source_config.get("type") == "bailian_chat_completion":
is_coding_plan = new_source_config.get("bl_coding_plan", False)
if is_coding_plan:
new_source_config["api_base"] = "https://coding.dashscope.aliyuncs.com/v1"
else:
new_source_config["api_base"] = "https://dashscope.aliyuncs.com/compatible-mode/v1"
if new_source_config.get("type") == "bailian_chat_completion":
from astrbot.core.provider.sources.bailian_chat_source import (
BAILIAN_CODING_PLAN_API_BASE,
BAILIAN_COMPATIBLE_API_BASE,
)
is_coding_plan = new_source_config.get("bl_coding_plan", False)
if is_coding_plan:
new_source_config["api_base"] = BAILIAN_CODING_PLAN_API_BASE
else:
new_source_config["api_base"] = BAILIAN_COMPATIBLE_API_BASE

Comment on lines +43 to +45
def _extract_reasoning_content(self, completion) -> str:
"""提取推理内容"""
return super()._extract_reasoning_content(completion)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

_extract_reasoning_content 方法是对父类方法的空覆写,它只是简单地调用了 super()。这个方法是多余的,可以安全地移除,以使代码更简洁。移除后,程序将自动调用父类的实现,行为不会改变。

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

Labels

area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant