fix(prompts): accept conversational time confirmations and improve clarification

This commit is contained in:
Eric Wang
2026-10-28 17:46:22 +08:00
parent ddcfe5bd05
commit 89acf4f617
10 changed files with 216 additions and 53 deletions
+44 -2
View File
@@ -26,7 +26,49 @@ def probes():
confirmed = [{'role': 'assistant', 'content': CONFIRM}, {'role': 'user', 'content': '可以。'}]
known_form = dict(accident_cause='其他:车辆碰撞', has_injury=False,
has_non_motor_vehicle_hit=False, accident_time=TIME, is_on_scene=True)
time_ack_history = [
{'role': 'user', 'content': '我的小轿车撞到了围栏,无人受伤,也没有非机动车或行人。'},
{'role': 'assistant', 'content': CONFIRM},
]
return [
*[dict(name='time_ack_' + name, user=answer, history=time_ack_history,
code='1002', matches='(在.*现场|现场.*吗)',
not_matches='(这个时间对吗|请.*确认.*时间|几点|什么时候|拍照)')
for name, answer in [('keyi', '可以。'), ('xing', '行。'), ('haode', '好的。'),
('meiwenti', '没问题。'), ('en_dui', '嗯,对。')]],
dict(name='time_ack_ready_to_photo', user='可以。', history=[
{'role': 'user', 'content': '我的小轿车撞到了围栏,无人受伤,也没有非机动车或行人,我在现场。'},
{'role': 'assistant', 'content': CONFIRM}], code='2000', count=1,
not_matches='(这个时间对吗|请.*确认.*时间|几点|什么时候)'),
dict(name='time_ack_recover_duplicate', user='可以。', history=[
*time_ack_history, {'role': 'user', 'content': '可以。'},
{'role': 'assistant', 'content': CONFIRM}], code='1002',
matches='(在.*现场|现场.*吗)', not_matches='(这个时间对吗|几点|什么时候|拍照)'),
dict(name='time_ack_uncertain', user='可以吧,但时间我还不能确定。', history=time_ack_history,
code='1002', matches='(时间|几点|什么时候)', not_matches='(现场|拍照)'),
dict(name='time_ack_correction', user='可以,不过时间不是这个,是2026年10月22日11点40分。',
history=time_ack_history, code='1002',
matches='我记录的时间是2026年10月22日11点40分.*这个时间对吗', not_matches='(现场|拍照)'),
dict(name='time_ack_other_subject', user='可以拍照,我在现场。', history=time_ack_history,
code='1002', matches='我记录的时间是.*这个时间对吗', not_matches='接下来.*拍照'),
dict(name='clarify_non_motor_changes_question', user='没看清,我还是不知道有没有碰到。', history=[
{'role': 'user', 'content': '两辆汽车追尾,大家都没受伤。'},
{'role': 'assistant', 'content': '<state>1002</state>请问事故中是否涉及非机动车或行人呢?'},
{'role': 'user', 'content': '好像有,我没看清。'},
{'role': 'assistant', 'content': '<state>1002</state>请问事故中是否涉及非机动车或行人呢?'}],
code='1002', non_motor=None, matches='(自行车|电动|行人|确定|回忆|人工|看清)',
not_matches='请问事故中是否涉及非机动车或行人呢'),
dict(name='clarify_time_changes_question', user='我还是想不起来。', history=[
*time_ack_history, {'role': 'user', 'content': '这个时间我记不清了。'},
{'role': 'assistant', 'content': CONFIRM}], code='1002',
matches='(时间|几点|回忆|确定|人工|大概)', not_matches='我记录的时间是.*这个时间对吗'),
dict(name='clarify_injury_preserves_fields', user='我看不清,还是不能确定。', history=[
{'role': 'assistant', 'content': '<state>1002</state>请问这次事故中,有没有人员受伤呢?'},
{'role': 'user', 'content': '不知道。'},
{'role': 'assistant', 'content': '<state>1002</state>请问这次事故中,有没有人员受伤呢?'}],
form={'vehicle_count': 1, 'accident_cause': '倒车'}, code='1002', count=1, injury=None,
matches='(受伤|不舒服|身体|伤情|人工|安全|救护车|送医)',
not_matches='(请问这次事故中,有没有人员受伤呢|几辆|多少辆)'),
dict(name='complex_three_original', user='在高速上,三辆车子追尾了。', history=[],
code='0003', count=3, not_matches='(请问|是否.*[??]|拍照|这个时间对吗)',
matches='三辆机动车追尾.*复杂事故.*立即.*转接人工警员'),
@@ -65,7 +107,7 @@ def probes():
dict(name='feedback_unknown_count_acknowledge_history', user=complaint,
history=[{'role': 'user', 'content': fixed_object}, *confirmed, count_question],
code='1002', count_absent=True,
matches='(其他|还有|几辆|多少辆)',
matches='(其他|还有|几辆|多少辆|旁边|那辆|除了)',
not_matches='(没.*(看到|收到)|未.*(提供|回答)|具体的数字)'),
dict(name='feedback_known_count_in_history', user=complaint,
history=[{'role': 'user', 'content': '只有我这一辆小轿车撞到围栏。没有人受伤,没有非机动车或行人,我还在现场。'}, *confirmed, count_question],
@@ -119,7 +161,7 @@ def probes():
dict(name='uncertain_non_motor', user='好像有电瓶车,我没看清。', history=[
{'role':'user','content':'两辆汽车追尾,人员都没事。'},
{'role':'assistant','content':'<state>1002</state>请问事故中是否涉及非机动车或行人呢?'}],
code='1002', non_motor=None, contains='非机动车'),
code='1002', non_motor=None, matches='(非机动车|电瓶车|电动自行车|自行车|行人)'),
dict(name='single_reverse_count_after_time', user='对', history=[
{'role':'user','content':'十分钟前我倒车撞到护栏,没有人受伤,没有非机动车或行人,我还在现场。'},
{'role':'assistant','content':CONFIRM}], code='2000', count=1,