Files
2026-06-11 16:28:00 +08:00

47 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from __future__ import annotations
from typing import Any, Literal
from pydantic import BaseModel, Field
from app.schemas.debug import RoutingDebug
from app.schemas.workflow import Workflow
class ChatRequest(BaseModel):
session_id: str
user_id: str
channel: str = "app"
input_text: str
input_type: Literal["text", "voice"] = "text"
metadata: dict[str, Any] = Field(default_factory=dict)
class FillSlotsRequest(BaseModel):
session_id: str
user_id: str
input_text: str
class ChatResponse(BaseModel):
session_id: str
reply_type: Literal["text", "ask_slot", "ask_confirmation", "workflow_result", "fallback", "clarify", "reject"] = "text"
reply_text: str
intent: str | None = None
domain: str | None = None
decision: str | None = None
decision_reason: str | None = None
status: str
pending_slots: list[str] = Field(default_factory=list)
filled_slots: dict[str, Any] = Field(default_factory=dict)
workflow: Workflow | None = None
routing_debug: RoutingDebug | None = None
first_response_latency_ms: float | None = None
total_latency_ms: float | None = None
processing_breakdown: dict[str, float] = Field(default_factory=dict)
trace_id: str
# ── 知识库查询结果LLM function call 命中时填充)──────────────────────────
knowledge_doc_id: str | None = None # 知识文档 IDMD 文件名)
knowledge_doc_title: str | None = None # 知识文档标题
knowledge_content: str | None = None # 完整 MD 正文,供前端渲染知识卡片