Browse Source

Update server/prompt_util: format staff profile

StrayWarrior 3 weeks ago
parent
commit
9f6ace983e
1 changed files with 6 additions and 2 deletions
  1. 6 2
      pqai_agent_server/utils/prompt_util.py

+ 6 - 2
pqai_agent_server/utils/prompt_util.py

@@ -8,6 +8,7 @@ from pqai_agent.response_type_detector import ResponseTypeDetector
 from pqai_agent.user_profile_extractor import UserProfileExtractor
 from pqai_agent.dialogue_manager import DialogueManager
 from pqai_agent.message import MessageType
+from pqai_agent.utils.prompt_utils import format_agent_profile
 
 logger = logging_service.logger
 
@@ -83,7 +84,7 @@ def run_extractor_prompt(req_data):
     dialogue_history = req_data["dialogue_history"]
     model_name = req_data["model_name"]
     prompt_context = {
-        **staff_profile,
+        "formatted_staff_profile": format_agent_profile(staff_profile),
         **user_profile,
         "dialogue_history": UserProfileExtractor.compose_dialogue(dialogue_history),
     }
@@ -114,7 +115,10 @@ def run_chat_prompt(req_data):
     dialogue_history = req_data.get("dialogue_history", [])
     model_name = req_data["model_name"]
     current_timestamp = req_data["current_timestamp"] / 1000
-    prompt_context = {**staff_profile, **user_profile}
+    prompt_context = {
+        'formatted_staff_profile': format_agent_profile(staff_profile),
+        **user_profile
+    }
     current_hour = datetime.fromtimestamp(current_timestamp).hour
     prompt_context["last_interaction_interval"] = 0
     prompt_context["current_time_period"] = DialogueManager.get_time_context(