Skip to content

Go: implement provider: CometAPI - #14930

Merged
JinHai-CN merged 22 commits into
infiniflow:mainfrom
tmimmanuel:go/cometapi-provider
May 18, 2026
Merged

JinHai-CN merged 22 commits into
infiniflow:mainfrom
tmimmanuel:go/cometapi-provider

Conversation

@tmimmanuel

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Adds the Go model provider driver for CometAPI, which is listed as unchecked in the Go provider tracking issue #14736 and requested in #14804. Without this, the Go layer falls back to the dummy driver for the cometapi provider.

Fixes #14804

What this PR includes

  • New internal/entity/models/cometapi.go implementing ModelDriver for CometAPI.
  • New conf/models/cometapi.json with CometAPI base URLs and representative chat / embedding models from the public catalog.
  • factory.go: route "cometapi" to NewCometAPIModel.
  • Unit tests in internal/entity/models/cometapi_test.go.

Method coverage

  • ChatWithMessages: POST /v1/chat/completions.
  • ChatStreamlyWithSender: SSE streaming on the same endpoint.
  • Embed: POST /v1/embeddings, including optional dimensions.
  • ListModels: GET /api/models public catalog.
  • Balance: GET https://query.cometapi.com/user/quota?key=....
  • CheckConnection: delegates to the quota query to verify the key.
  • Rerank, ASR, TTS, OCR: return no such method for now.

No ModelDriver interface change. No new dependencies.

How was this tested?

go test -vet=off -run TestCometAPI -count=1 ./internal/entity/models/...
go test -vet=off -count=1 ./internal/entity/models/...

@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label May 14, 2026
@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a CometAPI provider to the Go model layer: non-streaming and SSE streaming chat, embeddings with index reordering/validation, model listing, balance/check connection, factory routing, configuration, and comprehensive tests.

Changes

CometAPI Model Driver

Layer / File(s) Summary
Driver foundation and HTTP setup
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
CometAPIModel struct, constructor with cloned/tuned http.Transport, region/base-url and endpoint helpers, request helpers, test helpers, and factory routing.
Non-streaming chat implementation
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
ChatWithMessages validates API key/model/messages, POSTs regional /v1/chat with stream:false and generation params, parses response into ChatResponse (content + reasoning_content); tested for happy path, config propagation, validation, HTTP errors, and region fallback.
Streaming chat with SSE parsing
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
ChatStreamlyWithSender requires sender callback, enforces stream:true, parses SSE data: events with a larger scanner buffer, emits delta reasoning/content via sender, detects [DONE]/finish_reason and emits final sentinel; includes URL-normalization and end-to-end SSE tests.
Embeddings with index reordering and validation
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
Embed short-circuits on empty input, validates API key/model, POSTs /v1/embeddings with optional dimensions, reorders vectors by returned index, and rejects duplicate/out-of-range/missing indices; covered by extensive tests.
Model catalog listing
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
ListModels GETs regional /api/models, unmarshals data array and returns model ids; supports default-region fallback and nil APIConfig.
Balance and connectivity checks
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
Balance performs GET to quota endpoint with key query param and parses JSON map; CheckConnection delegates to Balance; tests cover success and error cases.
Stubbed unsupported capabilities
internal/entity/models/cometapi.go, internal/entity/models/cometapi_test.go
Rerank, TranscribeAudio*, AudioSpeech*, OCRFile return "no such method" errors; Rerank tested.
Configuration and factory integration
conf/models/cometapi.json, internal/entity/models/factory.go
Adds CometAPI configuration (base URLs, endpoint suffixes, model registrations) and registers "cometapi" in CreateModelDriver to construct NewCometAPIModel.
Service streaming sentinel change
internal/service/chat_session.go
Tightens streaming callback to ignore "[DONE]" sentinel so it is not emitted/appended as normal content; minor formatting changes in session update maps.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant CometAPIModel
  participant CometAPI
  participant Sender
  Client->>CometAPIModel: ChatStreamlyWithSender(model,messages,apiConfig,chatConfig,sender)
  CometAPIModel->>CometAPI: POST /v1/chat (stream:true, model,messages,params)
  CometAPI-->>CometAPIModel: SSE data: {"delta":{"reasoning_delta"/"content_delta"}}
  CometAPIModel->>Sender: emit reasoning_delta / content_delta
  CometAPI-->>CometAPIModel: [DONE] or finish_reason
  CometAPIModel->>Sender: emit "[DONE]" sentinel
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

💞 feature

Suggested reviewers

  • Haruko386

Poem

🐇 I hopped through configs, tests, and streams,
CometAPI now hums inside our schemes,
Chat and embeddings dance in tidy lines,
Regions routed, tests passing — tiny wins,
A rabbit's cheer for every green CI beam!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Go: implement provider: CometAPI' clearly and concisely summarizes the main change—adding a new CometAPI provider implementation in Go.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem, included changes, method coverage, and testing approach for the CometAPI provider implementation.
Linked Issues check ✅ Passed The PR fully implements all coding-related requirements from issue #14804: CometAPIModel driver, factory routing, unit tests, config file, and all specified method coverage (chat, streaming, embeddings, models, balance, connection checks, and unsupported methods returning errors).
Out of Scope Changes check ✅ Passed All changes are directly in scope: the new CometAPI driver implementation, configuration, factory routing, comprehensive tests, and minor formatting adjustments in chat_session.go related to streaming callback filtering are all aligned with #14804 requirements.

✏️ 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/cometapi.go`:
- Around line 119-123: Add a local validation that returns a clear error when
modelName is empty before making any remote chat call: in
CometAPIModel.ChatWithMessages (and the analogous chat method around lines
239-250, e.g., ChatWithMessage/ChatWithHistory), check if
strings.TrimSpace(modelName) == "" and return fmt.Errorf("model name is
required") (or similar) instead of proceeding; update both function entry points
(ChatWithMessages and the other chat method reference) so empty or
all-whitespace modelName fails fast.
🪄 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: 89328436-b8a2-4a6a-8280-96750fb51957

📥 Commits

Reviewing files that changed from the base of the PR and between 5a5bbee and 05d408d.

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

Comment thread internal/entity/models/cometapi.go Resolved

@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: 2

🧹 Nitpick comments (1)
internal/entity/models/cometapi.go (1)

637-657: 💤 Low value

Receiver name inconsistency in the unsupported-capability stubs.

All other methods on *CometAPIModel use receiver m, but TranscribeAudio, TranscribeAudioWithSender, AudioSpeech, AudioSpeechWithSender, and OCRFile use z. This looks like a copy-paste leftover from another provider (e.g., a zhipu-style driver) and breaks the consistency convention gofmt/go vet-adjacent tooling tends to flag.

♻️ Proposed fix
-func (z *CometAPIModel) TranscribeAudio(modelName *string, file *string, apiConfig *APIConfig, asrConfig *ASRConfig) (*ASRResponse, error) {
-	return nil, fmt.Errorf("%s, no such method", z.Name())
+func (m *CometAPIModel) TranscribeAudio(modelName *string, file *string, apiConfig *APIConfig, asrConfig *ASRConfig) (*ASRResponse, error) {
+	return nil, fmt.Errorf("%s, no such method", m.Name())
 }
 
-func (z *CometAPIModel) TranscribeAudioWithSender(modelName *string, file *string, apiConfig *APIConfig, asrConfig *ASRConfig, sender func(*string, *string) error) error {
-	return fmt.Errorf("%s, no such method", z.Name())
+func (m *CometAPIModel) TranscribeAudioWithSender(modelName *string, file *string, apiConfig *APIConfig, asrConfig *ASRConfig, sender func(*string, *string) error) error {
+	return fmt.Errorf("%s, no such method", m.Name())
 }
 
-// AudioSpeech convert audio to text
-func (z *CometAPIModel) AudioSpeech(modelName *string, audioContent *string, apiConfig *APIConfig, asrConfig *TTSConfig) (*TTSResponse, error) {
-	return nil, fmt.Errorf("%s, no such method", z.Name())
+func (m *CometAPIModel) AudioSpeech(modelName *string, audioContent *string, apiConfig *APIConfig, asrConfig *TTSConfig) (*TTSResponse, error) {
+	return nil, fmt.Errorf("%s, no such method", m.Name())
 }
 
-func (z *CometAPIModel) AudioSpeechWithSender(modelName *string, audioContent *string, apiConfig *APIConfig, ttsConfig *TTSConfig, sender func(*string, *string) error) error {
-	return fmt.Errorf("%s, no such method", z.Name())
+func (m *CometAPIModel) AudioSpeechWithSender(modelName *string, audioContent *string, apiConfig *APIConfig, ttsConfig *TTSConfig, sender func(*string, *string) error) error {
+	return fmt.Errorf("%s, no such method", m.Name())
 }
 
-// OCRFile OCR file
-func (z *CometAPIModel) OCRFile(modelName *string, content []byte, url *string, apiConfig *APIConfig, ocrConfig *OCRConfig) (*OCRResponse, error) {
-	return nil, fmt.Errorf("%s, no such method", z.Name())
+func (m *CometAPIModel) OCRFile(modelName *string, content []byte, url *string, apiConfig *APIConfig, ocrConfig *OCRConfig) (*OCRResponse, error) {
+	return nil, fmt.Errorf("%s, no such method", m.Name())
 }
🤖 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 `@internal/entity/models/cometapi.go` around lines 637 - 657, The stub methods
TranscribeAudio, TranscribeAudioWithSender, AudioSpeech, AudioSpeechWithSender,
and OCRFile on type *CometAPIModel use receiver name `z` but the rest of the
type’s methods use `m`; change the receiver identifier in each of those method
signatures from `z` to `m` so they match the existing convention (e.g., func (m
*CometAPIModel) TranscribeAudio(...)), leaving bodies and returned errors
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.

Inline comments:
In `@internal/entity/models/cometapi.go`:
- Line 645: The doc comment for AudioSpeech is incorrect: it describes
audio-to-text but AudioSpeech implements text-to-speech (TTS); update the
comment on the AudioSpeech declaration to clearly state it converts text to
audio (TTS) and not speech-to-text, and if helpful contrast it with
TranscribeAudio (which is the audio-to-text stub) so readers won't confuse the
two.
- Around line 398-401: The assembled-answer logic must ignore the "[DONE]"
sentinel before concatenating; update the service-layer callback that builds
fullAnswer (the block at chat_session.go where it checks if answer != nil &&
*answer != "") to also skip when *answer == "[DONE]". Locate the concatenation
site that references fullAnswer and the callback passed to sender, and change
the condition to require *answer != "" AND *answer != "[DONE]" (or explicitly
return early when *answer == "[DONE]") so the literal sentinel is never
appended.

---

Nitpick comments:
In `@internal/entity/models/cometapi.go`:
- Around line 637-657: The stub methods TranscribeAudio,
TranscribeAudioWithSender, AudioSpeech, AudioSpeechWithSender, and OCRFile on
type *CometAPIModel use receiver name `z` but the rest of the type’s methods use
`m`; change the receiver identifier in each of those method signatures from `z`
to `m` so they match the existing convention (e.g., func (m *CometAPIModel)
TranscribeAudio(...)), leaving bodies and returned errors unchanged.
🪄 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: 0e482a4d-952f-4178-b37f-a9ad30fea7a4

📥 Commits

Reviewing files that changed from the base of the PR and between 05d408d and 012a061.

📒 Files selected for processing (2)
  • internal/entity/models/cometapi.go
  • internal/entity/models/cometapi_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/entity/models/cometapi_test.go

Comment thread internal/entity/models/cometapi.go Resolved
Comment thread internal/entity/models/cometapi.go Resolved
@tmimmanuel

Copy link
Copy Markdown
Contributor Author

Live CometAPI test result (2026-05-14 UTC)

Ran a temporary build-tagged live test against CometAPI with a real API key. The live matrix covered every CometAPI driver method and every model currently configured in conf/models/cometapi.json.

Passed method coverage:

  • Name and NewInstance
  • ListModels: returned the remote catalog and contained all 11 configured CometAPI model IDs
  • Balance
  • CheckConnection
  • ChatWithMessages: passed for all 8 configured chat models
  • ChatStreamlyWithSender: passed for all 8 configured chat models
  • Embed: passed for all 3 configured embedding models
  • Unsupported methods returned the expected no such method error: Rerank, TranscribeAudio, TranscribeAudioWithSender, AudioSpeech, AudioSpeechWithSender, OCRFile

Configured chat model results:

  • gpt-5.5: non-stream OK, stream OK
  • gpt-5.4-mini: non-stream OK, stream OK
  • gpt-5: CometAPI returned success/no driver error, but visible content was empty with max_tokens=32 and again on a targeted retry with max_tokens=128. I am treating this as upstream model/token behavior rather than a driver failure because transport, response parsing, and streaming completion all succeeded.
  • gpt-4o: non-stream OK, stream OK
  • claude-sonnet-4-6: non-stream OK, stream OK
  • gemini-3-pro-preview: non-stream OK; one 32-token stream run returned empty visible content, then a targeted 128-token retry streamed OK
  • deepseek-v3.2: non-stream OK, stream OK
  • qwen3-235b-a22b: non-stream OK, stream OK, and returned reasoning_content in both paths

Configured embedding model results:

  • text-embedding-3-small: OK with dimensions=16
  • text-embedding-3-large: OK with dimensions=16
  • text-embedding-ada-002: OK with default dimensions, returned dimension 1536. CometAPI rejects explicit dimensions for this model, so the live check used the supported default path.

Local regression checks also passed:

  • go test -vet=off -run TestCometAPI -count=1 ./internal/entity/models/...
  • go test -vet=off -count=1 ./internal/entity/models/...

@tmimmanuel
tmimmanuel force-pushed the go/cometapi-provider branch from d93808e to a6bef6f Compare May 14, 2026 17:37
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels May 14, 2026
Jiafan and others added 19 commits May 14, 2026 18:47
…n be alert (infiniflow#487)

…e alert

### What problem does this PR solve?

.doc file is not support yet, fix the regular expression ,then right
message can by alert

### Type of change

- [ ] Bug Fix  : issule: 474
### What problem does this PR solve?

### Type of change

- [x] Refactoring
…iniflow#1678)

Bumps
[follow-redirects](https://github.com/follow-redirects/follow-redirects)
from 1.15.4 to 1.15.6.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/35a517c5861d79dc8bff7db8626013d20b711b06"><code>35a517c</code></a>
Release version 1.15.6 of the npm package.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/c4f847f85176991f95ab9c88af63b1294de8649b"><code>c4f847f</code></a>
Drop Proxy-Authorization across hosts.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/8526b4a1b2ab3a2e4044299377df623a661caa76"><code>8526b4a</code></a>
Use GitHub for disclosure.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/b1677ce00110ee50dc5da576751d39b281fc4944"><code>b1677ce</code></a>
Release version 1.15.5 of the npm package.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/d8914f7982403ea096b39bd594a00ee9d3b7e224"><code>d8914f7</code></a>
Preserve fragment in responseUrl.</li>
<li>See full diff in <a
href="https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.15.4&new-version=1.15.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/infiniflow/ragflow/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ature' (infiniflow#4601)

`graphrag/search.py`中`search`方法缺少参数`rank_feature`

Co-authored-by: xubh <[email protected]>
Co-authored-by: Kevin Hu <[email protected]>
### What problem does this PR solve?

Use infinity 0.6.0

### Type of change

- [x] Documentation Update

Signed-off-by: Jin Hai <[email protected]>
…12931)

### What problem does this PR solve?

close infiniflow#12930 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

### Changes
only delete duplicate definition in `api/db/db_models.py`
…2933)

### What problem does this PR solve?

Fixed the regression issue that unable to start the server as below
details, which was related to this pr
infiniflow#12926 looks like.
``` Error Trace
Traceback (most recent call last):
  File "/mnt/c/Workspace/ragflow/api/ragflow_server.py", line 33, in <module>
    from api.apps import app
  File "/mnt/c/Workspace/ragflow/api/apps/__init__.py", line 26, in <module>
Traceback (most recent call last):
  File "/mnt/c/Workspace/ragflow/rag/svr/task_executor.py", line 34, in <module>
    from api.db.db_models import close_connection, APIToken
  File "/mnt/c/Workspace/ragflow/api/db/db_models.py", line 49, in <module>
    from api.db.services.knowledgebase_service import KnowledgebaseService
  File "/mnt/c/Workspace/ragflow/api/db/services/__init__.py", line 19, in <module>
    class TextFieldType(Enum):
  File "/mnt/c/Workspace/ragflow/api/db/db_models.py", line 53, in TextFieldType
    from .user_service import UserService as UserService
  File "/mnt/c/Workspace/ragflow/api/db/services/user_service.py", line 24, in <module>
    POSTGRES = "TEXT"
    ^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 443, in __setitem__
    raise TypeError('%r already defined as %r' % (key, self[key]))
TypeError: 'POSTGRES' already defined as 'TEXT'
    from api.db.db_models import DB, UserTenant
  File "/mnt/c/Workspace/ragflow/api/db/db_models.py", line 49, in <module>
    class TextFieldType(Enum):
  File "/mnt/c/Workspace/ragflow/api/db/db_models.py", line 53, in TextFieldType
    POSTGRES = "TEXT"
    ^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 443, in __setitem__
    raise TypeError('%r already defined as %r' % (key, self[key]))
TypeError: 'POSTGRES' already defined as 'TEXT'
```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
…finiflow#12936)

### What problem does this PR solve?
Fixes a duplicate POSTGRES entry in the TextFieldType enum that triggers
TypeError: 'POSTGRES' already defined as 'TEXT' on
import, preventing the backend from starting and resulting in 502 errors
on the frontend.
### Type of change
  - [x] Bug Fix (non-breaking change which fixes an issue)
…sets" for clarity (infiniflow#12967)

### What problem does this PR solve?

Update HTTP API reference to rename "total" field to

### Type of change

- [x] Bug Fix infiniflow#12963

Co-authored-by: Yun.kou <[email protected]>
…iflow#13051)

## Problem
   RAGFlow was using incorrect model names for Google Gemini embeddings:
   - `embedding-001` (missing `gemini-` prefix)
   - `text-embedding-004` (OpenAI model name, not Gemini)
   
   This caused API errors when users tried to use Gemini embeddings.
   
   ## Solution
- Updated `conf/llm_factories.json` to use the correct model name:
`gemini-embedding-001`
   - Removed the incorrect `text-embedding-004` entry
- Added volume mount in `docker-compose.yml` to ensure config changes
persist
   
   ## Testing
Tested with a valid Gemini API key and confirmed embeddings now work
correctly.

## Changes
- Modified `conf/llm_factories.json`
- Modified `docker/docker-compose.yml`

---------

Co-authored-by: Ahmad Intisar <[email protected]>
Co-authored-by: Kevin Hu <[email protected]>
### What problem does this PR solve?

Refactor:   i18n language pack for on-demand import

### Type of change

- [x] Refactoring

Co-authored-by: Kevin Hu <[email protected]>
…ing wrong tenant model lookup (infiniflow#13782)

Summary

When setting a default model for an OpenAI-API-Compatible provider,
ensure_tenant_model_id_for_params called get_api_key
without a model_type filter. If the same model name was registered under
multiple types (e.g., both chat and embedding),
it could return the wrong tenant_llm_id, leading to Model(@None) not
authorized errors during chat.

This applies the same type-scoped fix that PR infiniflow#13569 introduced in
get_model_config_by_type_and_name — now consistently
  in tenant_utils.py as well.

  Changes

  - Added _KEY_TO_MODEL_TYPE mapping in tenant_utils.py
- Each model key (llm_id, embd_id, etc.) now passes its correct LLMType
to get_api_key

  Fixes infiniflow#13775
…t crash (infiniflow#13951)

Fixes infiniflow#13851

## Problem

`OCR.detect()` in `deepdoc/vision/ocr.py` returns `None, None,
time_dict` (a truthy 3-tuple) when the text detector fails or receives a
`None` image. However, the caller in `pdf_parser.py:__ocr()` checks:

```python
bxs = self.ocr.detect(np.array(img), device_id)
if not bxs:  # False! (None, None, time_dict) is a non-empty tuple → truthy
    self.boxes.append([])
    return
