GaiZhenbiao / ChuanhuChatGPT

GUI for ChatGPT API and many LLMs. Supports agents, file-based QA, GPT finetuning and query with web search. All with a neat UI.
https://huggingface.co/spaces/JohnSmith9982/ChuanhuChatGPT
GNU General Public License v3.0
15.07k stars 2.28k forks source link

[Bug]: 自动命名文件名引号(")引发错误 #1086

Closed zollty closed 4 months ago

zollty commented 4 months ago

这个bug是否已存在现有issue了?

错误表现

举个例子: name = 'history/"鱼香肉丝制作秘诀:步骤详解川菜烹饪".json'

引发报错原因:文件名中有英文的引号

复现操作

如题

错误日志

File "/root/anaconda3/envs/test/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/root/anaconda3/envs/test/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/anaconda3/envs/test/lib/python3.11/site-packages/gradio/utils.py", line 641, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "/ai/apps/FenghouChat/modules/utils.py", line 144, in set_single_turn
    current_model.set_single_turn(*args)
  File "/ai/apps/FenghouChat/modules/models/base_model.py", line 786, in set_single_turn
    self.auto_save()
  File "/ai/apps/FenghouChat/modules/models/base_model.py", line 898, in auto_save
    save_file(self.history_file_path, self, chatbot)
  File "/ai/apps/FenghouChat/modules/utils.py", line 411, in save_file
    with open(history_file_path, "w", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: 'history/"鱼香肉丝制作秘诀:步骤详解川菜烹饪".json'

运行环境

帮助解决

补充说明

No response