MCPcopy Create free account
hub / github.com/answerlink/IntelliQ / process

Method process

scene_processor/impl/weather_processor.py:15–32  ·  view source on GitHub ↗
(self, user_input, context)

Source from the content-addressed store, hash-verified

13 self.scene_prompts = load_file_to_obj('scene_config/scene_prompts.json')
14
15 def process(self, user_input, context):
16 # 处理用户输入,更新槽位,检查完整性,以及与用户交互
17 # 先检查本次用户输入是否有信息补充,保存补充后的结果 编写程序进行字符串value值diff对比,判断是否有更新
18 current_date, future_date = get_current_and_future_dates(days=7)
19 new_info_json_raw = send_message(
20 self.scene_prompts['weather_info_update'].format(current_date, current_date, future_date,
21 json.dumps(self.slot_template, ensure_ascii=False), user_input),
22 user_input)
23 current_values = extract_json_from_string(new_info_json_raw)
24 print('current_values', current_values)
25 print('slot update before', self.slot)
26 update_slot(current_values, self.slot)
27 print('slot update after', self.slot)
28 # 判断参数是否已经全部补全
29 if is_slot_fully_filled(self.slot):
30 return self.respond_with_complete_data()
31 else:
32 return self.ask_user_for_missing_data(user_input)
33
34 def respond_with_complete_data(self):
35 # 当所有数据都准备好后的响应

Callers

nothing calls this directly

Calls 7

send_messageFunction · 0.90
extract_json_from_stringFunction · 0.90
update_slotFunction · 0.90
is_slot_fully_filledFunction · 0.90

Tested by

no test coverage detected