Browse Source

modified: main.py

modified:   wechatbot/config.py
	modified:   wechatbot/drawer.py
master
Xin Yan 7 months ago
parent
commit
ab39b03425
3 changed files with 10 additions and 15 deletions
  1. +9
    -13
      main.py
  2. +1
    -1
      wechatbot/config.py
  3. +0
    -1
      wechatbot/drawer.py

+ 9
- 13
main.py View File

@@ -20,7 +20,8 @@ wechat.open(smart=True)
wechat.wait_login()
rooms = wechat.get_rooms()

nickname = ''
nickname = wechat.get_self_info()['nickname']
master_wxid = config.config['master_wxid']

indirect_num = 0
for indirect_list in rooms:
@@ -31,8 +32,6 @@ direct_num = len(wechat.get_contacts())
print('直接用户:%d人' % direct_num, '间接用户:%d人' % indirect_num,
'群聊数量:%d' % len(rooms))

master_wxid = config.config['master_wxid']


def yuan_1_0(text_prompt):
model_name = 'yuan'
@@ -292,8 +291,8 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
wechat_instance.send_room_at_msg(to_wxid=room_wxid,
content="{$@} 好哦~请您稍等~!",
at_list=member)
style_input = data['msg'].split(' ')[1]
text_prompt = data["msg"].split(' ')[2]
style_input = base_prompt.split(' ')[1]
text_prompt = base_prompt.split(' ')[2]

try:
file_path = config.config['file_path']
@@ -372,8 +371,7 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):

elif base_prompt.split(' ')[0] == '源':
text_prompt = base_prompt.replace('源 ', '')
response = yuan_1_0(text_prompt=text_prompt,
from_wxid=from_wxid)
response = yuan_1_0(text_prompt=text_prompt)
wechat_instance.send_room_at_msg(
to_wxid=room_wxid,
content="{$@} " + "【浪潮源1.0大模型回复】" + '\n' + response,
@@ -382,8 +380,7 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
elif base_prompt.split(' ')[0] == '元语':

text_prompt = base_prompt.replace('元语 ', '')
response = ChatYuan(text_prompt=text_prompt,
from_wxid=from_wxid)
response = ChatYuan(text_prompt=text_prompt)

wechat_instance.send_room_at_msg(
to_wxid=room_wxid,
@@ -392,8 +389,7 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):

elif base_prompt.split(' ')[0] == '盘古':
text_prompt = base_prompt.replace('盘古 ', '')
response = ChatPanGu(text_prompt=text_prompt,
from_wxid=from_wxid)
response = ChatPanGu(text_prompt=text_prompt)

wechat_instance.send_room_at_msg(
to_wxid=room_wxid,
@@ -401,8 +397,8 @@ def on_recv_text_msg(wechat_instance: ntchat.WeChat, message):
at_list=member)

else:
response = ChatPanGu(text_prompt=text_prompt,
from_wxid=from_wxid)
text_prompt = base_prompt
response = ChatPanGu(text_prompt=text_prompt)
wechat_instance.send_room_at_msg(
to_wxid=room_wxid,
content="{$@} " + "【鹏程·盘古对话模型回复】" + '\n' + response,


+ 1
- 1
wechatbot/config.py View File

@@ -9,4 +9,4 @@ config = {
'clueai_key': "", # 元语ChatYuan的api_key
'PanGu_key': '', # 鹏程·盘古的api_key
'black_wxid': [] # 黑名单
}
}

+ 0
- 1
wechatbot/drawer.py View File

@@ -8,7 +8,6 @@ import urllib.request
import httpx
from pydantic import BaseSettings

import config
from wechatbot import config

wenxin_ak = config.config['wenxin_ak']


Loading…
Cancel
Save