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.2k stars 160 forks source link

url-get 返回 UnicodeEncodeError 报错 #62

Closed Abyss-Seeker closed 1 year ago

Abyss-Seeker commented 1 year ago

前置确认

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

有一个类似问题,似乎也是编码问题(#25) (不过最后似乎没有答复(没看懂)

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

问题描述

  1. 你的问题:
$tools arxiv 请帮我随便找一篇关于神经网络的论文并且总结它的基本信息。
  1. 收到ai的回复:
哟~你好呀!不好意思啊,看起来我的工具插件暂时可能无法解决你的问题。但是别担心,我会尽我所能来回答您的问题或提供帮助。如果您有其他问题需要解决,请不要犹豫,请告诉我,我会尽快给您答复。再次感谢您的耐心等待!
  1. debug模式终端打印的日志:
[ERROR][2023-06-10 11:01:03][victorinox.py:114] - [APP] catch a Exception: 'gbk' codec can't encode character '\xc1' in position 14281: illegal multibyte sequence
[ERROR][2023-06-10 11:01:03][victorinox.py:117] - exceed retry_num
[ERROR][2023-06-10 11:01:03][tool.py:108] - 超过重试次数
Traceback (most recent call last):
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\apps\victorinox.py", line 112, in ask
    return self.engine.run(query)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\chains\base.py", line 206, in run
    return self(args[0])[self.output_keys[0]]
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\chains\base.py", line 112, in __call__
    raise e
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\chains\base.py", line 109, in __call__
    outputs = self._call(inputs)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\engine\tool_engine.py", line 182, in _call
    next_step_output = self._take_next_step(
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\engine\tool_engine.py", line 120, in _take_next_step
    output = self.bot.plan(intermediate_steps, **inputs)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\bots\chat_bot\base.py", line 95, in plan
    full_inputs = self.get_full_inputs(intermediate_steps, **kwargs)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\bots\chat_bot\base.py", line 107, in get_full_inputs
    new_inputs = {"bot_scratchpad": self._crop_full_input(thoughts)}
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\engine\bot.py", line 93, in _crop_full_input
    f.write(_input + "\n")
UnicodeEncodeError: 'gbk' codec can't encode character '\xc1' in position 14281: illegal multibyte sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\apps\victorinox.py", line 112, in ask
    return self.engine.run(query)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\chains\base.py", line 206, in run
    return self(args[0])[self.output_keys[0]]
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\chains\base.py", line 112, in __call__
    raise e
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\chains\base.py", line 109, in __call__
    outputs = self._call(inputs)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\engine\tool_engine.py", line 182, in _call
    next_step_output = self._take_next_step(
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\engine\tool_engine.py", line 120, in _take_next_step
    output = self.bot.plan(intermediate_steps, **inputs)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\bots\chat_bot\base.py", line 95, in plan
    full_inputs = self.get_full_inputs(intermediate_steps, **kwargs)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\bots\chat_bot\base.py", line 107, in get_full_inputs
    new_inputs = {"bot_scratchpad": self._crop_full_input(thoughts)}
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\engine\bot.py", line 93, in _crop_full_input
    f.write(_input + "\n")
UnicodeEncodeError: 'gbk' codec can't encode character '\xc1' in position 14281: illegal multibyte sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Codes\chatgpt-on-wechat\plugins\tool\tool.py", line 104, in on_handle_context
    _reply = self.app.ask(query, user_session)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\apps\victorinox.py", line 116, in ask
    return self.ask(query, chat_history, retry_num + 1)
  File "C:\Users\Jasper\AppData\Roaming\Python\Python39\site-packages\chatgpt_tool_hub\apps\victorinox.py", line 118, in ask
    raise TimeoutError("超过重试次数")
TimeoutError: 超过重试次数

其他的功能只要不调用url-get的都可以用.. 能在终端里面看到AI已经获取到论文了,但每次在最后都会报这个错。在pycharm和终端里都试过了,但依旧都报错。

Abyss-Seeker commented 1 year ago

image

终端的一部分截图。。如果有帮助的话 :) 谢谢!

Abyss-Seeker commented 1 year ago

是在跑chatgpt-on-wechat的时候遇到的问题

Abyss-Seeker commented 1 year ago

暂时解决,原因是没在tools的config里面开arxiv... 现在不报这个错了但又有新问题了。