Implementation:Infiniflow Ragflow DialogService Update KB Selection
Appearance
| Knowledge Sources | |
|---|---|
| Domains | RAG, Knowledge_Management |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Concrete tool for updating the knowledge base selection on a chat application provided by RAGFlow DialogService.
Description
Uses DialogService.update_by_id (inherited from CommonService) to update the kb_ids field on a Dialog record. The REST endpoint validates that all referenced KB IDs exist before persisting.
Usage
Called via the same POST /v1/dialog/set endpoint with a dialog_id parameter to update an existing dialog.
Code Reference
Source Location
- Repository: ragflow
- File: api/db/services/common_service.py (update_by_id: L229-240), api/apps/dialog_app.py (L130-142)
Signature
# Uses CommonService.update_by_id
DialogService.update_by_id(pid: str, data: dict) -> int
# data = {"kb_ids": ["kb-uuid-1", "kb-uuid-2"]}
Import
from api.db.services.dialog_service import DialogService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| pid | str | Yes | Dialog ID |
| data | dict | Yes | Update with kb_ids list |
Outputs
| Name | Type | Description |
|---|---|---|
| num | int | Rows updated (1 on success) |
Usage Examples
from api.db.services.dialog_service import DialogService
DialogService.update_by_id("dialog-uuid-123", {
"kb_ids": ["kb-uuid-1", "kb-uuid-2", "kb-uuid-3"]
})
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment