Add knowledge retrieval configuration to Assistant model and related components
- Introduce new fields for knowledge retrieval configuration in AssistantConfig and Assistant models, including mode, top_n, and score_threshold. - Implement KnowledgeRetrievalConfig schema with validation for top_n. - Update backend services and routes to handle knowledge retrieval settings. - Enhance frontend components to support knowledge retrieval configuration, including a new dialog for advanced settings. - Add tests for knowledge retrieval configuration validation and description generation.
This commit is contained in:
@@ -164,6 +164,10 @@ class Assistant(Base):
|
||||
knowledge_base_id: Mapped[str | None] = mapped_column(
|
||||
String(40), ForeignKey("knowledge_bases.id", ondelete="RESTRICT"), nullable=True
|
||||
)
|
||||
knowledge_retrieval_config: Mapped[dict] = mapped_column(
|
||||
JSON,
|
||||
default=lambda: {"mode": "automatic", "top_n": 5, "score_threshold": 0.0},
|
||||
)
|
||||
|
||||
# ---- 瘦类型专属字段(真列,稀疏:按 type 用其中几列) ----
|
||||
prompt: Mapped[str] = mapped_column(String(8192), default="") # prompt / opencode
|
||||
|
||||
Reference in New Issue
Block a user