修复:图片分析prompt增加离岗识别 + 创建工单支持直接带位置
1. IMAGE_ANALYZE_PROMPT 增加"岗位无人值守"等异常类型 2. create_work_order 意图支持直接提取 location,有位置则跳过追问 3. 减少图片+文字同时发送时的消息顺序混乱
This commit is contained in:
@@ -40,6 +40,7 @@ SYSTEM_PROMPT = """你是物业安防AI助手。你可以:
|
|||||||
|
|
||||||
可选意图(仅在用户明确请求时使用):
|
可选意图(仅在用户明确请求时使用):
|
||||||
- create_work_order: 用户明确要创建工单或上报问题
|
- create_work_order: 用户明确要创建工单或上报问题
|
||||||
|
params: {title: 工单标题, description: 问题描述, location: 位置(如果用户提到了)}
|
||||||
- query_alarm: 用户要查询告警统计/概况(如"今天有多少告警""告警统计")
|
- query_alarm: 用户要查询告警统计/概况(如"今天有多少告警""告警统计")
|
||||||
params: {time_range: today/week/month, alarm_type: leave_post/intrusion/all}
|
params: {time_range: today/week/month, alarm_type: leave_post/intrusion/all}
|
||||||
- list_alarm: 用户要查看具体告警列表/详情(如"展示今天所有告警""未处理的告警有哪些""今天的离岗告警")
|
- list_alarm: 用户要查看具体告警列表/详情(如"展示今天所有告警""未处理的告警有哪些""今天的离岗告警")
|
||||||
@@ -47,9 +48,18 @@ SYSTEM_PROMPT = """你是物业安防AI助手。你可以:
|
|||||||
- export_report: 用户要导出报表(params: time_range=today/week/month)
|
- export_report: 用户要导出报表(params: time_range=today/week/month)
|
||||||
- 普通对话不要附加任何标记"""
|
- 普通对话不要附加任何标记"""
|
||||||
|
|
||||||
IMAGE_ANALYZE_PROMPT = """分析这张图片,判断是否存在安全隐患或异常情况。
|
IMAGE_ANALYZE_PROMPT = """你是物业安防图片分析员。分析这张图片,判断是否存在安全隐患或需要上报的情况。
|
||||||
|
|
||||||
|
需要关注的异常包括:
|
||||||
|
- 岗位无人值守(前台、监控室、门岗等应有人但没人)
|
||||||
|
- 人员入侵(非授权区域出现人员)
|
||||||
|
- 车辆违停(禁停区域有车辆)
|
||||||
|
- 消防隐患(灭火器缺失、通道堵塞、线路杂乱)
|
||||||
|
- 设施损坏(门窗破损、设备故障)
|
||||||
|
- 物品遗留(可疑包裹、危险物品)
|
||||||
|
|
||||||
请用JSON格式回复:
|
请用JSON格式回复:
|
||||||
{"has_anomaly": true/false, "description": "异常描述", "alarm_type": "告警类型(fire/intrusion/damage/leak/other/none)"}
|
{"has_anomaly": true/false, "description": "异常描述", "alarm_type": "告警类型(leave_post/intrusion/illegal_parking/fire/damage/other/none)"}
|
||||||
只输出JSON,不要其他内容。"""
|
只输出JSON,不要其他内容。"""
|
||||||
|
|
||||||
CLOSE_ANALYZE_PROMPT = """这是一张处理后的现场照片。请判断之前的异常是否已经消除。
|
CLOSE_ANALYZE_PROMPT = """这是一张处理后的现场照片。请判断之前的异常是否已经消除。
|
||||||
@@ -383,10 +393,19 @@ class AgentDispatcher:
|
|||||||
elif intent == "export_report":
|
elif intent == "export_report":
|
||||||
return await self._handle_export_report(user_id, params)
|
return await self._handle_export_report(user_id, params)
|
||||||
elif intent == "create_work_order":
|
elif intent == "create_work_order":
|
||||||
# 文字创建工单 → 进入等待位置状态
|
|
||||||
session = get_session_manager().get(user_id)
|
session = get_session_manager().get(user_id)
|
||||||
session.pending_analysis = params.get("description", "")
|
description = params.get("description", "")
|
||||||
session.pending_alarm_type = params.get("title", "人工上报")
|
title = params.get("title", "人工上报")
|
||||||
|
location = params.get("location", "")
|
||||||
|
|
||||||
|
session.pending_analysis = description
|
||||||
|
session.pending_alarm_type = title
|
||||||
|
|
||||||
|
# 如果参数中已有位置,直接创建工单
|
||||||
|
if location and self._looks_like_location(location):
|
||||||
|
return await self._handle_location_reply(user_id, session, location)
|
||||||
|
|
||||||
|
# 否则追问位置
|
||||||
session.state = "waiting_location"
|
session.state = "waiting_location"
|
||||||
return "请提供具体位置(如:A栋3层东侧走廊)"
|
return "请提供具体位置(如:A栋3层东侧走廊)"
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user