Skip to content

feat: add GiteeAI provider support to Go API server - #15131

Merged
JinHai-CN merged 7 commits into
infiniflow:mainfrom
Helios531:feat/giteeai-go-provider
May 27, 2026
Merged

JinHai-CN merged 7 commits into
infiniflow:mainfrom
Helios531:feat/giteeai-go-provider

Conversation

@Helios531

@Helios531 Helios531 commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Closes #15090.

Adds GiteeAI support to the Go model-provider layer so GiteeAI chat models can be routed through the Go API server using the same OpenAI-compatible chat, streaming, model listing, and connection-check flow used by other SaaS providers.

GiteeAI is implemented as a separate provider from the existing gitee provider.

Type of change

  • New Feature (non-breaking change which adds functionality)

Summary

  • Added a GiteeAI Go model driver.
  • Added the GiteeAI provider catalog with default base URL https://ai.gitee.com/v1.
  • Registered giteeai in the model factory separately from gitee.
  • Added focused provider tests for sync chat, streaming chat, model listing, connection checks, base URL override, SSE parsing, [DONE] handling, and unsupported methods.

What changed

  • Implemented ChatWithMessages for POST /chat/completions.
  • Implemented ChatStreamlyWithSender with SSE parsing, delta extraction, finish_reason, [DONE], and <think> tag handling.
  • Implemented ListModels for GET /models.
  • Implemented CheckConnection by delegating to ListModels.
  • Returned standard no such method errors for unsupported embedding, rerank, image-to-text, ASR, and TTS paths.

Tests

go test -vet=off ./internal/entity/models -run 'TestGiteeAI' -count=1
go test -vet=off ./internal/entity -run 'Test.*Provider|Test.*Model' -count=1

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 💞 feature Feature request, pull request that fullfill a new feature. labels May 21, 2026
@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b4719404-f476-4605-859c-b6720bb082af

📥 Commits

Reviewing files that changed from the base of the PR and between efa7931 and 8387cd4.

📒 Files selected for processing (1)
  • conf/models/gitee.json
✅ Files skipped from review due to trivial changes (1)
  • conf/models/gitee.json

📝 Walkthrough

Walkthrough

Updates the Gitee provider config to set url.default to https://api.moark.ai/v1, add a url.deprecated entry, set url.china to https://api.moark.com/v1, and touch the file EOF formatting.

Changes

Gitee Configuration Updates

Layer / File(s) Summary
API Endpoint URLs
conf/models/gitee.json
The url object is updated: default is now https://api.moark.ai/v1, china is set to https://api.moark.com/v1, and a deprecated endpoint is added. EOF closing brace was touched.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

💞 feature, ci, size:L

Suggested reviewers

  • Haruko386

Poem

🐰 A configuration hop, I nudge the file anew,
Old endpoints bow out as fresh URLs debut,
moark.ai leads the way while moark.com stays,
A deprecated path lingers for legacy days,
Small change, soft thump — the rabbit stamps approval.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Raw summary shows only conf/models/gitee.json changes (updating default URL and adding china/deprecated endpoints). This appears tangential to GiteeAI implementation, which requires separate giteeai.json file per issue #15090. Clarify why conf/models/gitee.json is being modified when the scope is adding a separate GiteeAI provider. These changes may be out of scope or indicate incomplete file listing in the summary.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR addresses issue #15090 requirements: adds GiteeAI driver, provider config, factory registration, implements chat/streaming/list-models/connection-check, and includes tests. However, raw_summary shows only conf/models/gitee.json changes, not conf/models/giteeai.json. Verify that conf/models/giteeai.json was created with proper GiteeAI configuration including default base URL https://ai.gitee.com/v1, and confirm internal/entity/models/giteeai.go implementation exists.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title describes adding GiteeAI provider support, which matches the PR's primary objective of implementing GiteeAI in the Go API server.
Description check ✅ Passed Description covers problem statement, change type, detailed implementation summary, and test commands. However, it lacks explicit mention of the conf/models/gitee.json changes noted in the raw summary.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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 `@internal/entity/models/giteeai_test.go`:
- Around line 107-110: The handler in the test uses t.Fatalf inside the httptest
server goroutine when checking messages (the block that inspects
body["messages"] and the variable messages), which can abort only that
goroutine; change the t.Fatalf to t.Errorf and immediately return from the
handler so the parent test is reliably marked failed—i.e., in the handler that
parses body["messages"] and sets messages, replace t.Fatalf("messages=%v",
body["messages"]) with t.Errorf("messages=%v", body["messages"]) followed by
return.
🪄 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: 8297c81d-fa9b-4a2d-83ae-8fd506334088

📥 Commits

Reviewing files that changed from the base of the PR and between 57ddd79 and 9dca56c.

📒 Files selected for processing (4)
  • conf/models/giteeai.json
  • internal/entity/models/factory.go
  • internal/entity/models/giteeai.go
  • internal/entity/models/giteeai_test.go

Comment thread internal/entity/models/giteeai_test.go Resolved
@Haruko386 Haruko386 removed the 💞 feature Feature request, pull request that fullfill a new feature. label May 22, 2026
@Haruko386

Haruko386 commented May 22, 2026 •

Copy link
Copy Markdown
Member

Hi @Helios531, As far as I know, ai.gitee.com is old baseURL for gitee.
So I think you should just add this URL under gitee default URL.

I suggest:

"url": {
    "default": "https://api.moark.ai/v1",
    "china": "https://api.moark.com/v1",
    "deprecated": "https://ai.gitee.com/v1"
  },

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels May 22, 2026
@Helios531

Helios531 commented May 22, 2026 •

Copy link
Copy Markdown
Contributor Author

hi, @Haruko386, can you review again, plz.

@Haruko386 Haruko386 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @Helios531 LGTM

@JinHai-CN JinHai-CN added the ci Continue Integration label May 27, 2026
@JinHai-CN
JinHai-CN marked this pull request as draft May 27, 2026 05:16
@JinHai-CN
JinHai-CN marked this pull request as ready for review May 27, 2026 05:16
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (187dc8a) to head (ae50c3d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15131   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit ae5f48f into infiniflow:main May 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Implement provider: GiteeAI in Go driver

3 participants