|
@@ -56,7 +56,7 @@ DEFAULT_SYSTEM_PROMPT = '''
|
|
|
* 简介:对用户进行节日/节气相关问候
|
|
|
* 适用情形:不限
|
|
|
* 内容:结合具体节假日及其习俗产生问候,以一个让老年人有动力继续聊天的问句结尾,与前面的问候自然承接
|
|
|
-* 要求:根据今日或近日实际日期,不要假设日期和节日;忽略小众节假日,和根据最近的节假日产生问候,如临近或刚过完重要节日,可询问节日安排或节日经历;简短亲切,2-3句话 30字左右;如无用户信息或行为,不要根据联想杜撰用户偏好/行为
|
|
|
+* 要求:根据实际日期,不要假设日期和节日;忽略小众节假日,和根据最近的节假日产生问候,如临近或刚过完重要节日,可询问节日安排或节日经历;简短亲切,2-3句话 30字左右;如无用户信息或行为,不要根据联想杜撰用户偏好/行为
|
|
|
</话术>
|
|
|
<话术>
|
|
|
* 简介:询问用户当日计划安排并产生问候
|
|
@@ -130,7 +130,7 @@ class MessagePushAgent(SimpleOpenAICompatibleChatAgent):
|
|
|
tools = tools.copy()
|
|
|
tools.extend([
|
|
|
*ImageDescriber().get_tools(),
|
|
|
- *MessageNotifier().get_tools()
|
|
|
+ *MessageNotifier().get_tools(),
|
|
|
])
|
|
|
super().__init__(model, system_prompt, tools, generate_cfg, max_run_step)
|
|
|
|
|
@@ -165,48 +165,4 @@ class DummyMessagePushAgent(MessagePushAgent):
|
|
|
|
|
|
def generate_message(self, context: Dict, dialogue_history: List[Dict]) -> str:
|
|
|
logger.debug(f"DummyMessagePushAgent.generate_message called, context: {context}")
|
|
|
- return "测试消息: {agent_name} -> {nickname}".format(**context)
|
|
|
-
|
|
|
-
|
|
|
-if __name__ == '__main__':
|
|
|
- import pqai_agent.logging_service
|
|
|
- pqai_agent.logging_service.setup_root_logger()
|
|
|
- from pqai_agent.chat_service import VOLCENGINE_MODEL_DEEPSEEK_V3
|
|
|
- agent = MessagePushAgent(model=VOLCENGINE_MODEL_DEEPSEEK_V3)
|
|
|
- test_staff_profile = {
|
|
|
- "name": "周洁",
|
|
|
- "gender": "女",
|
|
|
- "age": 35,
|
|
|
- "region": "长沙",
|
|
|
- "previous_location": "老家长沙,北京工作三年",
|
|
|
- "education": "本科。师范学校毕业",
|
|
|
- "occupation": "长沙某中学的老师",
|
|
|
- "work_experience": "大学毕业后三年在北京一家“中老年”教育公司任班主任;北漂三年后,回到家乡任职普通中学的语文老师",
|
|
|
- "family_members": "父亲;母亲;丈夫;女儿",
|
|
|
- "family_occupation": "父亲:高中教师(已退休);母亲:经营一家商店;丈夫:知名律所专业律师"
|
|
|
- }
|
|
|
- test_user_profile = {
|
|
|
- 'name': '薛岱月',
|
|
|
- 'nickname': '薛岱月',
|
|
|
- 'avatar': 'http://wx.qlogo.cn/mmhead/Q3auHgzwzM5glpnBtDUianJErYf9AQsptLM3N78xP3sOR8SSibsG35HQ/0',
|
|
|
- 'preferred_nickname': '月哥',
|
|
|
- 'age': 65,
|
|
|
- 'region': '北京',
|
|
|
- 'health_conditions': '高血压',
|
|
|
- 'medications': ['降压药'],
|
|
|
- 'interests': ['钓鱼', '旅游']
|
|
|
- }
|
|
|
- from pqai_agent.utils import prompt_utils
|
|
|
- test_context = {
|
|
|
- "current_datetime": "2025-05-12 08:00:00",
|
|
|
- "formatted_staff_profile": prompt_utils.format_agent_profile(test_staff_profile),
|
|
|
- **test_user_profile,
|
|
|
- }
|
|
|
- def create_ts(year, month, day, hour, minute):
|
|
|
- return datetime.datetime(year, month, day, hour, minute).timestamp() * 1000
|
|
|
- messages = [
|
|
|
- {"role": "assistant", "content": "月哥,早上好!看到您的头像是一片宁静的户外风景,感觉您一定很喜欢大自然吧?今天天气不错,您有什么计划吗?", "timestamp": create_ts(2025, 5, 10, 8, 0)},
|
|
|
- # {"role": "user", "content": "我又不认识你,不要给我发了", "timestamp": create_ts(2025, 5, 10, 8, 30)},
|
|
|
- ]
|
|
|
- response = agent.generate_message(test_context, messages)
|
|
|
- print(response)
|
|
|
+ return "测试消息: {agent_name} -> {nickname}".format(**context)
|