chore/ 删除无用文件
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
ExtractionAgent:从用户消息中提取 5-stage 状态与 slots。
|
||||
对应现有逻辑:get_state_extraction_prompt + JSON 解析
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
@@ -19,6 +20,7 @@ logger = get_logger(__name__)
|
||||
@dataclass
|
||||
class ExtractionResult:
|
||||
"""状态提取结果"""
|
||||
|
||||
detected_stage: str
|
||||
slots: Dict[str, str]
|
||||
|
||||
@@ -41,7 +43,9 @@ class ExtractionAgent:
|
||||
extracted_slots: Dict[str, str] = {}
|
||||
|
||||
if not llm:
|
||||
return ExtractionResult(detected_stage=detected_stage, slots=extracted_slots)
|
||||
return ExtractionResult(
|
||||
detected_stage=detected_stage, slots=extracted_slots
|
||||
)
|
||||
|
||||
try:
|
||||
prompt = get_state_extraction_prompt(
|
||||
@@ -61,8 +65,7 @@ class ExtractionAgent:
|
||||
detected_stage = parsed.get("detected_stage", detected_stage)
|
||||
raw_slots = parsed.get("slots", {}) or {}
|
||||
extracted_slots = {
|
||||
k: v if isinstance(v, str) else str(v)
|
||||
for k, v in raw_slots.items()
|
||||
k: v if isinstance(v, str) else str(v) for k, v in raw_slots.items()
|
||||
}
|
||||
except (json.JSONDecodeError, Exception) as e:
|
||||
logger.warning("ExtractionAgent LLM 解析失败: %s", e)
|
||||
|
||||
Reference in New Issue
Block a user