feat: add ETOS LLM Studio quick import support - #5729
Conversation
改动文件:setting/chat.go、default chat-links、classic token/settings/sidebar 相关文件。
目的:在 /console/setting?tab=chats 内置 ETOS LLM Studio 导入模板,并让令牌页能生成 etosConfig。
效果:生成 etosllmstudio://provider/install?v=1&data={etosConfig},data 使用 new-api/baseUrl/apiKey 的 Base64 JSON,classic 侧边栏会跳过该外部 scheme。
WalkthroughAdds "ETOS LLM Studio" as a new built-in chat provider. The backend registers the provider in the default ChangesETOS LLM Studio provider integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/default/src/features/chat/lib/chat-links.ts (1)
163-201: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: consolidate the duplicated
new-apipayload branches.
{cherryConfig},{deepchatConfig}, and{etosConfig}now build byte-identical payloads ({ id: 'new-api', baseUrl, apiKey }) and only differ by token name. Consider a small token→builder map to avoid further copy-paste as providers are added.♻️ Sketch
- if (url.includes('{cherryConfig}')) { - const payload = { id: 'new-api', baseUrl: safeServerAddress, apiKey: safeApiKey } - const encoded = encodeURIComponent(toBase64(JSON.stringify(payload))) - return replaceToken(url, '{cherryConfig}', encoded) - } - ... - if (url.includes('{etosConfig}')) { ... } + const newApiTokens = ['{cherryConfig}', '{deepchatConfig}', '{etosConfig}'] + for (const token of newApiTokens) { + if (url.includes(token)) { + const payload = { id: 'new-api', baseUrl: safeServerAddress, apiKey: safeApiKey } + const encoded = encodeURIComponent(toBase64(JSON.stringify(payload))) + return replaceToken(url, token, encoded) + } + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/chat/lib/chat-links.ts` around lines 163 - 201, The {cherryConfig}, {deepchatConfig}, and {etosConfig} branches in chat-links.ts are duplicating the same new-api payload logic. Refactor the URL-token handling in the relevant function to use a small token-to-payload builder map or shared helper so the identical { id: 'new-api', baseUrl, apiKey } construction lives in one place, while still keeping the distinct token names and the existing {aionuiConfig} payload unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@web/default/src/features/chat/lib/chat-links.ts`:
- Around line 163-201: The {cherryConfig}, {deepchatConfig}, and {etosConfig}
branches in chat-links.ts are duplicating the same new-api payload logic.
Refactor the URL-token handling in the relevant function to use a small
token-to-payload builder map or shared helper so the identical { id: 'new-api',
baseUrl, apiKey } construction lives in one place, while still keeping the
distinct token names and the existing {aionuiConfig} payload unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dc9f2a1d-45ec-44b8-b81a-ac7d511ac4a2
📒 Files selected for processing (5)
setting/chat.goweb/classic/src/components/layout/SiderBar.jsxweb/classic/src/hooks/tokens/useTokensData.jsxweb/classic/src/pages/Setting/Chat/SettingsChats.jsxweb/default/src/features/chat/lib/chat-links.ts
51fdfc5 to
2b6f1df
Compare
Important
📝 变更描述 / Description
新增 ETOS LLM Studio 的聊天快捷导入入口,让管理员在
/console/setting?tab=chats可以使用内置模板添加:etosllmstudio://provider/install?v=1&data={etosConfig}前端打开该模板时会把
{etosConfig}替换为 Base64 JSON,内容与 Cherry Studio / DeepChat 的导入格式保持一致,包含id: new-api、baseUrl和apiKey。classic 前端同步加入模板,并在侧边栏过滤etosllmstudio外部 scheme,避免它被当成内嵌聊天页面展示。同时将
setting/chat.go中的 JSON 编解码切换到项目统一的common.Marshal/common.Unmarshal包装函数。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
重复提交搜索:
本地检查:
说明:当前本地环境没有
bun,且前端依赖未安装,因此未运行 frontend build。Summary by CodeRabbit
New Features
Bug Fixes