goldfishh / chatgpt-tool-hub

An open-source chatgpt tool ecosystem where you can combine tools with chatgpt and use natural language to do anything.
MIT License
1.19k stars 158 forks source link

tool 插件的问题, 采用tool命令,确生成聊天的summary #41

Closed hellangleZ closed 8 months ago

hellangleZ commented 1 year ago

前置确认

1. 网络能够访问openai接口
2. git pull 拉取最新代码
3. 执行pip install -r requirements.txt,检查依赖是否满足
4. 在已有 issue 中未搜索到类似问题

5. 注意,提issue前请确认用本项目test.py(参考README.md 快速开始配置)重试一次你的问题是否能复现

问题描述

  1. 你的问题是否在test.py能复现?

  2. 你复现时的config.json,注意抹去你的api-key

    {
    "tools": [],
    "kwargs": {
      "debug": true  // debug模式一定要打开
    }
    }
  3. 你的问题:

[替换我]

正常启动插件,但是问题都变成被summary

  1. 收到ai的回复:
![image](https://user-images.githubusercontent.com/15274284/234745136-148abda1-6878-48f0-9b30-7f6e46754340.png)
  1. debug模式终端打印的日志:

[DEBUG][2023-04-27 02:24:56][chat_channel.py:262] - Worker return success, session_id = @838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee [DEBUG][2023-04-27 02:25:01][wechat_channel.py:161] - [WX]receive text msg: {"MsgId": "5353332160588795729", "FromUserName": "@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee", "ToUserName": "@f8e8a4dc864139b4bc6d8d26044cac26e6c32c4d1c9b7d604cc5e4cb1f090b95", "MsgType": 1, "Content": "b $tool 使用metro,查询4月27日北京的天气", "Status": 3, "ImgStatus": 1, "CreateTime": 1682562300, "VoiceLength": 0, "PlayLength": 0, "FileName": "", "FileSize": "", "MediaId": "", "Url": "", "AppMsgType": 0, "StatusNotifyCode": 0, "StatusNotifyUserName": "", "RecommendInfo": {"UserName": "", "NickName": "", "QQNum": 0, "Province": "", "City": "", "Content": "", "Signature": "", "Alias": "", "Scene": 0, "VerifyFlag": 0, "AttrStatus": 0, "Sex": 0, "Ticket": "", "OpCode": 0}, "ForwardFlag": 0, "AppInfo": {"AppID": "", "Type": 0}, "HasProductId": 0, "Ticket": "", "ImgHeight": 0, "ImgWidth": 0, "SubMsgType": 0, "NewMsgId": 5353332160588795729, "OriContent": "", "EncryFileName": "", "User": {"MemberList": [], "Uin": 0, "UserName": "@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee", "NickName": "博洋", "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=751762527&username=@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee&skey=@crypt_650a1e63_2de85d1cb97dde1c6714be1dc1aee511", "ContactFlag": 1, "MemberCount": 0, "RemarkName": "", "HideInputBarFlag": 0, "Sex": 1, "Signature": "人菜瘾大", "VerifyFlag": 0, "OwnerUin": 0, "PYInitial": "BY", "PYQuanPin": "boyang", "RemarkPYInitial": "", "RemarkPYQuanPin": "", "StarFriend": 0, "AppAccountFlag": 0, "Statues": 0, "AttrStatus": 102437, "Province": "北京", "City": "", "Alias": "", "SnsFlag": 257, "UniFriend": 0, "DisplayName": "", "ChatRoomId": 0, "KeyWord": "", "EncryChatRoomId": "", "IsOwner": 0}, "Type": "Text", "Text": "b $tool 使用metro,查询4月27日北京的天气"}, cmsg=ChatMessage: id=5353332160588795729, create_time=1682562300, ctype=TEXT, content=b $tool 使用metro,查询4月27日北京的天气, from_user_id=@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee, from_user_nickname=博洋, to_user_id=@f8e8a4dc864139b4bc6d8d26044cac26e6c32c4d1c9b7d604cc5e4cb1f090b95, to_user_nickname=RBQ3.0, other_user_id=@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee, other_user_nickname=博洋, is_group=False, is_at=False, actual_user_id=None, actual_user_nickname=None [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin SUMMARY triggered by event Event.ON_RECEIVE_MESSAGE [DEBUG][2023-04-27 02:25:01][main.py:90] - [Summary] insert record: 博洋 5353332160588795729 博洋 b $tool 使用metro,查询4月27日北京的天气 TEXT 1682562300 1 [DEBUG][2023-04-27 02:25:01][chat_channel.py:307] - [WX] consume context: Context(type=TEXT, content=$tool 使用metro,查询4月27日北京的天气, kwargs={'isgroup': False, 'msg': <channel.wechat.wechat_message.WechatMessage object at 0x7fa4aa9fab90>, 'origin_ctype': <ContextType.TEXT: 1>, 'session_id': '@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee', 'receiver': '@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee'}) [DEBUG][2023-04-27 02:25:01][chat_channel.py:141] - [WX] ready to handle context: Context(type=TEXT, content=$tool 使用metro,查询4月27日北京的天气, kwargs={'isgroup': False, 'msg': <channel.wechat.wechat_message.WechatMessage object at 0x7fa4aa9fab90>, 'origin_ctype': <ContextType.TEXT: 1>, 'session_id': '@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee', 'receiver': '@838b60254824f07db26549e650b2f45d7f54b32fc8e76c8b0b8a96871c45d6ee'}) [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin GODCMD triggered by event Event.ON_HANDLE_CONTEXT [DEBUG][2023-04-27 02:25:01][godcmd.py:206] - [Godcmd] on_handle_context. content: $tool 使用metro,查询4月27日北京的天气 [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin KEYWORD triggered by event Event.ON_HANDLE_CONTEXT [DEBUG][2023-04-27 02:25:01][keyword.py:52] - [keyword] on_handle_context. content: $tool 使用metro,查询4月27日北京的天气 [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin SDWEBUI triggered by event Event.ON_HANDLE_CONTEXT [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin ROLE triggered by event Event.ON_HANDLE_CONTEXT [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin DUNGEON triggered by event Event.ON_HANDLE_CONTEXT [DEBUG][2023-04-27 02:25:01][dungeon.py:73] - [Dungeon] on_handle_context. content: ['$tool', '使用metro,查询4月27日北京的天气'] [DEBUG][2023-04-27 02:25:01][plugin_manager.py:163] - Plugin SUMMARY triggered by event Event.ON_HANDLE_CONTEXT [DEBUG][2023-04-27 02:25:01][main.py:221] - [Summary] on_handle_context. content: $tool 使用metro,查询4月27日北京的天气 [DEBUG][2023-04-27 02:25:01][chat_gpt_session.py:63] - Warning: model not found. Using cl100k_base encoding. [DEBUG][2023-04-27 02:25:01][main.py:195] - [Summary] summary all 75 messages [DEBUG][2023-04-27 02:25:01][chat_gpt_session.py:63] - Warning: model not found. Using cl100k_base encoding. [DEBUG][2023-04-27 02:25:01][main.py:199] - [Summary] session query: [{'role': 'system', 'content': '你是一位群聊机器人,需要对聊天记录进行简明扼要的总结,用列表的形式输出。\n聊天记录格式:[x]是emoji表情或者是对图片和声音文件的说明,消息最后出现表示消息触发了群聊机器人的回复,内容通常是提问,若带有特殊符号如#和$则是触发你无法感知的某个插件功能,聊天记录中不包含你对这类消息的回复,可降低这些消息的权重。请不要在回复中包含聊天记录格式中出现的符号。\n'}, {'role': 'user', 'content': '需要你总结的聊天记录如下:\n\n博洋: "b #auth 4621130" \n\n博洋: "b #installp sdwebui" \n\n博洋: "b #scanp" \n\n博洋: "b 画一个鸭子" \n\n博洋: "b 画 横版 高清 二次元:cat" \n\n博洋: "b #help" \n\n博洋: "b #plist" \n\n博洋: "b #help summary" \n\n博洋: "b 总结博洋 总结50"" \n\n博洋: "b "$总结 100"" \n\n博洋: "b $总结 100" \n\n博洋: "b #help tool" \n\n博洋: "b $tool 查一下今天的天气" \n\n博洋: "b $tool 用 meteo-weather 查看一下今天北京的天气情况 " \n\n博洋: "b $tool 用 meteo-weather 查看一下今天北京的天气情况 " \n\n博洋: "b $tool 查看一下今天北京的天气情况 " \n\n博洋: "b $tool 查看一下NBA比赛新闻" \n\n博洋: "b $tool reset" \n\n博洋: "b $tool 查一下今天的新闻" \n\n博洋: "[IMAGE]"\n\n博洋: "b #plist" \n\n博洋: "b #auth 4621130" \n\n博洋: "b #plist" \n\n博洋: "b #auth 4621130" \n\n博洋: "b #plist" \n\n博洋: "b #enablep sdwebui" \n\n博洋: "b #auth 4621130" \n\n博洋: "b #enablep sdwebui" \n\n博洋: "b 画个小鸭子" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair, up half body" \n\n博洋: "b #enablep sdwebui" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair, up half body" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画横版 高清 水墨:长城" \n\n博洋: "b #auth 4621130" \n\n博洋: "b #plist" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b #plist" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b #enablep sdwebui" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b #enablep sdwebui" \n\n博洋: "b #auth 4621130" \n\n博洋: "b #plist" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:girl,cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画横版 高清 水墨中国画:greatwall" \n\n博洋: "[IMAGE]"\n\n博洋: "b #auth 4621130" \n\n博洋: "b #plist" \n\n博洋: "b #enablep sdwebui" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 画竖版 高清 二次元:cat ear,glasses, purple eye, black hair" \n\n博洋: "b 使用Terminal,查找我的用户目录有那些文件" \n\n博洋: "b $tool 使用Terminal,查找我的用户目录有那些文件" \n\n博洋: "b" \n\n博洋: "b #help tool" \n\n博洋: "b $tool 使用Terminal, ls -l" \n\n博洋: "b $tool 使用Terminal, ls -l" \n\n博洋: "b $tool 使用Terminal" \n\n博洋: "b $tool 激活tool插件" \n\n博洋: "b $tool" \n\n博洋: "b $tool 使用metro,查询4月27日北京的天气" \n\n博洋: "b #auth 4621130" \n\n博洋: "b $tool 使用metro,查询4月27日北京的天气" '}], prompt_tokens: 1876 [DEBUG][2023-04-27 02:25:20][main.py:202] - [Summary] total_tokens: 2276, completion_tokens: 400, reply_content: - 发送了指令#auth 4621130

发送了指令#installp sdwebui 发送了指令#scanp 发送了指令#help 发送了指令#plist 发送了指令#help summary 发送了指令$总结50 发送了指令$总结50 发送了指令$总结100 发送了指令$总结100 发送了指令#help tool 发送了指令$tool 查一下今天的天气 发送了指令$tool 用 meteo-weather 查看一下今天北京的天气情况 发送了指令$tool 查看一下今天北京的天气情况 发送了指令$tool 查看一下NBA比赛新闻 发送了指令$tool reset 发送了指令$tool 查一下今天的新闻

环境

hellangleZ commented 1 year ago

环境是linux 所有的其他的服务都正常就是tools出现了这个问题 image

goldfishh commented 1 year ago

确认一下openai接口是否走azure且配置了open_ai_api_base 如果是请告诉我你的open_ai_api_base 目前tool-hub暂不支持azure,可以等下一个版本发布

hellangleZ commented 1 year ago

确认一下openai接口是否走azure且配置了open_ai_api_base 如果是请告诉我你的open_ai_api_base 目前tool-hub暂不支持azure,可以等下一个版本发布

https://a-wxf.openai.azure.com/openai/deployments/gpt/chat/completions?api-version=2023-03-15-preview

这个是完整api

https://a-wxf.openai.azure.com

这个是base

GgQqCc commented 1 year ago

确认一下openai接口是否走azure且配置了open_ai_api_base 如果是请告诉我你的open_ai_api_base 目前tool-hub暂不支持azure,可以等下一个版本发布

https://a-wxf.openai.azure.com/openai/deployments/gpt/chat/completions?api-version=2023-03-15-preview

这个是完整api

https://a-wxf.openai.azure.com

这个是base

404...

goldfishh commented 1 year ago

确认一下openai接口是否走azure且配置了open_ai_api_base 如果是请告诉我你的open_ai_api_base 目前tool-hub暂不支持azure,可以等下一个版本发布

https://a-wxf.openai.azure.com/openai/deployments/gpt/chat/completions?api-version=2023-03-15-preview

这个是完整api

https://a-wxf.openai.azure.com

这个是base

你好,目前tool-hub已支持azure,在下一个版本你可以在config.json的kwargs里配置使用

"open_ai_api_base": "https://a-wxf.openai.azure.com/"

如果你等不及下一个版本发布,可以git clone tool-hub的代码到chatgpt-on-wechat根目录