zhayujie / chatgpt-on-wechat

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

Worker return exception: 'list' object has no attribute 'strip' #2131

Closed vanish1984 closed 1 week ago

vanish1984 commented 1 week ago

前置确认

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

操作系统类型?

Docker

运行的python版本是?

python 3.10

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

Latest Release

运行的channel类型是?

wx(个人微信, itchat)

复现步骤 🕹

接入微信,后台接入fastgpt,调用 工具(知识库搜索)或(http模块),后台报错,无返回

问题描述 😯

image

终端日志 📒

2024-07-05T09:46:40.297031505Z [ERROR][2024-07-05 09:46:40][chat_channel.py:303] - Worker return exception: 'list' object has no attribute 'strip'
2024-07-05T09:46:40.297093838Z Traceback (most recent call last):
2024-07-05T09:46:40.297098880Z   File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
2024-07-05T09:46:40.297100671Z     result = self.fn(*self.args, **self.kwargs)
2024-07-05T09:46:40.297102213Z   File "/app/channel/chat_channel.py", line 176, in _handle
2024-07-05T09:46:40.297103630Z     reply = self._decorate_reply(context, reply)
2024-07-05T09:46:40.297104921Z   File "/app/channel/chat_channel.py", line 258, in _decorate_reply
2024-07-05T09:46:40.297106630Z     reply_text = "@" + context["msg"].actual_user_nickname + "\n" + reply_text.strip()
2024-07-05T09:46:40.297108338Z AttributeError: 'list' object has no attribute 'strip'
vanish1984 commented 1 week ago

模型使用 GPT4,并使用了 toolChoice 和 functionCall 特性

6vision commented 1 week ago

reply_text 正常时字符串类型,返回的时列表所以报错

vanish1984 commented 1 week ago

使用了 toolChoice 特性,返回的可能是一个 数组,也符合 gpt的规范,是否有计划支持?