feat: add AGIone channel - #5333
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (8)
WalkthroughRegisters a new AGIone channel (id 58), adds APITypeAGIone, maps channel→API type, implements an agione relay adaptor (URL handling, models), wires it into the relay factory and stream support, updates upstream model URL logic, and adds frontend configuration and UI constants. ChangesAGIone Channel Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/default/src/features/channels/lib/channel-type-config.ts (1)
132-136: ⚡ Quick winLocalize newly added AGIone hint text.
The new
hintsvalues are hardcoded strings; please switch these to i18n keys (or translated retrieval) like the rest of the localized channel UX path.As per coding guidelines, “
web/default/**/*.{tsx,ts}: All user-facing text content must support i18n using thet()function fromuseTranslation()in React components”.🤖 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/channels/lib/channel-type-config.ts` around lines 132 - 136, The new AGIone channel config contains hardcoded user-facing hint text (e.g., around the entry with key 'AGIone Auth Token' in channel-type-config.ts) and must be converted to i18n keys; replace the literal hint strings with i18n key identifiers (e.g., "channels.agione.hint.*") in the config and ensure the React component that renders these hints calls t() from useTranslation() to resolve them at runtime (update the component that reads the channel config to call t(config.hintKey) or map keys to translated text). Keep the config as data-only (keys, not t() calls) and perform translation only in the UI layer where the hint is displayed.
🤖 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.
Inline comments:
In `@web/default/src/features/channels/constants.ts`:
- Around line 79-84: MODEL_FETCHABLE_TYPES is missing the new AGIone channel
type (value 58) so it won't participate in the same upstream model-fetch flow;
update the MODEL_FETCHABLE_TYPES array/const to include the AGIone entry (the
same numeric id 58 used in CHANNEL_TYPE_DISPLAY_ORDER and the const that defines
'AGIone') so AGIone follows the default UI model-fetch behavior, ensuring you
add the same identifier used where CHANNEL_TYPE_DISPLAY_ORDER lists 58.
---
Nitpick comments:
In `@web/default/src/features/channels/lib/channel-type-config.ts`:
- Around line 132-136: The new AGIone channel config contains hardcoded
user-facing hint text (e.g., around the entry with key 'AGIone Auth Token' in
channel-type-config.ts) and must be converted to i18n keys; replace the literal
hint strings with i18n key identifiers (e.g., "channels.agione.hint.*") in the
config and ensure the React component that renders these hints calls t() from
useTranslation() to resolve them at runtime (update the component that reads the
channel config to call t(config.hintKey) or map keys to translated text). Keep
the config as data-only (keys, not t() calls) and perform translation only in
the UI layer where the hint is displayed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e9bb854b-0fa3-4b5e-a8d3-bcfe0b34177f
📒 Files selected for processing (12)
common/api_type.goconstant/api_type.goconstant/channel.gocontroller/channel_upstream_update.gorelay/channel/agione/adaptor.gorelay/channel/agione/adaptor_test.gorelay/channel/agione/constant.gorelay/common/relay_info.gorelay/relay_adaptor.goweb/classic/src/constants/channel.constants.jsweb/default/src/features/channels/constants.tsweb/default/src/features/channels/lib/channel-type-config.ts
7517f01 to
8a951ce
Compare
|
Addressed the CodeRabbit actionable comment by adding AGIone channel type Re-ran: go test ./relay/channel/agione
go test ./constant ./common ./relay/... ./controller -run 'TestNonExistent'The proof images in the PR body have also been refreshed for the updated single commit. |
|
不接受此类非知名供应商 |
Important
📝 变更描述 / Description
本 PR 新增 AGIone 渠道支持,使 New API 可以将请求转发到 AGIone 的 OpenAI-compatible API。
主要改动包括:
https://agione.pro/hyperone/xapi/api/v1。/v1的请求路径做了前缀处理,避免最终转发 URL 出现重复的/v1/v1/...。/v1base URL,但模型列表接口使用https://agione.pro/hyperone/xapi/api/models。这样实现后,AGIone 可以作为一个标准 OpenAI-compatible 上游接入,同时兼容其模型列表接口与聊天补全接口路径不完全一致的情况。
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
本地已运行 AGIone channel 单元测试:
go test ./relay/channel/agione受影响后端包也做了编译级验证:
测试与变更范围截图如下:
AGIone channel unit test passed
Affected backend packages compile verification passed
Focused diff scope and single commit
补充说明:完整测试集中存在若干上游已有测试失败,主要集中在其他 channel/helper/controller 测试,和本次 AGIone 改动无关。
Summary by CodeRabbit
New Features
Tests