Skip to content

feat: add Qiniu provider support#1612

Merged
looplj merged 2 commits into
looplj:unstablefrom
JackChiang233:feat/add-qiniu-provider
May 8, 2026
Merged

feat: add Qiniu provider support#1612
looplj merged 2 commits into
looplj:unstablefrom
JackChiang233:feat/add-qiniu-provider

Conversation

@JackChiang233

Copy link
Copy Markdown
Contributor

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

go test ./... -json; cd llm; go test ./... -json
# 5522 passed 0 failed

@greptile-apps

greptile-apps Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This 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.

  • Backend (Go): TypeQiniu is added to the Ent enum, TypeValidator, GraphQL schema, channel_llm.go transformer routing, and channel_endpoint.go; a deepseek-v3 fallback model list is returned for Qiniu when the model-list API call is unavailable or fails.
  • Frontend (TypeScript): The channel config, provider card, Zod schema, and locale strings are all updated; however, Qiniu is referenced as the icon in config_channels.ts without being added to the @lobehub/icons import block, which will cause a TypeScript compile error.
  • Locale: Both en and zh-CN channel string files include the new type and provider name, and the bulk-import help text is updated.

Confidence Score: 4/5

The 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

Filename Overview
frontend/src/features/channels/data/config_channels.ts Adds qiniu channel config and type mappings; the Qiniu icon is used but not imported from @lobehub/icons, causing a TypeScript compile error.
frontend/src/features/channels/data/config_providers.ts Correctly imports Qiniu icon and registers the provider card; no issues.
internal/server/biz/model_fetcher.go Adds qiniu fallback models; the same guard is duplicated across four error paths rather than using the existing getDefaultModelsByType/tryReturnDefaultModels pattern.
internal/server/biz/channel_llm.go Correctly routes TypeQiniu through the OpenAI outbound transformer, consistent with other OpenAI-compatible providers.
internal/server/biz/channel_endpoint.go Registers Qiniu as an OpenAI chat completions-only endpoint; straightforward and consistent with similar providers.
internal/ent/channel/channel.go Adds TypeQiniu constant and updates TypeValidator switch; change is minimal and correct.
internal/ent/schema/channel.go Adds qiniu to the Ent enum field values; no issues.
internal/server/gql/ent.graphql Exposes qiniu on the GraphQL ChannelType enum; correctly mirrors the Ent schema change.
frontend/src/features/channels/data/schema.ts Adds qiniu to the Zod channelType enum; no issues.

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]
Loading

Comments Outside Diff (1)

  1. frontend/src/features/channels/data/config_channels.ts, line 30-31 (link)

    P1 Qiniu is referenced as an icon on line 141 but is never imported in this file. Every other icon used here (e.g. DeepInfra, Cerebras, AiHubMix) is explicitly listed in the @lobehub/icons import block. Without the import, TypeScript will emit a "Cannot find name 'Qiniu'" error, and even if the build tool skips type-checking, the icon will be undefined at runtime and fail to render.

Reviews (2): Last reviewed commit: "Update frontend/src/features/channels/da..." | Re-trigger Greptile

Comment thread frontend/src/features/channels/data/config_channels.ts Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread frontend/src/features/channels/data/config_channels.ts Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@looplj looplj merged commit 5e020e5 into looplj:unstable May 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants