Repository navigation
Conversation
…15219) ### What problem does this PR solve? Minimum Python version increased to 3.13. ### Type of change - [x] Documentation Update
…t. (infiniflow#15218) ### What problem does this PR solve? Fix: The prompt variable for the agent operator disappears after input. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
… loop nesting) (infiniflow#14761) ## Summary Fixes the confirmed asyncio anti-patterns from infiniflow#14755. Only the three verified bugs are addressed; patterns already correctly using `asyncio.new_event_loop()` in a fresh thread are left untouched. ### Changes **`api/apps/restful_apis/tenant_api.py` — fire-and-forget `send_invite_email`** `asyncio.create_task()` was called without storing the `Task` reference. CPython's GC can collect an unfinished task, silently cancelling it and swallowing exceptions. Fixed by storing the task in a module-level `_background_tasks: set[Task]` with a `done_callback` to discard it on completion — the standard Python idiom for safe background tasks. **`api/apps/restful_apis/agent_api.py` — fire-and-forget `background_run`** Same root cause in the webhook "Immediately" execution path. Same fix applied. **`rag/llm/chat_model.py` (`LocalLLM._stream_response`) — `asyncio.get_event_loop()` on running loop** `asyncio.get_event_loop()` returns Quart's running event loop when called from an async context. Calling `loop.run_until_complete()` on it raises `RuntimeError`. Replaced with `asyncio.new_event_loop()` so the generator uses a dedicated fresh loop, closed in a `finally` block. ## What was NOT changed - `llm_service._sync_from_async_stream` and `evaluation_service._sync_from_async_gen`: both already correctly use `asyncio.new_event_loop()` inside a fresh thread. - `llm_service._run_coroutine_sync`: only caller is `rag/app/resume.py` (sync context), so `thread.join()` is correct there. - `requests` in agent tools: sync methods dispatched through thread pools; httpx migration is a separate, larger refactor. ## Test plan - [ ] Invite a team member and confirm the email is sent with no task warnings in logs. - [ ] Trigger a webhook agent in "Immediately" mode; confirm canvas state is persisted after background run. - [ ] Verify `LocalLLM` (Jina backend) chat and streaming work end-to-end. Closes infiniflow#14755 --------- Co-authored-by: Zhichang Yu <[email protected]>
…orking infiniflow#15175 (infiniflow#15177) ### What problem does this PR solve? Fix [Bug]: Save parser configs in dataset configuration page is not working infiniflow#15175 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
### What problem does this PR solve? Closes infiniflow#15142. ZhipuAI lists `glm-ocr` as an OCR model, but the Go driver still returned `no such method` from `OCRFile`. This wires the advertised model to Z.AI's documented `layout_parsing` endpoint and returns the `md_results` Markdown output through the existing `OCRFileResponse.Text` field. This PR also adds focused tests for URL input, raw file-content base64 input, and validation errors. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): ### Test - [x] `go test -vet=off ./internal/entity/models -run 'TestZhipuAIOCRFile'`
### What problem does this PR solve? Closes infiniflow#15167. The Baidu Go provider advertises OCR support through `paddleocr-vl-0.9b`, but `BaiduModel.OCRFile` dereferenced required inputs before validating them. Calling OCR with a missing API config, API key, or model name could panic instead of returning a normal error. This PR adds explicit input validation for those required values. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Jin Hai <[email protected]>
### What problem does this PR solve? Add a Go driver for **FuturMix** (https://futurmix.ai/docs), one of the unchecked providers on the umbrella tracking issue infiniflow#14736. FuturMix is documented as an "OpenAI-compatible API" aggregator over Claude / GPT / Gemini / DeepSeek (~22 models per their `/models` page). Until this PR, a tenant who configured `futurmix` as a model provider in the Go layer fell through to the default branch of `internal/entity/models/factory.go` and got the dummy driver. --------- Co-authored-by: sxxtony <[email protected]> Co-authored-by: Jin Hai <[email protected]>
### What problem does this PR solve?
The Go DeepInfra driver returned a stub error for `Rerank()` even though
DeepInfra serves reranker models at `POST /v1/inference/{model}` with
`query`, `documents`, and a `scores[]` response.
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
Co-authored-by: Cursor <[email protected]>
…ow#15201) ### What problem does this PR solve? Creating or updating an agent via `POST /api/v1/agents` and `PUT /api/v1/agents/{agent_id}` did not persist `canvas_type` because the handler `req` dict never assigned the field before `UserCanvasService.save` / `update_by_id`. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): Co-authored-by: Cursor <[email protected]>
Fix: empty file with better message
### What problem does this PR solve? Fix: Fixed metadata issue - The dataset's built-in metadata is now active, but it appears to be disabled in the individual file configuration. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
## Summary Closes infiniflow#15165. Implements the AWS Bedrock model provider for the Go API server, tracked under infiniflow#14736. Adds Converse + Converse-Stream chat and foundation-model listing, with SigV4 signing over a hand-rolled `net/http` path that matches the established pattern in `internal/entity/models/` (no new direct `go.mod` deps). ## Linked tracker Tracked under infiniflow#14736 (Implement model providers of RAGFlow API server in Go). Closes infiniflow#15165.
## Summary - Wire the Go TokenHub provider through the model factory. - Harden TokenHub request handling for chat, streaming, embeddings, and model listing. - Add focused TokenHub unit coverage for factory wiring and provider behavior. ## Notes - Refs infiniflow#14736. - Follows up infiniflow#15159. Co-authored-by: Jin Hai <[email protected]>
### What problem does this PR solve? This PR adds HuaweiCloud provider integration in RAGFlow. Supported capabilities: - [x] Chat / Think Chat / Stream Chat / Stream Think Chat - [x] Embedding - [x] Rerank - [x] Model listing - [x] Provider connection checking Verified examples from the CLI: ``` check instance 'test' from 'HuaweiCloud'; chat with 'deepseek-v4-flash@test@HuaweiCloud' message 'hello'; think chat with 'deepseek-v4-flash@test@HuaweiCloud' message 'hello'; stream chat with 'deepseek-v4-flash@test@HuaweiCloud' message 'hello'; stream think chat with 'deepseek-v4-flash@test@HuaweiCloud' message 'hello'; embed text 'what is rag' 'who are you' with 'bge-m3@test@HuaweiCloud' dimension 1024; rerank query 'what is rag' document 'rag is retrieval augmented generation' 'rag need llm' 'famous rag project includes ragflow' with 'bge-reranker-v2-m3@test@HuaweiCloud' top 3; list supported models from 'HuaweiCloud' 'test'; LIST MODELS FROM 'HuaweiCloud' 'test'; ``` ### Type of change - [x] New Feature - [x] Provider integration
Closes infiniflow#15040. ModelScope was listed unchecked in the Go-rewrite tracker infiniflow#14736 and already had an llm_factories.json entry (tags: LLM) but no Go driver, so the new Go API server could not route ModelScope instances. The Python side has supported it through the OpenAI-compatible base at rag/llm/chat_model.py:618 (ModelScopeChat), which requires a user-supplied base URL and appends /v1. This adds: - internal/entity/models/modelscope.go: self-hosted OpenAI-compatible driver with chat (sync + SSE stream with idle-timeout cancellation), list_models, and check_connection. Auth header is optional, matching the xinference pattern, so deployments without auth and auth-enabled deployments both work. Base URL is normalized so users can configure either the root endpoint or the /v1 endpoint. - internal/entity/models/modelscope_test.go: 12 tests covering name, URL normalization, factory routing, chat happy path / auth header / reasoning_content extraction, stream happy path / stream=false rejection / idle cancellation, list_models + check_connection, missing-base-URL clear error, and the no-such-method sentinels. - conf/models/modelscope.json: shipped config (class: "local", url_suffix v1/chat/completions and v1/models). - internal/entity/models/factory.go: case "modelscope" → ModelScopeModel. - internal/service/llm.go: ModelScope added to the selfDeployed map alongside Ollama, Xinference, LocalAI, LM-Studio, GPUStack — the Python side requires user-supplied URL with no default, so the Go side classifies it the same way. Follow-on issues will add Embed and Rerank, in line with how Novita, NVIDIA, TogetherAI, and other providers landed method-by-method. --------- Co-authored-by: Jin Hai <[email protected]>
### What problem does this PR solve? implement provider `OrcaRouter` **The following functionalities are now supported:** **Cohere:** - [x] Chat / Think Chat / Stream Chat / Stream Think Chat - [x] Model listing - [x] TTS - [ ] Balance ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Jin Hai <[email protected]>
…iflow#15248) ### What problem does this PR solve? - Update version tags in README files (including translations) from v0.25.5 to v0.25.6 - Modify Docker image references and documentation to reflect new version - Update version badges and image descriptions - Maintain consistency across all language variants of README files ### Type of change - [x] Documentation Update
### What problem does this PR solve? Initial draft: v0.25.6 release notes. ### Type of change - [x] Documentation Update
## Summary - add the xAI `models` URL suffix used by the existing Go `ListModels` implementation - return a clear error when the xAI models suffix is missing - add focused xAI model-listing and connection-check regression tests ## What changed - Added `url_suffix.models` to `conf/models/xai.json`. - Normalized the configured models suffix before building the request URL. - Covered config loading, successful model listing, upstream errors, API-key validation, missing suffix handling, and `CheckConnection` delegation. ## Why `XAIModel.ListModels` already builds requests from `URLSuffix.Models`, and `CheckConnection` delegates to that method. The bundled xAI config did not define that suffix, which left the model-listing path unable to call the provider `/models` endpoint from the existing provider config. ## Validation - `go test ./internal/entity/models -run TestXAI -count=1` - `go test ./internal/entity -count=1` - `git diff HEAD~1..HEAD --check` ## Notes - `go test ./internal/entity/models -count=1` currently fails in unchanged Astraflow coverage: `TestAstraflowEmbedReturnsNoSuchMethod` panics before reaching any xAI assertions. --------- Co-authored-by: Jin Hai <[email protected]>
## Summary - Add LongCat model-list support through the documented OpenAI-compatible models endpoint. ## What changed - Add the LongCat `models` URL suffix for `/openai/v1/models`. - Implement `ListModels` for the LongCat Go driver. - Delegate `CheckConnection` to the lightweight model-list request. - Add focused regression coverage for successful, malformed, oversized, and missing-key responses. ## Why LongCat documents a models endpoint under the OpenAI-compatible API surface, but the Go driver still returned `no such method` for model listing and connection checks. ## Validation - `go test ./internal/entity/models -run TestLongCat -count=1` - `go test -race ./internal/entity/models -run TestLongCat -count=1` - `go test ./internal/entity -count=1` - `git diff --check` ## Notes - Related to the broader Go model provider tracking in infiniflow#14736, but this PR only handles LongCat model listing. - `go test ./internal/entity/models -count=1` is currently blocked by an unrelated Astraflow test panic outside this LongCat change. --------- Co-authored-by: Jin Hai <[email protected]>
…w#15233) ## Summary - route hosted MinerU.Net and PaddleOCR.Net provider names to their existing Go drivers - add regression coverage for loading the hosted OCR provider configs through ProviderManager ## What changed - Added canonical provider-name aliases for the hosted OCR provider display names. - Covered both bundled configs with a focused provider-manager test. ## Why The hosted provider configs use display names with `.Net`, while model factory dispatch lowercases the provider name. Without aliases, those configs fall through to `DummyModel` instead of using the existing MinerU and PaddleOCR drivers. --------- Co-authored-by: Jin Hai <[email protected]>
### What problem does this PR solve? v0.25.6 release notes draft updated. ### Type of change - [x] Documentation Update
### What problem does this PR solve? Fix: The Creativity parameter of chat was not saved. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
## Summary - add the VolcEngine `models` URL suffix used by the existing Go `ListModels` implementation - return a clear error when the VolcEngine models suffix is missing - add focused VolcEngine model-listing regression tests ## What changed - Added `url_suffix.models` to `conf/models/volcengine.json`. - Normalized the configured models suffix before building the request URL. - Covered config loading, successful model listing, upstream errors, and missing suffix handling. ## Why `VolcEngine.ListModels` already builds requests from `URLSuffix.Models`, but the bundled VolcEngine config did not define that suffix. That left the model-listing path unable to call the documented `/models` endpoint from the existing provider config. Fixes infiniflow#14701 Co-authored-by: Jin Hai <[email protected]>
### What problem does this PR solve? This PR adds Qiniu provider integration for the Go model driver layer in RAGFlow. Supported capabilities: - [X] Chat - [X] Think Chat - [X] Stream Chat - [X] Stream Think Chat - [X] Model listing - [X] Provider configuration and factory registration Verified examples from the CLI: ``` login user '***' password '***'; ADD PROVIDER 'qiniu'; CREATE PROVIDER 'qiniu' INSTANCE 'test' KEY '***'; chat with 'deepseek/deepseek-v3.1-terminus-thinking@test@qiniu' message 'hello'; think chat with 'deepseek/deepseek-v3.1-terminus-thinking@test@qiniu' message 'hello'; stream chat with 'deepseek/deepseek-v3.1-terminus-thinking@test@qiniu' message 'hello, what are you'; stream think chat with 'deepseek/deepseek-v3.1-terminus-thinking@test@qiniu' message 'hello, what are you'; stream think chat with 'qwen3-max-2026-01-23@test@qiniu' message 'hello, what are you'; LIST MODELS FROM 'qiniu' 'test'; ``` ### Type of change - [X] New Feature - [X] Provider integration
### What problem does this PR solve? Closes infiniflow#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 - [x] 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 ```bash go test -vet=off ./internal/entity/models -run 'TestGiteeAI' -count=1 go test -vet=off ./internal/entity -run 'Test.*Provider|Test.*Model' -count=1 ``` --------- Co-authored-by: Jin Hai <[email protected]>
…nfiniflow#15780) ### What problem does this PR solve? Table parser metadata aggregation previously only ran when `table_column_mode` was set to `manual`. In auto mode (default), all columns default to `"both"` role, meaning they should also be aggregated into document-level metadata for UI/chat filters. Additionally, the task snapshot could be stale — `table_column_names` are written to KB `parser_config` during `chunk()` but the task may have been created before that. Changes: - Renames `aggregate_table_manual_doc_metadata` → `aggregate_table_doc_metadata` - Supports both `"manual"` and `"auto"` `table_column_mode` (defaults to `"auto"`) - Reloads `table_column_names` from KB DB when missing from task snapshot - Removes the manual-only guard in `task_executor` and refactored `post_processor` - Updates all tests with new function name and adds auto mode test cases ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
…15778) ### What problem does this PR solve? fix: Resolve error when checking pipeline parsing result ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
…ow#15773) ### What problem does this PR solve? Fix: Add a waiting status to the messages on the chat page. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
### What problem does this PR solve? Fix LM-Studio provider connection verification so embedding checks await the async wrapper correctly and log the full traceback on failures. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
Fix OpenRouter key JSONDecodeError
…5528) ## Summary - keep Moonshot chat calls in non-streaming mode and streaming calls in SSE mode - make Moonshot model listing and balance checks use bodyless GET requests - add focused Moonshot request/response regression tests
### What problem does this PR solve?
**Verified from CLI**
```
RAGFlow(user)> chat with 'mimo-v2.5@test@xiaomi' message 'who r u'
Answer: Hello! I'm MiMo-v2.5, a large language model developed by Xiaomi's LLM Core Team. You can think of me as a friendly AI assistant ready to help you answer questions, have conversations, or work on creative tasks. My context window can handle up to 1 million tokens, so we can dive into pretty long discussions or documents if you'd like. What can I help you with today?
Time: 3.831830
RAGFlow(user)> stream chat with 'mimo-v2.5@test@xiaomi' message 'who r u'
Answer: there! I'm MiMo-v2.5, an AI assistant created by the Xiaomi LLM Core Team. I'm here to chat, help out, answer questions, or just have a friendly conversation. Think of me as a helpful buddy with a pretty big memory (1 million tokens worth!). What can I do for you today?😊
Time: 2.421630
RAGFlow(user)> think chat with 'mimo-v2.5@test@xiaomi' message 'who r u'
Thinking: The user is asking a simple question about who I am. According to my system prompt, I should:
- Identify myself as **MiMo-v2.5**
- State that I was developed by the **Xiaomi LLM Core Team**
- Answer in first person and be warm and conversational
Answer: Hey there! 👋
I'm **MiMo**, an AI assistant created by the **Xiaomi LLM Core Team**. Think of me as a friendly chat buddy who's here to help you with all sorts of questions and tasks!
I love having conversations, answering questions, brainstorming ideas, and helping people figure things out. Whether you want to chat, need help with something specific, or just want to explore ideas together — I'm here for it! 😊
What can I help you with today?
Time: 6.651589
RAGFlow(user)> tts with 'mimo-v2.5-tts@test@xiaomi' text 'hello? show yourself' play format 'wav' param '{"voice": "Chloe"}'
SUCCESS
RAGFlow(user)> asr with 'mimo-v2.5-asr@test@xiaomi' audio './internal/test.wav' param '{"language": "zh"}'
+------------------------------------------------------------------------------------------------------------------------+
| text |
+------------------------------------------------------------------------------------------------------------------------+
| 1 The examination and testimony of the experts enabled the commission to conclude that five shots may have been fired. |
+------------------------------------------------------------------------------------------------------------------------+
```
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- [x] Refactoring
## Summary Fixes typoed model-provider URL suffix keys and adds strict nested decoding so future URL suffix config mistakes fail during provider loading instead of being silently ignored.
## Summary - keep MiniMax chat calls in non-streaming mode and streaming calls in SSE mode - make MiniMax model listing and connection checks use a bodyless GET /v1/models - add focused MiniMax request/response regression tests
## Summary Normalizes Qwen model-family names before reasoning extraction so provider-prefixed Qwen models use the existing `<think>...</think>` fallback.
Delete not supported model providers list
## What problem does this PR solve? Go test files are never compiled in CI — only production binaries via `go build`. This allowed a missing `"sort"` import in `metadata_filter_test.go` to be merged without detection. ## Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) ## Changes - Add `go test -count=1 ./internal/...` step after Go build in CI workflow - Fix missing `"sort"` import in `metadata_filter_test.go` (pre-existing compile error) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
### What problem does this PR solve? Support model list for VolcEngine. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
…e detection) (infiniflow#15489) ### What problem does this PR solve? `is_english()` in `rag/nlp/__init__.py` compiles a **single-character** regex class and `fullmatch`es it against each item: ```python pattern = re.compile(r"[`a-zA-Z0-9\s.,':;/\"?<>!\(\)\-]") # no quantifier ... eng = sum(1 for t in texts if pattern.fullmatch(t.strip())) ``` For a **string** argument the text is first split into single characters (`texts = list(texts)`), so each `fullmatch` sees one character and works. But for a **list** argument each item is a whole multi-character string, and `fullmatch` of a one-character pattern against a multi-character string always fails — so `is_english()` returns `False` for **any** list, regardless of content. ```python is_english("This is English") # True (ok) is_english(["The quick brown fox jumps.", "Hello world."]) # False (bug — should be True) is_english(["这是中文。"]) # False (right answer, wrong reason) ``` Many call sites pass lists and were therefore silently always-`False`, e.g.: - `rag/llm/chat_model.py:1088`, `rag/llm/cv_model.py:168,1155` — `is_english([ans])` when an answer is truncated at `max_tokens`, so an English reply gets the Chinese "······由于长度的原因,回答被截断了,要继续吗?" continuation suffix instead of the English one. - `rag/app/book.py` — `remove_contents_table(..., eng=is_english([...sections...]))`, so English books have their contents table stripped in Chinese mode. - `common/doc_store/es_conn_base.py:339`, `rag/utils/opensearch_conn.py:733` — `is_english(txt.split())` in highlight handling. - plus `rag/app/qa.py`, `rag/flow/parser/utils.py`, `common/doc_store/infinity_conn_base.py`. ### Fix Add a `+` quantifier so an all-English multi-character item matches: ```python pattern = re.compile(r"[`a-zA-Z0-9\s.,':;/\"?<>!\(\)\-]+") ``` The string path is unchanged (single characters still match) and non-English lists still return `False`. Adds `test/unit_test/rag/test_is_english.py`; the two list cases fail before this change and pass after. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Used the Claude CLI while working on this.
…infiniflow#15787) ## Problem `TestXiaomiNewModelWithCustomDefaultTransport` panics on Go 1.25: ``` panic: interface conversion: http.RoundTripper is models.roundTripperFunc, not *http.Transport ``` In Go 1.25, `http.DefaultTransport` is no longer `*http.Transport`, so the unchecked type assertion in `NewXiaomiModel` panics when the test replaces it with a `roundTripperFunc`. ## Fix Use a safe type assertion with fallback to a new `http.Transport`, matching the pattern already used in `modelscope.go`. ## Verification ```bash go test -run TestXiaomiNewModelWithCustomDefaultTransport ./internal/entity/models/... # PASS ``` Internal contributors only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
### What problem does this PR solve? ``` RAGFlow(user)> list models; +---------------------------+------------+-------------+--------------------+---------------------------------------------+ | alias | max_tokens | model_types | name | thinking | +---------------------------+------------+-------------+--------------------+---------------------------------------------+ | | 1048576 | [chat] | deepseek-v4-flash | map[clear_thinking:true default_value:true] | | | 1048576 | [chat] | deepseek-v4-pro | map[clear_thinking:true default_value:true] | | | 1024000 | [chat] | minimax-m3 | map[clear_thinking:true default_value:true] | | | 64000 | [vision] | glm-4.5v | map[clear_thinking:true default_value:true] | | [baai/bge-m3] | 8192 | [embedding] | bge-m3 | | | [baai/bge-reranker-v2-m3] | 1024 | [rerank] | bge-reranker-v2-m3 | | | | | [tts] | step-audio-tts-3b | | | [qwen/qwen3-asr-1.7b] | | [asr] | qwen3-asr-1.7b | | | [paddleocr-vl-1.5] | | [ocr] | paddleocr-vl-0.9b | | +---------------------------+------------+-------------+--------------------+---------------------------------------------+ RAGFlow(user)> show model 'minimax-m3'; +--------------+---------------------------------------------+ | field | value | +--------------+---------------------------------------------+ | name | minimax-m3 | | max_tokens | 1024000 | | model_types | [chat] | | thinking | map[clear_thinking:true default_value:true] | | class | | | alias | | | ModelTypeMap | | +--------------+---------------------------------------------+ RAGFlow(user)> show model 'baai/bge-m3'; +--------------+---------------+ | field | value | +--------------+---------------+ | model_types | [embedding] | | thinking | | | class | | | alias | [baai/bge-m3] | | ModelTypeMap | | | name | bge-m3 | | max_tokens | 8192 | +--------------+---------------+ ``` --------- Signed-off-by: Jin Hai <[email protected]>
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds segment-timestamped ASR, groups segments into fixed-duration audio windows, propagates start/end timing through search retrieval, and exposes start_time, end_time, and doc_type on chunk API responses. ChangesAudio Timestamp Support
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ 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. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
rag/llm/sequence2txt_model.py (1)
109-151:⚠️ Potential issue | 🟠 MajorImplement DashScope timestamp support for
QWenSeq2txt.transcription_with_timestamps
Base.transcription_with_timestamps()falls back to a single segment withstart=0.0/end=0.0, andrag/app/audio.pytreats that as “no timing” (no windowed chunking).QWenSeq2txtcurrently overrides onlytranscription()and does not implementtranscription_with_timestamps(), so Qwen audio transcription won’t return segments.DashScope Qwen ASR supports timestamp output via
asr_options(e.g.,enable_words) and returns timing fields likebegin_time/end_time. Add atranscription_with_timestamps()override forQWenSeq2txtthat callsMultiModalConversationwith the rightasr_options, parses the timestamped response into[{ "text", "start", "end" }], and returns those segments.🤖 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 `@rag/llm/sequence2txt_model.py` around lines 109 - 151, Add a transcription_with_timestamps override on the QWenSeq2txt class that calls dashscope.MultiModalConversation.call (same as transcription) but enables timestamped output via asr_options (e.g., enable_words=True or the provider's timestamp flag) and parses resp["output"]["choices"][0]["message"].content to extract each word/segment's text plus begin_time/end_time into a list of dicts [{"text": ..., "start": float(begin_time), "end": float(end_time)}]; return that list and the token count (use num_tokens_from_string on the concatenated text). Keep error handling similar to transcription but ensure you return per-segment timestamps rather than the Base fallback single segment.
🧹 Nitpick comments (2)
rag/app/audio.py (1)
112-125: ⚡ Quick winConsider adding logging for the windowed chunking flow.
The new timestamp-aware chunking flow branches based on
has_timing(line 115), but there's no log statement indicating which path was taken. Adding a log statement would help operators understand whether windowed chunking or fallback single-chunk mode was used during ingestion. As per coding guidelines, new flows should include logging.📝 Suggested logging additions
has_timing = any(s.get("end", 0.0) > 0.0 for s in segments) if has_timing: + logging.info("Audio transcription returned timestamps; using windowed chunking (window=%ss)", window_seconds) chunks = _build_windowed_chunks(doc, segments, window_seconds, is_english) else: + logging.info("Audio transcription has no timestamps; falling back to single-chunk concatenation") # Provider returned no timestamps — fall back to single chunk (backward-compat) full_text = " ".join(s.get("text", "") for s in segments).strip()🤖 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 `@rag/app/audio.py` around lines 112 - 125, After computing has_timing from seq2txt_mdl.transcription_with_timestamps and before branching, add a log statement (using the module logger, e.g., logger.info) that records which path was taken: "windowed chunking" when has_timing is true (include len(segments) and window_seconds) and "fallback single-chunk" when false (include len(segments)); place the log just before calling _build_windowed_chunks(doc, segments, window_seconds, is_english) or before the fallback tokenize/doc adjustments so operators can see which branch executed.Source: Coding guidelines
rag/llm/sequence2txt_model.py (1)
45-52: ⚡ Quick winAdd logging for the new transcription flow.
The coding guidelines require logging for new flows in
**/*.pyfiles. Consider adding a debug or info log statement when falling back to the default single-segment behavior, similar to how other methods in this file log provider responses.📝 Suggested logging addition
def transcription_with_timestamps(self, audio_path, **kwargs): """Return a list of {"text": str, "start": float, "end": float} segments. Providers that support verbose_json (Whisper-compatible) override this. The default falls back to a single segment with no timing. """ + logging.debug("transcription_with_timestamps: falling back to single untimed segment for provider %s", self.__class__.__name__) text, _ = self.transcription(audio_path, **kwargs) return [{"text": text, "start": 0.0, "end": 0.0}]As per coding guidelines: "Add logging for new flows" applies to
**/*.py.🤖 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 `@rag/llm/sequence2txt_model.py` around lines 45 - 52, The fallback in transcription_with_timestamps currently returns a single segment without emitting any log; update transcription_with_timestamps to log a debug/info message when it falls back to the default single-segment behavior by calling the module/class logger (same logger used elsewhere in this file) and include context such as the audio_path and that transcription(...) returned only text (reference transcription_with_timestamps and transcription functions), so reviewers can trace when the non-verbose path was used.Source: Coding guidelines
🤖 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 `@api/apps/restful_apis/chunk_api.py`:
- Around line 426-431: The ValidationError happens because final_chunk contains
keys "start_time", "end_time", and "doc_type" but the Pydantic model Chunk
doesn't declare them; update the Chunk model (class Chunk) to declare these
fields (e.g., start_time: Optional[float] = None, end_time: Optional[float] =
None, doc_type: Optional[str] = "" or None) so Chunk(**final_chunk) will
validate, and ensure types/defaults match how final_chunk is constructed (using
start_time_flt/end_time_flt and doc_type_kwd); alternatively, if you prefer not
to change the model, remove those keys before instantiating Chunk or use model
config to allow extra fields consistently.
In `@api/db/services/llm_service.py`:
- Around line 226-230: Wrap the body of LLMBundle.transcription_with_timestamps
to use Langfuse tracing like the other LLM methods: call start_observation(...)
before invoking self.mdl.transcription_with_timestamps(audio), capture the
returned segments, compute used_tokens and call observation.generation.update({
"tokens": used_tokens, "llm_name": self.model_config["llm_name"], ... }) then
call observation.generation.end(); ensure any exceptions end the observation
appropriately and that logging.info still records used_tokens and llm_name; use
the same observation metadata/keys as in transcription/describe/encode to
maintain consistency.
In `@rag/llm/sequence2txt_model.py`:
- Line 260: The list comprehension at the return (processing the segments list)
assumes each segment has "text", "start", and "end" keys and will raise KeyError
on malformed provider data; change it to use defensive dict access like
s.get("text", "") and s.get("start"/"end", 0.0), strip the text safely, and
coerce start/end to floats (e.g., float(s.get("start", 0.0)) with a fallback for
non-numeric values) so the return [{"text": ..., "start": ..., "end": ...} for s
in segments] is robust against missing or bad fields.
- Around line 83-84: The except Exception: pass that swallows provider errors
before falling back to untimed transcription should log the caught exception
first; update the except block in sequence2txt_model.py (the block handling
timestamped transcription failure) to call the module or instance logger (e.g.,
logger.exception(...) or logger.error(..., exc_info=True)) with a clear message
about failing to obtain timestamps, then continue to the existing untimed
transcription fallback. Ensure you reference the same logger used elsewhere in
the module (or create one with logging.getLogger(__name__)) so the error and
stack trace are recorded before proceeding.
- Around line 261-262: The bare "except Exception: pass" in the try/except that
calls the Xinference timestamped transcription must be replaced with a logged
exception before falling back to untimed transcription; locate the try block in
sequence2txt_model.py that invokes the Xinference endpoint (e.g., the
timestamped transcription logic inside the Sequence2TxtModel or
transcribe_with_timestamps function), catch Exception as e and call the module
logger (or processLogger) with logger.exception(...) or logger.error(...,
exc_info=True) including a clear message about Xinference timestamp failure,
then continue to the existing fallback path.
---
Outside diff comments:
In `@rag/llm/sequence2txt_model.py`:
- Around line 109-151: Add a transcription_with_timestamps override on the
QWenSeq2txt class that calls dashscope.MultiModalConversation.call (same as
transcription) but enables timestamped output via asr_options (e.g.,
enable_words=True or the provider's timestamp flag) and parses
resp["output"]["choices"][0]["message"].content to extract each word/segment's
text plus begin_time/end_time into a list of dicts [{"text": ..., "start":
float(begin_time), "end": float(end_time)}]; return that list and the token
count (use num_tokens_from_string on the concatenated text). Keep error handling
similar to transcription but ensure you return per-segment timestamps rather
than the Base fallback single segment.
---
Nitpick comments:
In `@rag/app/audio.py`:
- Around line 112-125: After computing has_timing from
seq2txt_mdl.transcription_with_timestamps and before branching, add a log
statement (using the module logger, e.g., logger.info) that records which path
was taken: "windowed chunking" when has_timing is true (include len(segments)
and window_seconds) and "fallback single-chunk" when false (include
len(segments)); place the log just before calling _build_windowed_chunks(doc,
segments, window_seconds, is_english) or before the fallback tokenize/doc
adjustments so operators can see which branch executed.
In `@rag/llm/sequence2txt_model.py`:
- Around line 45-52: The fallback in transcription_with_timestamps currently
returns a single segment without emitting any log; update
transcription_with_timestamps to log a debug/info message when it falls back to
the default single-segment behavior by calling the module/class logger (same
logger used elsewhere in this file) and include context such as the audio_path
and that transcription(...) returned only text (reference
transcription_with_timestamps and transcription functions), so reviewers can
trace when the non-verbose path was used.
🪄 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: 1d40c17f-5fc0-4fd2-b497-5c76fc219f51
📒 Files selected for processing (5)
api/apps/restful_apis/chunk_api.pyapi/db/services/llm_service.pyrag/app/audio.pyrag/llm/sequence2txt_model.pyrag/nlp/search.py
|
@dale053 would you please fix the conflicts? |
Closes #15867
What problem does this PR solve?
Audio and video ingestion (
rag/app/audio.py,rag/app/picture.py) produced a single flat chunk containing the full transcript with no timing metadata. Whisper-compatible ASR APIs return per-segmentstart/endtimestamps, butsequence2txt_model.pyusedresponse_format="json"and discarded that structure, whileaudio.pycalledtokenize()on the raw string with no positional data attached to the resulting chunk.This meant retrieval against long recordings (calls, lectures, meetings) returned the entire transcript with no way to locate or play back the relevant moment.
Type of change
Changes
rag/llm/sequence2txt_model.pytranscription_with_timestamps()toBase(fallback returns a single untimed segment).GPTSeq2txtoverrides it usingresponse_format="verbose_json"+timestamp_granularities=["segment"]to extract realstart/endper segment.XinferenceSeq2txtoverrides it via its raw HTTP path. All other providers inherit the safe fallback.api/db/services/llm_service.pyLLMBundle.transcription_with_timestamps()wrapper, matching the pattern of the existingtranscription()method.rag/app/audio.pychunk()now callstranscription_with_timestamps(). When timing is present,_build_windowed_chunks()groups segments into configurable fixed-duration windows (default 60 s, overridable viaparser_config["chunk_duration_seconds"]). Each chunk carriesstart_time_flt,end_time_flt,chunk_order_int, anddoc_type_kwd="audio". Falls back to the original single-chunk path when the provider returns no timestamps — fully backward-compatible.rag/nlp/search.pystart_time_fltandend_time_fltto the default_sourceprojection so they are fetched on every retrieval call. Added the fields to all three chunk-dict assembly sites.api/apps/restful_apis/chunk_api.pystart_time,end_time, anddoc_typein the API response. No index migration needed — ES/Infinity auto-type_flt-suffixed fields as float.Backward compatibility
start_time_flt/end_time_flt; both fields are optional (None) in the response.Base.transcription_with_timestamps()which delegates to the existingtranscription()and returns a single untimed segment — the chunking path is identical to before.