bxs = [(line[0], line[1][0]) for line in bxs]  # iterates (None, None, time_dict)
# line = None → None[0] → TypeError: 'NoneType' object is not subscriptable
```

This causes the `NoneType object is not subscriptable` error that
appears after "OCR started" in the chunking pipeline when using PDF +
General parser.

## Solution

Simplified `OCR.detect()` to return `None` (falsy) instead of `None,
None, time_dict` on failure. The `time_dict` was unused by the only
caller of this method. The early-return guard `if not bxs:` in
`pdf_parser.py` then correctly catches it.

## Testing

- The method's only caller (`pdf_parser.py:__ocr`) already has a `if not
bxs:` guard that handles the `None` return correctly.
- No other callers of `OCR.detect()` exist in the codebase.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Modified OCR detection function return behavior to streamline output.
The function now returns detection results only, without timing
metadata. Error cases now return `None` instead of empty tuple values.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…ow#13838)

Fixes infiniflow#13817

### What problem does this PR solve?

The "knowledge graph construction" link on line 21 of
`docs/guides/dataset/run_retrieval_test.md` points to
`./construct_knowledge_graph.md`, which doesn't exist. The actual file
is at `./advanced/construct_knowledge_graph.md`.

### Type of change

- [x] Documentation Update

Signed-off-by: majiayu000 <[email protected]>
@tmimmanuel
tmimmanuel force-pushed the go/cometapi-provider branch from a6bef6f to 332033d Compare May 14, 2026 18:48
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels May 14, 2026

@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 @tmimmanuel, All tests are passed
Do a small change plz.

Comment thread internal/service/chat_session.go Resolved
@Haruko386 Haruko386 added the ci Continue Integration label May 18, 2026
@tmimmanuel
tmimmanuel requested a review from Haruko386 May 18, 2026 02:35

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

LGTM

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (e194027) to head (806afc3).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14930   +/-   ##
=======================================
  Coverage   94.16%   94.16%           
=======================================
  Files          10       10           
  Lines         703      703           
  Branches      112      112           
=======================================
  Hits          662      662           
  Misses         25       25           
  Partials       16       16           

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

@tmimmanuel

Copy link
Copy Markdown
Contributor Author

@JinHai-CN
CI is clean, please review.

@JinHai-CN
JinHai-CN merged commit b09da6e into infiniflow:main May 18, 2026
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request May 19, 2026
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add Go driver for CometAPI model provider