Переглянути джерело

小bug修复,更新groq检测

GXX 3 місяців тому
батько
коміт
8449e78390
2 змінених файлів з 27 додано та 2 видалено
  1. 24 1
      chat_model.py
  2. 3 1
      main.py

+ 24 - 1
chat_model.py

@@ -186,4 +186,27 @@ def detect_tool(message):
     """
     新方法,编写中
     """
-    model = "llama-3.3-70b-versatile"
+    model = "llama-3.3-70b-versatile"
+
+
+if __name__ == "__main__":
+    # 测试用例1:简单问候消息
+    test_messages1 = [
+        {"role": "system", "content": "你是一个友好的助手,用简洁的语言回答问题。"},
+        {"role": "user", "content": "你好!请介绍一下你自己。"}
+    ]
+
+    print("测试用例1:简单问候消息")
+    try:
+        response1 = groq_chat(test_messages1)
+        print("响应结果:")
+        print(response1)
+        print("测试用例1执行成功\n")
+    except Exception as e:
+        print(f"测试用例1执行失败:{str(e)}\n")
+
+    # 测试用例2:包含特殊标记的消息(测试清理功能)
+    test_messages2 = [
+        {"role": "system", "content": "直接重复用户的消息"},
+        {"role": "user", "content": "这是一段包含特殊标记的文本:需要移除的内容<|FunctionCallEnd|>请检查是否能正确清理。"}
+    ]

+ 3 - 1
main.py

@@ -121,6 +121,8 @@ def on_command(group_id, user_id,command):
                 del_group_message(message_id)
     elif str(command).startswith("/语音合成"):
         send_group_message_word(group_id, "语音合成开始")
+        name = "xxx"
+        text = "xxx"
         if str(command).startswith("/语音合成诺艾尔"):
             name = "诺艾尔"
             text = str(command)[len("/语音合成诺艾尔"):]
@@ -137,7 +139,7 @@ def on_command(group_id, user_id,command):
         if result.startswith("https"):
             send_group_vioce(group_id, result)
         else:
-            send_group_message_word(group_id, "语音合成失败!")
+            send_group_message_word(group_id, result)
 
     else:
         error = "抱歉没有找到你所输入的命令!如有关于命令的问题请@猫猫输入/菜单进行查询\n示例:\n@猫猫 /菜单"