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.

Home Page:https://huggingface.co/spaces/JohnSmith9982/ChuanhuChatGPT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

zollty opened this issue · comments

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

  • 我确认没有已有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'

运行环境

  • OS:
  • Browser:
  • Gradio version:
  • Python version:

帮助解决

  • 我愿意协助解决!

补充说明

No response