Update change_mood.py

pull/998/head
2829798842 2025-05-28 19:16:19 +08:00 committed by GitHub
parent 0a4aef114d
commit d230c6ae51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -12,12 +12,12 @@ class ChangeMoodTool(BaseTool):
"""改变心情的工具""" """改变心情的工具"""
name = "change_mood" name = "change_mood"
description = "根据收到的内容和自身回复的内容,改变心情,当你回复了别人的消息,你可以使用这个工具" description = "Change mood based on received content and your own reply content, you can use this tool when you reply to someone's message"
parameters = { parameters = {
"type": "object", "type": "object",
"properties": { "properties": {
"text": {"type": "string", "description": "引起你改变心情的文本"}, "text": {"type": "string", "description": "Text that causes you to change your mood"},
"response_set": {"type": "list", "description": "你对文本的回复"}, "response_set": {"type": "list", "description": "Your reply to the text"},
}, },
"required": ["text", "response_set"], "required": ["text", "response_set"],
} }
@ -39,16 +39,16 @@ class ChangeMoodTool(BaseTool):
# gpt = ResponseGenerator() # gpt = ResponseGenerator()
if response_set is None: if response_set is None:
response_set = ["你还没有回复"] response_set = ["You haven't replied yet"]
_ori_response = ",".join(response_set) _ori_response = ",".join(response_set)
# _stance, emotion = await gpt._get_emotion_tags(ori_response, message_processed_plain_text) # _stance, emotion = await gpt._get_emotion_tags(ori_response, message_processed_plain_text)
emotion = "平静" emotion = "calm"
mood_manager.update_mood_from_emotion(emotion, global_config.mood.mood_intensity_factor) mood_manager.update_mood_from_emotion(emotion, global_config.mood.mood_intensity_factor)
return {"name": "change_mood", "content": f"你的心情刚刚变化了,现在的心情是: {emotion}"} return {"name": "change_mood", "content": f"Your mood just changed, current mood is: {emotion}"}
except Exception as e: except Exception as e:
logger.error(f"心情改变工具执行失败: {str(e)}") logger.error(f"Mood change tool execution failed: {str(e)}")
return {"name": "change_mood", "content": f"心情改变失败: {str(e)}"} return {"name": "change_mood", "content": f"Mood change failed: {str(e)}"}
# 注册工具 # 注册工具