feat: add support for loading message in wxoa

This commit is contained in:
wangcham
2025-03-18 06:58:35 -04:00
parent ff93d563a8
commit a9ae36d362
3 changed files with 5 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ class OAClient():
class OAClientForLongerResponse():
def __init__(self,token:str,EncodingAESKey:str,AppID:str,Appsecret:str):
def __init__(self,token:str,EncodingAESKey:str,AppID:str,Appsecret:str,LoadingMessage:str):
self.token = token
self.aes = EncodingAESKey
self.appid = AppID
@@ -189,6 +189,7 @@ class OAClientForLongerResponse():
"example":[],
}
self.access_token_expiry_time = None
self.loading_message = LoadingMessage
async def handle_callback_request(self):
try:
@@ -246,7 +247,7 @@ class OAClientForLongerResponse():
to_user=from_user,
from_user=to_user,
create_time=int(time.time()),
content="AI正在思考中请发送任意内容获取回答。"
content=self.loading_message
)
if user_msg_queue.get(from_user) and user_msg_queue[from_user][0]["content"]:

View File

@@ -107,6 +107,7 @@ class OfficialAccountAdapter(adapter.MessagePlatformAdapter):
EncodingAESKey=config['EncodingAESKey'],
Appsecret=config['AppSecret'],
AppID=config['AppID'],
LoadingMessage=config['LoadingMessage']
)
else:
raise KeyError("请设置微信公众号通信模式")

View File

@@ -78,6 +78,7 @@
"AppID":"",
"AppSecret":"",
"Mode":"drop",
"LoadingMessage":"AI正在思考中请发送任意内容获取回复。",
"host": "0.0.0.0",
"port": 2287
},