Langchain-Chatchat
Langchain-Chatchat copied to clipboard
[BUG] 创建知识库时,名称带有“-”号会导致出错
问题描述 / Problem Description 用简洁明了的语言描述这个问题 / Describe the problem in a clear and concise manner. 创建知识库时,名称带有“-”号会导致出错
复现问题的步骤 / Steps to Reproduce
- 在页面上选择创建新的知识库
- 输入知识库名称,其中带有“-”号,例如:esp32-s2技术规格书知识库
- 观察命令行输出的信息,可以发现以下出错提示:
2024-03-09 23:19:13,451 - kb_api.py[line:34] - ERROR: RuntimeError: 创建知识库出错: Error in __cdecl faiss::FileIOWriter::FileIOWriter(const char *) at D:\a\faiss-wheels\faiss-wheels\faiss\faiss\i mpl\io.cpp:98: Error: 'f' failed: could not open D:\My_Doc\PyTorchProj\ChatGLM\Langchain-Chatchat\knowledge_base\esp32-s2技术规格书知识库\vector_store\text2vec\index.faiss for writing: No such file or directory
环境信息 / Environment Information
- langchain-ChatGLM 版本/commit 号:commit 021d635af0137a3ab5f896b5cbfdec1afd4819bf (HEAD -> master, origin/master, origin/HEAD)
- 是否使用 Docker 部署(是/否):否
- 使用的模型(ChatGLM2-6B / Qwen-7B 等):ChatGLM3-6B
- 使用的 Embedding 模型(moka-ai/m3e-base 等):text2vec
- 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss
- 操作系统及版本 / Operating system and version: Win10
- Python 版本 / Python version: 3.10.9
- 其他相关环境信息 / Other relevant environment information: 无
你好,@ngbruce!很高兴再次看到你的反馈。
感谢您的反馈。这个问题可能是由于在创建知识库时,知识库名称中包含特殊字符(如“-”)而导致的。在Langchain-Chatchat的代码中,并没有明确处理或验证知识库名称以允许特殊字符。如果底层数据库或文件系统不支持在名称中使用“-”,或者如果代码库中对知识库名称格式有任何隐含的假设,那么尝试使用包含“-”的名称可能会导致错误。
在Langchain-Chatchat的代码库中,负责创建新知识库的具体函数是create_kb
。这个函数并没有对知识库名称进行特殊字符的验证或处理。因此,如果输入的知识库名称包含特殊字符,应用程序的行为将取决于底层系统的约束,并可能在使用不支持的字符时导致错误。
我发现了一个类似的已关闭问题[BUG] 无法配置知识库,但是它并没有直接解决这个问题。我建议在创建知识库时,尽量避免在名称中使用特殊字符,直到我们找到一个更好的解决方案。
如果您有任何其他问题或需要进一步的帮助,请随时告诉我。
Sources
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
不能用中文名?
是不是知识库名字里不能有中文呢?我记得有提示