chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
31.9k stars 5.56k forks source link

[BUG] 数据库文件无法打开 / unable to open database file #4889

Open iceyymoon opened 2 months ago

iceyymoon commented 2 months ago

问题描述 / Problem Description 在使用chatchat kb -r 初始化知识库时出现如下数据库错误:

(base) (chatchat-py3.10) PS D:\Langchain-Chatchat-master> chatchat kb -r 2024-08-30 09:36:14.569 | WARNING | chatchat.server.utils:detect_xf_models:104 - auto_detect_model needs xinference-client installed. Please try "pip install xinference-client". 2024-08-30 09:36:14.569 | WARNING | chatchat.server.utils:get_default_llm:205 - default llm model glm4-chat is not found in available llms, using qwen:7b instead 2024-08-30 09:36:14.579 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:14.581 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:14.582 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:14.583 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:16.054 | WARNING | chatchat.server.utils:detect_xf_models:104 - auto_detect_model needs xinference-client installed. Please try "pip install xinference-client". 2024-08-30 09:36:16.054 | WARNING | chatchat.server.utils:get_default_llm:205 - default llm model glm4-chat is not found in available llms, using qwen:7b instead 2024-08-30 09:36:16.067 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:16.069 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:16.072 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:16.074 | WARNING | chatchat.server.utils:get_default_embedding:214 - default embedding model bge-m3 is not found in available embeddings, using quentinz/bge-large-zh-v1.5 instead 2024-08-30 09:36:16.086 | ERROR | chatchat.init_database:worker:61 - (sqlite3.OperationalError) unable to open database file (Background on this error at: https://sqlalche.me/e/20/e3q8)

iceyymoon commented 2 months ago

PS:我单独测试了该数据库文件能否打开,是可以的,如下:

db_path = "D:\info.db"

try:

连接数据库

conn = sqlite3.connect(db_path)
cursor = conn.cursor()

# 查询数据库中所有的表
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()

print("Tables in the database:", tables)
conn.close()

except sqlite3.Error as e: print(f"Error connecting to database: {e}")

运行如下: Tables in the database: [('conversation',), ('message',), ('knowledge_base',), ('knowledge_file',), ('file_doc',), ('summary_chunk',)]

wdmmxlbt commented 1 month ago

请问这个问题有解决嘛?

iceyymoon commented 1 month ago

请问这个问题有解决嘛?

从poetry下载依赖改为用pip,可以了。可能是我之前不会启动poetry的环境。

qixiugang commented 1 week ago

chatchat init chatchat kb -r 就可以了