Repository navigation
feat(chat): add Querit web search provider - #17813
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds Querit as a web-search provider alongside Tavily. Backend services, RAG flows, API metadata, and frontend settings now use provider-neutral configuration. Querit responses are validated and converted into RAG chunks and document aggregates. ChangesWeb search provider integration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ChatSettings
participant ChatPipelineService
participant WebSearchProvider
participant Querit
participant RAGResults
ChatSettings->>ChatPipelineService: send provider configuration
ChatPipelineService->>WebSearchProvider: resolve provider and API key
WebSearchProvider->>Querit: create client or dispatch request
Querit->>RAGResults: return normalized chunks and document aggregates
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
api/apps/restful_apis/bot_api.py (1)
145-152: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLog the new availability resolution.
Add a debug log after resolving
has_web_search. Record only the dialog ID and availability value. Do not log prompt configuration or API keys. As per coding guidelines, “Add logging for new flows.”🤖 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 `@api/apps/restful_apis/bot_api.py` around lines 145 - 152, After resolving has_web_search in the dialog response flow, add a debug log that records only the dialog ID and the resolved availability value. Keep prompt configuration and API keys out of the log, and leave the existing get_result response unchanged.Source: Coding guidelines
test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py (1)
1654-1671: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest the Querit response path.
This fixture only uses
tavily_api_key. It cannot detect a regression wherehas_web_search_providerfails for an explicitly selected Querit provider. Add an owned-dialog fixture with Querit selected and a Querit key, then assert thathas_web_search_provideris true. As per coding guidelines, “Preserve still-valid behavior with focused tests.”🤖 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 `@test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py` around lines 1654 - 1671, The happy-path test around chatbots_inputs currently covers only Tavily; add a focused owned-dialog fixture or case with Querit explicitly selected and its key configured in prompt_config, then invoke chatbots_inputs through the existing _run setup and assert the returned data["has_web_search_provider"] is true. Preserve the existing Tavily assertions and test structure.Source: Coding guidelines
web/src/components/web-search-form-field.tsx (2)
22-65: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename the top-level constants to PascalCase.
Rename
providerOptionsandproviderKeyConfigto PascalCase names. This keeps module constants consistent with the frontend naming rule.As per coding guidelines, “Use PascalCase for React component names and top-level constants.”
🤖 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 `@web/src/components/web-search-form-field.tsx` around lines 22 - 65, Rename the top-level constants providerOptions and providerKeyConfig to PascalCase names, such as ProviderOptions and ProviderKeyConfig, and update every reference to them in the component without changing their values or behavior.Source: Coding guidelines
5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
useTranslationin this component.Replace
useTranslate('chat')withuseTranslation. Update the translation keys to use the same namespace convention as the adjacent chat settings components.As per coding guidelines, “Prefer useTranslation from react-i18next over project-wrapped utilities such as useTranslate.”
Also applies to: 69-69
🤖 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 `@web/src/components/web-search-form-field.tsx` at line 5, Update the web-search form component to use react-i18next’s useTranslation instead of the project-wrapped useTranslate, and adjust its translation key references to match the namespace convention used by adjacent chat settings components.Source: Coding guidelines
internal/service/chat_pipeline.go (1)
775-778: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUpdate the Phase 9 comment to describe provider-neutral search.
Line 615 still says “Tavily web search,” but these lines resolve and dispatch the configured provider. Replace that reference with “web search provider.”
As per coding guidelines, Go comments must align with the current runtime path rather than migration history.
🤖 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/service/chat_pipeline.go` around lines 775 - 778, Update the Phase 9 comment near the web-search flow to replace the provider-specific “Tavily web search” wording with “web search provider,” matching the provider resolution performed by resolveWebSearchProvider and retrieveWebSearch.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 `@docs/references/http_api_reference.md`:
- Around line 3035-3037: Update the web_search_provider and querit_api_key
documentation to explicitly state that clients using querit_api_key must set
web_search_provider to "querit", while preserving the existing default of
"tavily" when the provider is omitted.
In `@internal/service/web_search_provider_test.go`:
- Around line 142-144: In the request handler’s JSON decode error path, replace
t.Fatalf with t.Errorf and return immediately so the handler goroutine exits
safely. Update the main test flow to detect an unrecoverable decode failure and
fail the test goroutine separately, preserving the existing request validation
behavior.
In `@rag/utils/web_search_conn.py`:
- Around line 47-52: Update create_web_search_provider to add debug-level
logging for each provider-resolution outcome: disabled or invalid configuration,
Querit selection, and Tavily selection. Log only the provider and resolution
status; do not include API keys or prompt content.
---
Nitpick comments:
In `@api/apps/restful_apis/bot_api.py`:
- Around line 145-152: After resolving has_web_search in the dialog response
flow, add a debug log that records only the dialog ID and the resolved
availability value. Keep prompt configuration and API keys out of the log, and
leave the existing get_result response unchanged.
In `@internal/service/chat_pipeline.go`:
- Around line 775-778: Update the Phase 9 comment near the web-search flow to
replace the provider-specific “Tavily web search” wording with “web search
provider,” matching the provider resolution performed by
resolveWebSearchProvider and retrieveWebSearch.
In
`@test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py`:
- Around line 1654-1671: The happy-path test around chatbots_inputs currently
covers only Tavily; add a focused owned-dialog fixture or case with Querit
explicitly selected and its key configured in prompt_config, then invoke
chatbots_inputs through the existing _run setup and assert the returned
data["has_web_search_provider"] is true. Preserve the existing Tavily assertions
and test structure.
In `@web/src/components/web-search-form-field.tsx`:
- Around line 22-65: Rename the top-level constants providerOptions and
providerKeyConfig to PascalCase names, such as ProviderOptions and
ProviderKeyConfig, and update every reference to them in the component without
changing their values or behavior.
- Line 5: Update the web-search form component to use react-i18next’s
useTranslation instead of the project-wrapped useTranslate, and adjust its
translation key references to match the namespace convention used by adjacent
chat settings components.
🪄 Autofix
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 Plus
Run ID: 6bd40b4e-95f2-4e23-b62d-7ecf5b7245cc
⛔ Files ignored due to path filters (1)
web/src/assets/querit.pngis excluded by!**/*.png
📒 Files selected for processing (31)
api/apps/restful_apis/bot_api.pyapi/db/services/dialog_service.pydocs/references/http_api_reference.mdinternal/handler/bot.gointernal/handler/bot_test.gointernal/service/bot.gointernal/service/chat_pipeline.gointernal/service/deep_researcher.gointernal/service/web_search_provider.gointernal/service/web_search_provider_test.gorag/advanced_rag/agentic_rag.pyrag/advanced_rag/harness/tools/search.pyrag/advanced_rag/tree_structured_query_decomposition_retrieval.pyrag/utils/querit_conn.pyrag/utils/web_search_conn.pytest/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.pytest/unit_test/rag/utils/test_querit_conn.pytest/unit_test/rag/utils/test_web_search_conn.pyweb/src/components/tavily-form-field.tsxweb/src/components/web-search-form-field.tsxweb/src/constants/chat.tsweb/src/interfaces/database/chat.tsweb/src/locales/en.tsweb/src/locales/zh.tsweb/src/pages/next-chats/chat/app-settings/chat-prompt-engine.tsxweb/src/pages/next-chats/chat/app-settings/chat-settings.tsxweb/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsxweb/src/pages/next-chats/chat/use-show-internet.test.tsweb/src/pages/next-chats/chat/use-show-internet.tsweb/src/pages/next-chats/chat/web-search-api-key.tsweb/src/pages/next-chats/share/index.tsx
💤 Files with no reviewable changes (1)
- web/src/components/tavily-form-field.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17813 +/- ##
=======================================
Coverage 90.65% 90.65%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 650 650
Misses 39 39
Partials 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py (2)
1685-1688: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAssert the retained legacy availability field.
The endpoint returns both
has_tavily_keyandhas_web_search_providerfrom the same availability value (api/apps/restful_apis/bot_api.py, Lines 130-155). This Querit case checks only the provider-neutral field. Add an assertion forres["data"]["has_tavily_key"] is Trueto protect the backward-compatible API contract.Proposed assertion
assert res["code"] == 0 + assert res["data"]["has_tavily_key"] is True assert res["data"]["has_web_search_provider"] is True🤖 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 `@test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py` around lines 1685 - 1688, Add an assertion in the Querit case around chatbots_inputs to verify res["data"]["has_tavily_key"] is True, while preserving the existing has_web_search_provider assertion and response-code check.
1673-1688: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd logging for the new Querit flow.
Add a concise info-level log that identifies the Querit provider and dialog ID. This will make failures in the new test flow easier to diagnose.
As per coding guidelines,
**/*.py: Add logging for new flows.🤖 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 `@test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py` around lines 1673 - 1688, Add a concise info-level log in the Querit flow exercised by chatbots_inputs, including the Querit provider and dialog ID (such as “dialog-querit”). Keep the existing response assertions and provider-neutral flag behavior unchanged.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
`@test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py`:
- Around line 1674-1684: Add an llm_id attribute to the querit_dialog
SimpleNamespace fixture, using an appropriate test value or empty string, so
chatbots_inputs can access dialog.llm_id without raising AttributeError.
---
Nitpick comments:
In
`@test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py`:
- Around line 1685-1688: Add an assertion in the Querit case around
chatbots_inputs to verify res["data"]["has_tavily_key"] is True, while
preserving the existing has_web_search_provider assertion and response-code
check.
- Around line 1673-1688: Add a concise info-level log in the Querit flow
exercised by chatbots_inputs, including the Querit provider and dialog ID (such
as “dialog-querit”). Keep the existing response assertions and provider-neutral
flag behavior unchanged.
🪄 Autofix
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 Plus
Run ID: 410af6d9-b651-4cc7-b346-34e22c0304f7
📒 Files selected for processing (5)
docs/references/http_api_reference.mdinternal/service/chat_pipeline.gointernal/service/web_search_provider_test.gorag/utils/web_search_conn.pytest/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py
🚧 Files skipped from review as they are similar to previous changes (4)
- docs/references/http_api_reference.md
- internal/service/chat_pipeline.go
- rag/utils/web_search_conn.py
- internal/service/web_search_provider_test.go
### Summary Adds You.com as a built-in Web Search provider for RAGFlow Chat, alongside Tavily and Querit, using the provider-neutral dispatch #17813 put in place. No changes to existing Tavily or Querit behaviour. You.com runs its own web index and returns several extracted passages per result rather than a single meta description, so retrieved chunks arrive with usable context. --------- Co-authored-by: Brian Sparker <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Adds You.com as a built-in Web Search provider for RAGFlow Chat, alongside Tavily and Querit, using the provider-neutral dispatch infiniflow#17813 put in place. No changes to existing Tavily or Querit behaviour. You.com runs its own web index and returns several extracted passages per result rather than a single meta description, so retrieved chunks arrive with usable context. --------- Co-authored-by: Brian Sparker <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Summary
Add Querit as a built-in Web Search provider for RAGFlow Chat.
This change also refactors the existing Tavily-only Chat search path behind provider-neutral dispatch in the Python and Go runtimes, so Chat settings and runtime call sites can select the configured provider without changing existing Tavily behavior.
What changed
POST https://api.querit.ai/v1/searchwith Bearer authentication.title,url, andsnippetvalues into the reference format already consumed by RAGFlow Chat.web_search_providerandquerit_api_keyin the HTTP API reference.Configuration and compatibility
tavily_api_keyand no provider field continue to use Tavily.web_search_provideris set toquerit.Querit request behavior
query.6results withchunksPerDoc=1.querit_api_keyas a Bearer token.Querit API keys can be created at https://www.querit.ai/en/dashboard/api-keys.
Scope
This PR provides the unified Web Search provider interface, Querit connector, Chat configuration, and compatibility behavior.
It does not change reasoning-mode scheduling or gating, Agent Canvas tools, MCP configuration, managed credentials, custom provider endpoints, or credential hosting.
Testing
8 passed.14,288 modules transformed.5 structured results.6 normalized results.Naive + Internet enabledChat request: HTTP200, matching[Querit]Q/[Querit]Rruntime entries, inline citations, and source cards.git diff --checkpassed.Screenshots
Web Search provider selector
Querit configuration
Chat request with Internet enabled
Chat response
Citations and source cards