zhayujie / chatgpt-on-wechat

基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT-o1/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
https://docs.link-ai.tech/cow
MIT License
29.85k stars 7.88k forks source link

通义千问文档配置方式不明。(1.5.4) #1673

Closed AurganicSubstance closed 8 months ago

AurganicSubstance commented 8 months ago

前置确认

⚠️ 搜索issues中是否已存在类似问题

操作系统类型?

Windows

运行的python版本是?

python 3.10

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wx(个人微信, itchat)

复现步骤 🕹

我在config-template.json里将model改为tongyi,apikey我放入了open_ai_api_key里面,结果说open_ai 查无此key(没有链接tongyi)

问题描述 😯

image image 修改config后,程序还是把我tongyi的key倒给了config,但是在更新文件好像没说新的tongyi的配置key的字段应该是什么

终端日志 📒

D:\QWEN\chatgpt-on-wechat\venv\Scripts\python.exe D:\QWEN\chatgpt-on-wechat\app.py 
[INFO][2024-01-15 15:14:38][config.py:220] - 配置文件不存在,将使用config-template.json模板
[INFO][2024-01-15 15:14:38][config.py:249] - [INIT] load config: {'channel_type': 'wx', 'model': 'tongyi', 'open_ai_api_key': 'sk-xxxxxxxxxxxxxe97adb7fea0', 'text_to_image': 'dall-e-2', 'voice_to_text': 'openai', 'text_to_voice': 'openai', 'proxy': '', 'hot_reload': False, 'single_chat_prefix': ['bot', '@bot'], 'single_chat_reply_prefix': '[bot] ', 'group_chat_prefix': ['@bot'], 'group_name_white_list': ['ChatGPT测试群', 'ChatGPT测试群2'], 'group_chat_in_one_session': ['ChatGPT测试群'], 'image_create_prefix': ['画'], 'speech_recognition': True, 'group_speech_recognition': False, 'voice_reply_voice': False, 'conversation_max_tokens': 2500, 'expires_in_seconds': 3600, 'character_desc': '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。', 'temperature': 0.7, 'top_p': 1, 'subscribe_msg': '感谢您的关注!\n这里是ChatGPT,可以自由对话。\n支持语音对话。\n支持图片输入。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持tool、角色扮演和文字冒险等丰富的插件。\n输入{trigger_prefix}#help 查看详细指令。', 'use_linkai': False, 'linkai_api_key': '', 'linkai_app_code': ''}
[INFO][2024-01-15 15:14:38][config.py:199] - [Config] User datas file not found, ignore.
[WARNING][2024-01-15 15:14:38][audio_convert.py:9] - import pysilk failed, wechaty voice message will not be supported.
D:\QWEN\chatgpt-on-wechat\venv\Lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
[INFO][2024-01-15 15:14:39][plugin_manager.py:50] - Loading plugins config...
[INFO][2024-01-15 15:14:39][plugin_manager.py:88] - Scaning plugins ...
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins\banwords
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin BDunit_v0.1 registered, path=./plugins\bdunit
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Dungeon_v1.0 registered, path=./plugins\dungeon
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Finish_v1.0 registered, path=./plugins\finish
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Godcmd_v1.0 registered, path=./plugins\godcmd
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Hello_v0.1 registered, path=./plugins\hello
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Keyword_v0.1 registered, path=./plugins\keyword
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin linkai_v0.1.0 registered, path=./plugins\linkai
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin Role_v1.0 registered, path=./plugins\role
chatgpt-tool-hub version: 0.4.6
[INFO][2024-01-15 15:14:39][plugin_manager.py:41] - Plugin tool_v0.4 registered, path=./plugins\tool
[INFO][2024-01-15 15:14:39][godcmd.py:194] - [Godcmd] 因未设置口令,本次的临时口令为8079。
[INFO][2024-01-15 15:14:39][godcmd.py:210] - [Godcmd] inited
[INFO][2024-01-15 15:14:39][keyword.py:40] - [keyword] {}
[INFO][2024-01-15 15:14:39][keyword.py:42] - [keyword] inited.
[INFO][2024-01-15 15:14:39][linkai.py:33] - [LinkAI] inited, config={'group_app_map': {'测试群名1': 'default', '测试群名2': 'Kv2fXJcH'}, 'midjourney': {'enabled': False, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': False, 'group_enabled': True, 'max_file_size': 5000, 'type': ['FILE', 'SHARING']}}
[INFO][2024-01-15 15:14:39][role.py:69] - [Role] inited
[INFO][2024-01-15 15:14:39][dungeon.py:56] - [Dungeon] inited
[INFO][2024-01-15 15:14:39][hello.py:24] - [Hello] inited
[INFO][2024-01-15 15:14:39][finish.py:23] - [Finish] inited
Ready to login.
Getting uuid of QR code.
Downloading QR code.
You can also scan QRCode in any website below:
https://api.pwmqr.com/qrcode/create/?url=https://login.weixin.qq.com/l/odid6nI3zw==
https://my.tv.sohu.com/user/a/wvideo/getQRCode.do?text=https://login.weixin.qq.com/l/odid6nI3zw==
https://api.qrserver.com/v1/create-qr-code/?size=400×400&data=https://login.weixin.qq.com/l/odid6nI3zw==
https://api.isoyu.com/qr/?m=1&e=L&p=20&url=https://login.weixin.qq.com/l/odid6nI3zw==
█▀▀▀▀▀▀▀██▀█▀█▀▀████▀██▀▀▀▀▀▀▀█
█ █▀▀▀█ █▄▄▀ ▀▄█ █▄█▄ █ █▀▀▀█ █
█ █   █ █▀   ▄██▀█▀▀ ▄█ █   █ █
█ ▀▀▀▀▀ █▀▄▀▄ █▀▄▀█ ▄▀█ ▀▀▀▀▀ █
█▀█▀█▀█▀███▄▄▄ ▄█▄ █▀ ███▀██▀██
██▄ ▄▀█▀▀█▄▀█▄▀ █▀ ▀█▀ ▄▀▀▄▀▀ █
██▀▀ ▀ ▀  █  █ █▄  ▄▀ ▄ ▄▄▀█ ▀█
█ ▀▄   ▀▄█▄▄██ ▄█▄▀██▄ ▄▀█ █▀ █
███▀ ▄█▀▀ █  ▄   ▀ ▄ ▀  ██ █ ▀█
█▀█▄ █▄▀█   ███▄█ ███ ▀ ▀█▄▄▀ █
█▀▄  █ ▀▄  █▀▀  ▄    ▀▀ ▀ ▄█▄██
█▀▀▀▀▀▀▀█▄█▄  █▄█▄▀█▀ █▀█ ▀▄  █
█ █▀▀▀█ █▀▄ ▀ ▄ ▀  ▄█ ▀▀▀ ▄█▄▄█
█ █   █ █▀ ██ ▄▀█▄██████  ▀▄▄ █
█ ▀▀▀▀▀ █▀█▄ ▄██▀  ▀  ▀▀ ███ ▀█
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Please press confirm on your phone.
Loading the contact, this may take a little while.
Login successfully as Thomas L
Start auto replying.
[INFO][2024-01-15 15:15:21][wechat_channel.py:126] - Wechat login success, user_id: @5a0b6cde839e396d88882717f002513e, nickname: Thomas L
[INFO][2024-01-15 15:15:36][bridge.py:49] - create bot chatGPT for chat
[INFO][2024-01-15 15:15:37][chat_gpt_bot.py:49] - [CHATGPT] query=试试看again
[WARNING][2024-01-15 15:15:37][chat_gpt_session.py:83] - num_tokens_from_messages() is not implemented for model tongyi. Returning num tokens assuming gpt-3.5-turbo.
[ERROR][2024-01-15 15:15:38][chat_gpt_bot.py:155] - [CHATGPT] Exception: Incorrect API key provided: sk-7e7a4***********************fea0. You can find your API key at https://platform.openai.com/account/api-keys.
Traceback (most recent call last):
  File "D:\QWEN\chatgpt-on-wechat\bot\chatgpt\chat_gpt_bot.py", line 123, in reply_text
    response = openai.ChatCompletion.create(api_key=api_key, messages=session.messages, **args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\QWEN\chatgpt-on-wechat\venv\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\QWEN\chatgpt-on-wechat\venv\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "D:\QWEN\chatgpt-on-wechat\venv\Lib\site-packages\openai\api_requestor.py", line 298, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\QWEN\chatgpt-on-wechat\venv\Lib\site-packages\openai\api_requestor.py", line 700, in _interpret_response
    self._interpret_response_line(
  File "D:\QWEN\chatgpt-on-wechat\venv\Lib\site-packages\openai\api_requestor.py", line 763, in _interpret_response_line
    raise self.handle_error_response(
openai.error.AuthenticationError: Incorrect API key provided: sk-7e7a4***********************fea0. You can find your API key at https://platform.openai.com/account/api-keys.
[INFO][2024-01-15 15:15:39][wechat_channel.py:194] - [WX] sendMsg=Reply(type=ERROR, content=[ERROR]
我现在有点累了,等会再来吧), receiver=@3abc6452b57145f58cc545cb400d93e9d1bf38dc6363967d3b1a511a84e42c32
Unexpected sync check result: window.synccheck={retcode:"1101",selector:"0"}
LOG OUT!

Process finished with exit code 0
AurganicSubstance commented 8 months ago

solved、已解决:在config json里面加入: "model": "qwen", "qwen_access_key_id": "xxxxxx", "qwen_access_key_secret": "xxxxxxxx", "qwen_agent_key": "xxxxxx", "qwen_app_id": "xxxxxx", "qwen_node_id": "", #这是空值, 感谢群里的“培根煎蛋”提供的答案

Simon-leomon commented 8 months ago

File "D:\Python\Python38\lib\site-packages\alibabacloud_tea_openapi\client.py", line 1266, in do_request raise TeaException({ Tea.exceptions.TeaException: Error: MissingAccessKeyId code: 400, AccessKeyId is mandatory for this action. request id: AEB25640-ADC9-571D-93DA-7CBFBDB023AB Response: {'RequestId': 'AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'Message': 'AccessKeyId is mandatory for this action.', 'Recommend': 'https://api.aliyun.com/troubleshoot?q=MissingAccessKeyId&product=bailian&requestId=AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'HostId': 'bailian.cn-beijing.aliyuncs.com', 'Code': 'MissingAccessKeyId', 'statusCode': 400}

DashScope灵积模型服务,不是用的这个模型?

zhayujie commented 8 months ago

参考这个pr https://github.com/zhayujie/chatgpt-on-wechat/pull/1537

cy920820 commented 7 months ago

File "D:\Python\Python38\lib\site-packages\alibabacloud_tea_openapi\client.py", line 1266, in do_request raise TeaException({ Tea.exceptions.TeaException: Error: MissingAccessKeyId code: 400, AccessKeyId is mandatory for this action. request id: AEB25640-ADC9-571D-93DA-7CBFBDB023AB Response: {'RequestId': 'AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'Message': 'AccessKeyId is mandatory for this action.', 'Recommend': 'https://api.aliyun.com/troubleshoot?q=MissingAccessKeyId&product=bailian&requestId=AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'HostId': 'bailian.cn-beijing.aliyuncs.com', 'Code': 'MissingAccessKeyId', 'statusCode': 400}

DashScope灵积模型服务,不是用的这个模型?

@Simon-leomon 解决了吗? 同样的报错,确定 ak sk 都配置正确了,但是仍然有这个问题

Simon-leomon commented 7 months ago

灵积模型与百炼模型是不同的平台,应用方式有很大的不同。 ------------------ 原始邮件 ------------------ 发件人: "zhayujie/chatgpt-on-wechat" @.>; 发送时间: 2024年1月22日(星期一) 下午3:24 @.>; @.**@.>; 主题: Re: [zhayujie/chatgpt-on-wechat] 通义千问文档配置方式不明。(1.5.4) (Issue #1673)

File "D:\Python\Python38\lib\site-packages\alibabacloud_tea_openapi\client.py", line 1266, in do_request raise TeaException({ Tea.exceptions.TeaException: Error: MissingAccessKeyId code: 400, AccessKeyId is mandatory for this action. request id: AEB25640-ADC9-571D-93DA-7CBFBDB023AB Response: {'RequestId': 'AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'Message': 'AccessKeyId is mandatory for this action.', 'Recommend': 'https://api.aliyun.com/troubleshoot?q=MissingAccessKeyId&product=bailian&requestId=AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'HostId': 'bailian.cn-beijing.aliyuncs.com', 'Code': 'MissingAccessKeyId', 'statusCode': 400}

DashScope灵积模型服务,不是用的这个模型?

@Simon-leomon 解决了吗? 同样的报错,确定 ak sk 都配置正确了,但是仍然有这个问题

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

li5bo5 commented 7 months ago

solved、已解决:在config json里面加入: "model": "qwen", "qwen_access_key_id": "xxxxxx", "qwen_access_key_secret": "xxxxxxxx", "qwen_agent_key": "xxxxxx", "qwen_app_id": "xxxxxx", "qwen_node_id": "", #这是空值, 感谢群里的“培根煎蛋”提供的答案

请问您添加了千问的信息之后,原来的 "open_ai_api_key"、"open_ai_api_base"、 "proxy" 、 "model": "gpt-3.5-turbo", 等项目要不要删掉?

Simon-leomon commented 7 months ago

灵积模型与百炼模型是不同的平台,应用方式有很大的不同。 ------------------ 原始邮件 ------------------ 发件人: "zhayujie/chatgpt-on-wechat" @.>; 发送时间: 2024年1月22日(星期一) 下午3:24 @.>; @.**@.>; 主题: Re: [zhayujie/chatgpt-on-wechat] 通义千问文档配置方式不明。(1.5.4) (Issue #1673) File "D:\Python\Python38\lib\site-packages\alibabacloud_tea_openapi\client.py", line 1266, in do_request raise TeaException({ Tea.exceptions.TeaException: Error: MissingAccessKeyId code: 400, AccessKeyId is mandatory for this action. request id: AEB25640-ADC9-571D-93DA-7CBFBDB023AB Response: {'RequestId': 'AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'Message': 'AccessKeyId is mandatory for this action.', 'Recommend': 'https://api.aliyun.com/troubleshoot?q=MissingAccessKeyId&product=bailian&requestId=AEB25640-ADC9-571D-93DA-7CBFBDB023AB', 'HostId': 'bailian.cn-beijing.aliyuncs.com', 'Code': 'MissingAccessKeyId', 'statusCode': 400} DashScope灵积模型服务,不是用的这个模型? @Simon-leomon 解决了吗? 同样的报错,确定 ak sk 都配置正确了,但是仍然有这个问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

百炼模型的功能更丰富,可以实现更多功用满足更丰富的应用场景。