|
@@ -453,12 +453,15 @@ class DialogueManager:
|
|
|
# 刷新员工画像(不一定需要)
|
|
|
self.staff_profile = self.user_manager.get_staff_profile(self.staff_id)
|
|
|
|
|
|
+ current_datetime = datetime.now()
|
|
|
context = {
|
|
|
"user_profile": self.user_profile,
|
|
|
"current_state": self.current_state.name,
|
|
|
"previous_state": self.previous_state.name,
|
|
|
"current_time_period": time_context.description,
|
|
|
- "current_hour": datetime.now().hour,
|
|
|
+ "current_hour": current_datetime.hour,
|
|
|
+ "current_time": current_datetime.strftime("%H:%M:%S"),
|
|
|
+ "current_date": current_datetime.strftime("%Y-%m-%d"),
|
|
|
"last_interaction_interval": self._get_hours_since_last_interaction(2),
|
|
|
"if_first_interaction": True if self.previous_state == DialogueState.INITIALIZED else False,
|
|
|
"if_active_greeting": False if user_message else True,
|
|
@@ -639,8 +642,8 @@ class DialogueManager:
|
|
|
tag_to_greeting_map = {
|
|
|
'04W4-AA-1': prompt_templates.GREETING_WITH_NAME_POETRY,
|
|
|
'04W4-AA-2': prompt_templates.GREETING_WITH_AVATAR_STORY,
|
|
|
- '04W4-AA-3': prompt_templates.GREETING_WITH_AVATAR_STORY,
|
|
|
- '04W4-AA-4': prompt_templates.GREETING_WITH_IMAGE_GAME,
|
|
|
+ '04W4-AA-3': prompt_templates.GREETING_WITH_INTEREST_QUERY,
|
|
|
+ '04W4-AA-4': prompt_templates.GREETING_WITH_CALENDAR,
|
|
|
}
|
|
|
for tag in user_tags:
|
|
|
if tag in tag_to_greeting_map:
|
|
@@ -648,7 +651,10 @@ class DialogueManager:
|
|
|
prompt = selected_prompt.format(**prompt_context)
|
|
|
user_message = {'role': 'user', 'content': prompt}
|
|
|
messages = [system_message, user_message]
|
|
|
- if selected_prompt == prompt_templates.GREETING_WITH_AVATAR_STORY:
|
|
|
+ if selected_prompt in (
|
|
|
+ prompt_templates.GREETING_WITH_AVATAR_STORY,
|
|
|
+ prompt_templates.GREETING_WITH_INTEREST_QUERY,
|
|
|
+ ):
|
|
|
messages.append({
|
|
|
"role": 'user',
|
|
|
"content": [
|