feat: add Qiniu provider support#1612
Conversation
Greptile SummaryThis PR integrates Qiniu AI (七牛云) as a new OpenAI-compatible channel provider, wiring it through the full stack: Ent schema, GraphQL enum, Go service layer, and TypeScript/React frontend. The backend changes are consistent with how other OpenAI-compatible providers (DeepInfra, Minimax, etc.) are registered.
Confidence Score: 4/5The frontend has a missing import that will cause a TypeScript build error; fix is a one-line addition to the @lobehub/icons import block. The Go backend changes are clean and consistent with existing provider integrations. The only defect is in config_channels.ts, where the Qiniu icon component is used without being imported — this breaks TypeScript compilation and leaves the Qiniu channel icon non-functional until corrected. frontend/src/features/channels/data/config_channels.ts — missing Qiniu icon import Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Client Request - TypeQiniu] --> B{Model Fetch}
B -->|No API Key| C[Return qiniuFallbackModels\ndeepseek-v3]
B -->|Has API Key| D[HTTP GET /models]
D -->|HTTP error| C
D -->|Non-200 status| C
D -->|Parse error| C
D -->|Success| E[Return parsed models]
A --> F{LLM Request}
F --> G[OpenAI Outbound Transformer\nchannel_llm.go]
G --> H[POST api.qnaigc.com/v1/chat/completions]
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for the Qiniu channel and provider across the application, including frontend configurations, backend schema updates, and localized strings. It also implements specific model fetching logic for Qiniu that provides a fallback to 'deepseek-v3' in case of errors or missing API keys. Feedback was provided to use the specific Qiniu icon in the channel configuration for consistency with the provider setup.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
Added support for Qiniu AI (七牛云) as a new model provider.
What changed
axonhub/frontend/src/features/channels/data/schema.ts— Adds qiniu to the frontend channelType Zod enum so forms, bulk import, and channel typing accept the new type.axonhub/internal/server/gql/ent.graphql— Exposes qiniu on the GraphQL ChannelType enum so API clients match the stored Ent channel type.axonhub/internal/server/biz/model_fetcher.go— Introduces Qiniu-specific fallback models (deepseek-v3) when there is no API key or when list-models HTTP calls fail or return non-OK status or unparsed bodies, so the UI still gets a usable default model list.axonhub/internal/server/biz/channel_llm.go— Treats TypeQiniu like other OpenAI-compatible platforms by wiring the OpenAI outbound transformer (same path as OpenAI, DeepInfra, Minimax, etc.).axonhub/internal/server/biz/channel_endpoint.go— Registers default endpoints for Qiniu as OpenAI chat completions only (openai/chat_completions).axonhub/internal/ent/schema/channel.go— Adds qiniu to the Ent type enum values so channels can be persisted with that type.axonhub/internal/ent/channel/channel.go— Defines TypeQiniu = "qiniu" and includes it in validation / shared type-switch helpers generated from the schema.axonhub/frontend/src/locales/zh-CN/channels.json— Chinese UI strings for the Qiniu channel type and provider name, and mentions qiniu in bulk-import supported-types copy.axonhub/frontend/src/locales/en/channels.json— Same as zh-CN in English.axonhub/frontend/src/features/channels/data/config_providers.ts— Registers the Qiniu provider card (Qiniu icon, color, channelTypes: ['qiniu']) for the channels UI.axonhub/frontend/src/features/channels/data/config_channels.ts— Adds the Qiniu preset: default base URL https://api.qnaigc.com/v1, default models deepseek-v3, OpenAI chat-completions format, plus union/mapping entries so the preset key resolves to qiniu.Testing