Bladeren bron

优化部分模块代码和测试

GXX 2 weken geleden
bovenliggende
commit
38a850f27e
3 gewijzigde bestanden met toevoegingen van 30 en 27 verwijderingen
  1. 2 2
      chat_model.py
  2. 22 22
      main.py
  3. 6 3
      msg_send_save.py

+ 2 - 2
chat_model.py

@@ -72,7 +72,7 @@ def AI_chat(group_id ,word ,prompt):
             break
     return ans
 
-def groq_chat(messages, model = "qwen/qwen3-32b"):
+def groq_chat(messages, model = "qwen/qwen3.6-27b"):
     """
     主对话通道,https://api.gxx12138.space/groq/v1
     """
@@ -162,7 +162,7 @@ def AI_sendphoto_ornot(event):
     )
     # 发送AI请求
     response = client.chat.completions.create(
-        model="THUDM/glm-4-9b-chat",
+        model="Qwen/Qwen2.5-7B-Instruct",
         messages=messages,
         stream=False,
         temperature=0.7,

+ 22 - 22
main.py

@@ -90,7 +90,6 @@ def on_command(group_id, user_id,command):
 /王石:查询王石效果
 /猫猫画画:调用自定义AI绘画功能
 /整点瑟瑟:不用我多说了吧
-/语音合成+角色名称:合成AI语音(测试用,目前支持诺艾尔,芙宁娜,神里绫华,迪卢克
 所有命令均需要@猫猫触发"""
         send_group_message_word(group_id, home)
         save_group_message(group_id, my_name, home)
@@ -141,27 +140,28 @@ def on_command(group_id, user_id,command):
                 message_id = send_group_message_pic(group_id, user_id, story_start("nsfw,"+AI_lora_getpic_prompt(pic_word)))['data']['message_id']
                 time.sleep(10)
                 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("/语音合成诺艾尔"):]
-        elif str(command).startswith("/语音合成芙宁娜"):
-            name = "芙宁娜"
-            text = str(command)[len("/语音合成芙宁娜"):]
-        elif str(command).startswith("/语音合成神里绫华"):
-            name = "神里绫华"
-            text = str(command)[len("/语音合成神里绫华"):]
-        elif str(command).startswith("/语音合成迪卢克"):
-            name = "迪卢克"
-            text = str(command)[len("/语音合成迪卢克"):]
-        result = get_free_tts(name, text)
-        if result.startswith("https"):
-            send_group_vioce(group_id, result)
-        else:
-            send_group_message_word(group_id, result)
+    # 暂时弃用
+    # elif str(command).startswith("/语音合成"):
+    #     send_group_message_word(group_id, "语音合成开始")
+    #     name = "xxx"
+    #     text = "xxx"
+    #     if str(command).startswith("/语音合成诺艾尔"):
+    #         name = "诺艾尔"
+    #         text = str(command)[len("/语音合成诺艾尔"):]
+    #     elif str(command).startswith("/语音合成芙宁娜"):
+    #         name = "芙宁娜"
+    #         text = str(command)[len("/语音合成芙宁娜"):]
+    #     elif str(command).startswith("/语音合成神里绫华"):
+    #         name = "神里绫华"
+    #         text = str(command)[len("/语音合成神里绫华"):]
+    #     elif str(command).startswith("/语音合成迪卢克"):
+    #         name = "迪卢克"
+    #         text = str(command)[len("/语音合成迪卢克"):]
+    #     result = get_free_tts(name, text)
+    #     if result.startswith("https"):
+    #         send_group_vioce(group_id, result)
+    #     else:
+    #         send_group_message_word(group_id, result)
 
     else:
         error = "抱歉没有找到你所输入的命令!如有关于命令的问题请@猫猫输入/菜单进行查询\n示例:\n@猫猫 /菜单"

+ 6 - 3
msg_send_save.py

@@ -2,6 +2,8 @@ import csv
 import datetime
 import os
 import requests
+from urllib3 import response
+
 from config import key_get
 
 def send_private_message_word(user_id,word):
@@ -36,7 +38,7 @@ def send_group_message_pic(group_id, user_id, image_path):
     """
     给特定群聊的特定人发送图片, image_path为图片url,可以是本地文件也可以是网络地址
     """
-    file_path = "http://host.docker.internal:3100/pic" + f"?path=/{image_path}"
+    file_path = "http://127.0.0.1:3100/pic" + f"?path=/{image_path}"
     response = requests.post('http://127.0.0.1:3000/send_group_msg', json={
         'group_id': group_id,
         'message': [{
@@ -107,7 +109,7 @@ def del_group_message(message_id):
     """
     撤回消息,message_id为发送消息的返回响应中获取
     """
-    requests.post('http://127.0.0.1:3000//delete_msg', json={
+    requests.post('http://127.0.0.1:3000/delete_msg', json={
         'message_id': str(message_id)
     })
 
@@ -124,4 +126,5 @@ def send_feishu(message):
     })
 
 if __name__ == '__main__':
-    send_feishu('测试')
+    # send_feishu('测试')
+    del_group_message("62504375")