feat(agent): 增强 Agent 配置,新增结构化字段与聊天功能支持
This commit is contained in:
1 parent
ac4262cd75
commit
c8ce77199e
183 files changed
+11690
-2300
No files matched your search
@@ -21,20 +21,6 @@ from app.models import ChatLog, MaintenanceDevice, MaintenanceRecord
|
||||
from app.services.maintenance_ledger_service import serialize_device
|
||||
from app.services.maintenance_record_service import REPAIR_STATUS_LABELS, serialize_record
|
||||
|
||||
MAINTENANCE_AGENT_NAME = '设备维保助手'
|
||||
|
||||
|
||||
def is_maintenance_chat_agent(agent: Any) -> bool:
|
||||
"""
|
||||
判断当前 Agent 是否为设备维保助手。
|
||||
Args:
|
||||
agent: Agent ORM 或代理对象。
|
||||
Returns:
|
||||
命中设备维保助手时返回 True。
|
||||
"""
|
||||
name = str(getattr(agent, 'name', '') or '').strip()
|
||||
return name == MAINTENANCE_AGENT_NAME or ('设备维保' in name and '助手' in name)
|
||||
|
||||
|
||||
def _clean_text(value: Any) -> str:
|
||||
return str(value or '').strip()
|
||||
@@ -144,14 +130,16 @@ def build_device_query_result(keyword: str, *, include_records: bool = True, rec
|
||||
|
||||
def supports(query: str, agent: Any) -> bool:
|
||||
"""
|
||||
判断是否应由设备维保本地查询服务接管。
|
||||
判断是否应由设备维保本地查询服务接管(仅看问句意图;Agent 门控由 router intent_routes 负责)。
|
||||
|
||||
Args:
|
||||
query: 用户原始问题。
|
||||
agent: 当前 Agent。
|
||||
agent: 当前 Agent(保留参数以兼容调用签名)。
|
||||
Returns:
|
||||
True 表示命中设备查询意图。
|
||||
"""
|
||||
return is_maintenance_chat_agent(agent) and bool(extract_device_query_keyword(query))
|
||||
_ = agent
|
||||
return bool(extract_device_query_keyword(query))
|
||||
|
||||
|
||||
def stream_chat(
|
||||
|
||||
Reference in new issue
Block a user