feat(provider): add iFlytek Spark provider preset#9330
Open
FenjuFu wants to merge 1 commit into
Open
Conversation
Spark's official endpoint is OpenAI-compatible, so it rides the existing openai_chat_completion path with no new source file - the preset only saves users from hand-typing the base URL, matching how DeepSeek, Moonshot and NVIDIA are wired. Requested in AstrBotDevs#3077. Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for the iFlytek Spark provider by adding its default configuration settings in astrbot/core/config/default.py and mapping its icon URL in dashboard/src/utils/providerUtils.js. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
讯飞星火(iFlytek Spark)的官方接口
https://spark-api-open.xf-yun.com/v1是 OpenAI 兼容的,但目前没有预设条目。用户只能选「OpenAI Compatible」后手动填写 base URL,而 DeepSeek、Moonshot、Zhipu、LongCat、MiniMax、Xiaomi 等国内厂商都已有预设。社区此前提过该需求(#3077)。iFlytek Spark's official endpoint (
https://spark-api-open.xf-yun.com/v1) is OpenAI-compatible but has no preset entry, so users must pick "OpenAI Compatible" and type the base URL by hand — while DeepSeek, Moonshot, Zhipu, LongCat, MiniMax and Xiaomi all ship presets. Previously requested in #3077.Modifications / 改动点
astrbot/core/config/default.py— 在config_template中新增iFlytek Spark预设,放在 LongCat 之后、AIHubMix 之前(与其他国内厂商相邻)。字段与 DeepSeek 预设完全同构,type为现有的openai_chat_completion,因此不需要新增 source 文件,也不需要改动manager.py或openai_source.py。dashboard/src/utils/providerUtils.js— 为iflytek_spark注册图标,复用 lobehub 图标库中的spark-color.svg(该图标在上游标注即为「Spark (讯飞星火)」,https://xinghuo.xfyun.cn )。纯新增,不改动任何既有条目的行为。
Screenshots or Test Results / 运行截图或测试结果
本机没有可运行的 AstrBot 实例(无法提供 UI 截图),因此改动通过对配置与前端逻辑的直接断言来验证:
1. 配置模板(AST 解析
default.py后断言)断言内容:字段集合与
DeepSeek预设完全一致;id在 60 个模板中唯一且无重复;type/provider_type/api_base取值正确。python -m py_compile通过。2. 前端图标解析(导入
providerUtils.js后调用)3. 图标资源:已确认
spark-color.svg在 CDN 上可正常获取,且在 lobehub/lobe-icons 中的标注为title: Spark (讯飞星火)。未做:未使用真实 API key 跑通端到端对话(无可用配额)。由于该预设仅提供 base URL 默认值、完全复用既有的
openai_chat_completion实现,运行时路径与手动填写 base URL 的「OpenAI Compatible」配置完全一致。Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。(社区需求见 [Feature]老师老师什么时候上星火的服务提供商 #3077)
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced.
/ 我确保没有引入新依赖库。
😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Add a preset configuration and icon support for the iFlytek Spark provider.
New Features:
Enhancements: