diff --git a/chatchat-server/poetry.toml b/chatchat-server/poetry.toml
index 42159b24..3b673ef3 100644
--- a/chatchat-server/poetry.toml
+++ b/chatchat-server/poetry.toml
@@ -3,3 +3,7 @@ in-project = true
[installer]
modern-installation = false
+
+[plugins]
+[plugins.pypi_mirror]
+url = "https://pypi.tuna.tsinghua.edu.cn/simple"
diff --git a/chatchat-server/pyproject.toml b/chatchat-server/pyproject.toml
index 070c50fd..38de8c8c 100644
--- a/chatchat-server/pyproject.toml
+++ b/chatchat-server/pyproject.toml
@@ -6,7 +6,7 @@ authors = ["chatchat"]
readme = "README.md"
[tool.poetry.dependencies]
-python = ">=3.8,<4.0,!=3.9.7"
+python = ">=3.8.1,<4.0,!=3.9.7"
chatchat-model-providers = "^0.3.0"
langchain = "0.1.5"
langchainhub = "0.1.14"
@@ -35,9 +35,9 @@ strsimpy = ">=0.2.1"
markdownify = ">=0.11.6"
tqdm = ">=4.66.1"
websockets = ">=12.0"
-numpy = ">=1.26.3"
+numpy = "1.24.4"
pandas = "~2.1.4"
-pydantic = "1.10.14"
+pydantic = "2.6.4"
httpx = {version = ">=0.25.2", extras = ["brotli", "http2", "socks"]}
python-multipart = "0.0.9"
@@ -194,7 +194,7 @@ omit = [
]
[build-system]
-requires = ["poetry-core>=1.0.0"]
+requires = ["poetry-core>=1.0.0", "poetry-plugin-pypi-mirror==0.4.2"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
diff --git a/chatchat/configs/__init__.py b/chatchat/chatchat/configs/__init__.py
similarity index 100%
rename from chatchat/configs/__init__.py
rename to chatchat/chatchat/configs/__init__.py
diff --git a/chatchat/chatchat/configs/basic_config.py b/chatchat/chatchat/configs/basic_config.py
new file mode 100644
index 00000000..61ec7c70
--- /dev/null
+++ b/chatchat/chatchat/configs/basic_config.py
@@ -0,0 +1,47 @@
+import logging
+import os
+from pathlib import Path
+
+import langchain
+
+
+# 是否显示详细日志
+log_verbose = True
+langchain.verbose = log_verbose
+
+# 通常情况下不需要更改以下内容
+
+# 用户数据根目录
+DATA_PATH = str(Path(__file__).absolute().parent.parent / "data")
+if not os.path.exists(DATA_PATH):
+ os.mkdir(DATA_PATH)
+
+# nltk 模型存储路径
+NLTK_DATA_PATH = os.path.join(DATA_PATH, "nltk_data")
+import nltk
+nltk.data.path = [NLTK_DATA_PATH] + nltk.data.path
+
+# 日志格式
+LOG_FORMAT = "%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s"
+logger = logging.getLogger()
+logger.setLevel(logging.INFO)
+logging.basicConfig(format=LOG_FORMAT)
+
+
+# 日志存储路径
+LOG_PATH = os.path.join(DATA_PATH, "logs")
+if not os.path.exists(LOG_PATH):
+ os.mkdir(LOG_PATH)
+
+# 模型生成内容(图片、视频、音频等)保存位置
+MEDIA_PATH = os.path.join(DATA_PATH, "media")
+if not os.path.exists(MEDIA_PATH):
+ os.mkdir(MEDIA_PATH)
+ os.mkdir(os.path.join(MEDIA_PATH, "image"))
+ os.mkdir(os.path.join(MEDIA_PATH, "audio"))
+ os.mkdir(os.path.join(MEDIA_PATH, "video"))
+
+# 临时文件目录,主要用于文件对话
+BASE_TEMP_DIR = os.path.join(DATA_PATH, "temp")
+if not os.path.exists(BASE_TEMP_DIR):
+ os.mkdir(BASE_TEMP_DIR)
diff --git a/chatchat/configs/basic_config.py.example b/chatchat/chatchat/configs/basic_config.py.example
similarity index 100%
rename from chatchat/configs/basic_config.py.example
rename to chatchat/chatchat/configs/basic_config.py.example
diff --git a/chatchat/chatchat/configs/kb_config.py b/chatchat/chatchat/configs/kb_config.py
new file mode 100644
index 00000000..a330e80f
--- /dev/null
+++ b/chatchat/chatchat/configs/kb_config.py
@@ -0,0 +1,148 @@
+import os
+
+from configs.basic_config import DATA_PATH
+
+
+# 默认使用的知识库
+DEFAULT_KNOWLEDGE_BASE = "samples"
+
+# 默认向量库/全文检索引擎类型。可选:faiss, milvus(离线) & zilliz(在线), pgvector,全文检索引擎es
+DEFAULT_VS_TYPE = "faiss"
+
+# 缓存向量库数量(针对FAISS)
+CACHED_VS_NUM = 1
+
+# 缓存临时向量库数量(针对FAISS),用于文件对话
+CACHED_MEMO_VS_NUM = 10
+
+# 知识库中单段文本长度(不适用MarkdownHeaderTextSplitter)
+CHUNK_SIZE = 250
+
+# 知识库中相邻文本重合长度(不适用MarkdownHeaderTextSplitter)
+OVERLAP_SIZE = 50
+
+# 知识库匹配向量数量
+VECTOR_SEARCH_TOP_K = 3
+
+# 知识库匹配相关度阈值,取值范围在0-1之间,SCORE越小,相关度越高,取到1相当于不筛选,建议设置在0.5左右
+SCORE_THRESHOLD = 1
+
+# 默认搜索引擎。可选:bing, duckduckgo, metaphor
+DEFAULT_SEARCH_ENGINE = "metaphor"
+
+# 搜索引擎匹配结题数量
+SEARCH_ENGINE_TOP_K = 3
+
+
+# Bing 搜索必备变量
+# 使用 Bing 搜索需要使用 Bing Subscription Key,需要在azure port中申请试用bing search
+# 具体申请方式请见
+# https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource
+# 使用python创建bing api 搜索实例详见:
+# https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/quickstarts/rest/python
+BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search"
+# 注意不是bing Webmaster Tools的api key,
+
+# 此外,如果是在服务器上,报Failed to establish a new connection: [Errno 110] Connection timed out
+# 是因为服务器加了防火墙,需要联系管理员加白名单,如果公司的服务器的话,就别想了GG
+BING_SUBSCRIPTION_KEY = "b31d23d7b96742ab959f4cc07a605f72"
+
+# metaphor搜索需要KEY
+METAPHOR_API_KEY = "f8c9f98f-141a-4a55-9be7-ae675ccacd7a"
+
+# 心知天气 API KEY,用于天气Agent。申请:https://www.seniverse.com/
+SENIVERSE_API_KEY = ""
+
+# 是否开启中文标题加强,以及标题增强的相关配置
+# 通过增加标题判断,判断哪些文本为标题,并在metadata中进行标记;
+# 然后将文本与往上一级的标题进行拼合,实现文本信息的增强。
+ZH_TITLE_ENHANCE = False
+
+# PDF OCR 控制:只对宽高超过页面一定比例(图片宽/页面宽,图片高/页面高)的图片进行 OCR。
+# 这样可以避免 PDF 中一些小图片的干扰,提高非扫描版 PDF 处理速度
+PDF_OCR_THRESHOLD = (0.6, 0.6)
+
+# 每个知识库的初始化介绍,用于在初始化知识库时显示和Agent调用,没写则没有介绍,不会被Agent调用。
+KB_INFO = {
+ "samples": "关于本项目issue的解答",
+}
+
+
+# 通常情况下不需要更改以下内容
+
+# 知识库默认存储路径
+KB_ROOT_PATH = os.path.join(DATA_PATH, "knowledge_base")
+if not os.path.exists(KB_ROOT_PATH):
+ os.mkdir(KB_ROOT_PATH)
+
+# 数据库默认存储路径。
+# 如果使用sqlite,可以直接修改DB_ROOT_PATH;如果使用其它数据库,请直接修改SQLALCHEMY_DATABASE_URI。
+DB_ROOT_PATH = os.path.join(KB_ROOT_PATH, "info.db")
+SQLALCHEMY_DATABASE_URI = f"sqlite:///{DB_ROOT_PATH}"
+
+# 可选向量库类型及对应配置
+kbs_config = {
+ "faiss": {
+ },
+ "milvus": {
+ "host": "127.0.0.1",
+ "port": "19530",
+ "user": "",
+ "password": "",
+ "secure": False,
+ },
+ "zilliz": {
+ "host": "in01-a7ce524e41e3935.ali-cn-hangzhou.vectordb.zilliz.com.cn",
+ "port": "19530",
+ "user": "",
+ "password": "",
+ "secure": True,
+ },
+ "pg": {
+ "connection_uri": "postgresql://postgres:postgres@127.0.0.1:5432/langchain_chatchat",
+ },
+
+ "es": {
+ "host": "127.0.0.1",
+ "port": "9200",
+ "index_name": "test_index",
+ "user": "",
+ "password": ""
+ },
+ "milvus_kwargs":{
+ "search_params":{"metric_type": "L2"}, #在此处增加search_params
+ "index_params":{"metric_type": "L2","index_type": "HNSW"} # 在此处增加index_params
+ },
+ "chromadb": {}
+}
+
+# TextSplitter配置项,如果你不明白其中的含义,就不要修改。
+text_splitter_dict = {
+ "ChineseRecursiveTextSplitter": {
+ "source": "", ## 选择tiktoken则使用openai的方法
+ "tokenizer_name_or_path": "",
+ },
+ "SpacyTextSplitter": {
+ "source": "",
+ "tokenizer_name_or_path": "",
+ },
+ "RecursiveCharacterTextSplitter": {
+ "source": "tiktoken",
+ "tokenizer_name_or_path": "cl100k_base",
+ },
+ "MarkdownHeaderTextSplitter": {
+ "headers_to_split_on":
+ [
+ ("#", "head1"),
+ ("##", "head2"),
+ ("###", "head3"),
+ ("####", "head4"),
+ ]
+ },
+}
+
+# TEXT_SPLITTER 名称
+TEXT_SPLITTER_NAME = "ChineseRecursiveTextSplitter"
+
+# Embedding模型定制词语的词表文件
+EMBEDDING_KEYWORD_FILE = "embedding_keywords.txt"
diff --git a/chatchat/configs/kb_config.py.example b/chatchat/chatchat/configs/kb_config.py.example
similarity index 100%
rename from chatchat/configs/kb_config.py.example
rename to chatchat/chatchat/configs/kb_config.py.example
diff --git a/chatchat/configs/loom.yaml.example b/chatchat/chatchat/configs/loom.yaml.example
similarity index 100%
rename from chatchat/configs/loom.yaml.example
rename to chatchat/chatchat/configs/loom.yaml.example
diff --git a/chatchat/chatchat/configs/model_config.py b/chatchat/chatchat/configs/model_config.py
new file mode 100644
index 00000000..b0f3c454
--- /dev/null
+++ b/chatchat/chatchat/configs/model_config.py
@@ -0,0 +1,170 @@
+import os
+
+
+# 默认选用的 LLM 名称
+DEFAULT_LLM_MODEL = "qwen"
+
+# 默认选用的 Embedding 名称
+DEFAULT_EMBEDDING_MODEL = "bge"
+
+
+# AgentLM模型的名称 (可以不指定,指定之后就锁定进入Agent之后的Chain的模型,不指定就是LLM_MODELS[0])
+Agent_MODEL = None
+
+# 历史对话轮数
+HISTORY_LEN = 3
+
+# 大模型最长支持的长度,如果不填写,则使用模型默认的最大长度,如果填写,则为用户设定的最大长度
+MAX_TOKENS = None
+
+# LLM通用对话参数
+TEMPERATURE = 0.7
+# TOP_P = 0.95 # ChatOpenAI暂不支持该参数
+
+SUPPORT_AGENT_MODELS = [
+ "chatglm3-6b",
+ "openai-api",
+ "Qwen-14B-Chat",
+ "Qwen-7B-Chat",
+ "qwen",
+]
+
+
+LLM_MODEL_CONFIG = {
+ # 意图识别不需要输出,模型后台知道就行
+ "preprocess_model": {
+ DEFAULT_LLM_MODEL: {
+ "temperature": 0.05,
+ "max_tokens": 4096,
+ "history_len": 100,
+ "prompt_name": "default",
+ "callbacks": False
+ },
+ },
+ "llm_model": {
+ DEFAULT_LLM_MODEL: {
+ "temperature": 0.9,
+ "max_tokens": 4096,
+ "history_len": 10,
+ "prompt_name": "default",
+ "callbacks": True
+ },
+ },
+ "action_model": {
+ DEFAULT_LLM_MODEL: {
+ "temperature": 0.01,
+ "max_tokens": 4096,
+ "callbacks": True
+ },
+ },
+ "postprocess_model": {
+ DEFAULT_LLM_MODEL: {
+ "temperature": 0.01,
+ "max_tokens": 4096,
+ "prompt_name": "default",
+ "callbacks": True
+ }
+ },
+ "image_model": {
+ "sd-turbo": {
+ "size": "256*256",
+ }
+ },
+ "multimodal_model": {
+ "qwen-vl": {}
+ },
+}
+
+# 可以通过 loom/xinference/oneapi/fastchat 启动模型服务,然后将其 URL 和 KEY 配置过来即可。
+# - platform_name 可以任意填写,不要重复即可
+# - platform_type 可选:openai, xinference, oneapi, fastchat。以后可能根据平台类型做一些功能区分
+# - 将框架部署的模型填写到对应列表即可。不同框架可以加载同名模型,项目会自动做负载均衡。
+
+MODEL_PLATFORMS = [
+ # {
+ # "platform_name": "openai-api",
+ # "platform_type": "openai",
+ # "api_base_url": "https://api.openai.com/v1",
+ # "api_key": "sk-yBuaCpqEVUBarBP9700e7224A2D743AeA329334d19C0A336",
+ # "api_proxy": "https://qujhzynu.cloud.sealos.io/v1",
+ # "api_concurrencies": 5,
+ # "llm_models": [
+ # "gpt-3.5-turbo",
+ # ],
+ # "embed_models": [],
+ # "image_models": [],
+ # "multimodal_models": [],
+ # },
+
+ {
+ "platform_name": "xinference",
+ "platform_type": "xinference",
+ "api_base_url": "http://127.0.0.1:9997/v1",
+ "api_key": "EMPTY",
+ "api_concurrencies": 5,
+ # 注意:这里填写的是 xinference 部署的模型 UID,而非模型名称
+ "llm_models": [
+ "qwen",
+ "glm3",
+ ],
+ "embed_models": [
+ "bge",
+ ],
+ "image_models": [
+ "sd-turbo",
+ ],
+ "multimodal_models": [
+ "qwen-vl",
+ ],
+ },
+
+ {
+ "platform_name": "oneapi",
+ "platform_type": "oneapi",
+ "api_base_url": "http://127.0.0.1:3000/v1",
+ "api_key": "sk-Mlft68FXoTYqLfQr06F0E2D77e6e4220B6F420999d25383f",
+ "api_concurrencies": 5,
+ "llm_models": [
+ # 智谱 API
+ "chatglm_pro",
+ "chatglm_turbo",
+ "chatglm_std",
+ "chatglm_lite",
+ # 千问 API
+ "qwen-turbo",
+ "qwen-plus",
+ "qwen-max",
+ "qwen-max-longcontext",
+ # 千帆 API
+ "ERNIE-Bot",
+ "ERNIE-Bot-turbo",
+ "ERNIE-Bot-4",
+ # 星火 API
+ "SparkDesk",
+ ],
+ "embed_models": [
+ # 千问 API
+ "text-embedding-v1",
+ # 千帆 API
+ "Embedding-V1",
+ ],
+ "image_models": [],
+ "multimodal_models": [],
+ },
+
+ # {
+ # "platform_name": "loom",
+ # "platform_type": "loom",
+ # "api_base_url": "http://127.0.0.1:7860/v1",
+ # "api_key": "88296d2f9bbd9ab222c1086e39f5fbb2.FbC0YSrAMcaEF2gB",
+ # "api_concurrencies": 5,
+ # "llm_models": [
+ # "chatglm3-6b",
+ # ],
+ # "embed_models": [],
+ # "image_models": [],
+ # "multimodal_models": [],
+ # },
+]
+
+LOOM_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), "loom.yaml")
diff --git a/chatchat/configs/model_config.py.example b/chatchat/chatchat/configs/model_config.py.example
similarity index 100%
rename from chatchat/configs/model_config.py.example
rename to chatchat/chatchat/configs/model_config.py.example
diff --git a/chatchat/configs/openai-plugins-list.json b/chatchat/chatchat/configs/openai-plugins-list.json
similarity index 100%
rename from chatchat/configs/openai-plugins-list.json
rename to chatchat/chatchat/configs/openai-plugins-list.json
diff --git a/chatchat/chatchat/configs/prompt_config.py b/chatchat/chatchat/configs/prompt_config.py
new file mode 100644
index 00000000..58ce1e0c
--- /dev/null
+++ b/chatchat/chatchat/configs/prompt_config.py
@@ -0,0 +1,209 @@
+PROMPT_TEMPLATES = {
+ "preprocess_model": {
+ "default":
+ '你只要回复0 和 1 ,代表不需要使用工具。以下几种问题不需要使用工具:'
+ '1. 需要联网查询的内容\n'
+ '2. 需要计算的内容\n'
+ '3. 需要查询实时性的内容\n'
+ '如果我的输入满足这几种情况,返回1。其他输入,请你回复0,你只要返回一个数字\n'
+ '这是我的问题:'
+ },
+ "llm_model": {
+ "default":
+ '{{input}}',
+ "with_history":
+ 'The following is a friendly conversation between a human and an AI. '
+ 'The AI is talkative and provides lots of specific details from its context. '
+ 'If the AI does not know the answer to a question, it truthfully says it does not know.\n\n'
+ 'Current conversation:\n'
+ '{history}\n'
+ 'Human: {input}\n'
+ 'AI:',
+ },
+ "action_model": {
+ "GPT-4":
+ 'Answer the following questions as best you can. You have access to the following tools:\n'
+ 'The way you use the tools is by specifying a json blob.\n'
+ 'Specifically, this json should have a `action` key (with the name of the tool to use) and a `action_input` key (with the input to the tool going here).\n'
+ 'The only values that should be in the "action" field are: {tool_names}\n'
+ 'The $JSON_BLOB should only contain a SINGLE action, do NOT return a list of multiple actions. Here is an example of a valid $JSON_BLOB:\n'
+ '```\n\n'
+ '{{{{\n'
+ ' "action": $TOOL_NAME,\n'
+ ' "action_input": $INPUT\n'
+ '}}}}\n'
+ '```\n\n'
+ 'ALWAYS use the following format:\n'
+ 'Question: the input question you must answer\n'
+ 'Thought: you should always think about what to do\n'
+ 'Action:\n'
+ '```\n\n'
+ '$JSON_BLOB'
+ '```\n\n'
+ 'Observation: the result of the action\n'
+ '... (this Thought/Action/Observation can repeat N times)\n'
+ 'Thought: I now know the final answer\n'
+ 'Final Answer: the final answer to the original input question\n'
+ 'Begin! Reminder to always use the exact characters `Final Answer` when responding.\n'
+ 'Question:{input}\n'
+ 'Thought:{agent_scratchpad}\n',
+
+ "ChatGLM3":
+ 'You can answer using the tools.Respond to the human as helpfully and accurately as possible.\n'
+ 'You have access to the following tools:\n'
+ '{tools}\n'
+ 'Use a json blob to specify a tool by providing an action key (tool name)\n'
+ 'and an action_input key (tool input).\n'
+ 'Valid "action" values: "Final Answer" or [{tool_names}]\n'
+ 'Provide only ONE action per $JSON_BLOB, as shown:\n\n'
+ '```\n'
+ '{{{{\n'
+ ' "action": $TOOL_NAME,\n'
+ ' "action_input": $INPUT\n'
+ '}}}}\n'
+ '```\n\n'
+ 'Follow this format:\n\n'
+ 'Question: input question to answer\n'
+ 'Thought: consider previous and subsequent steps\n'
+ 'Action:\n'
+ '```\n'
+ '$JSON_BLOB\n'
+ '```\n'
+ 'Observation: action result\n'
+ '... (repeat Thought/Action/Observation N times)\n'
+ 'Thought: I know what to respond\n'
+ 'Action:\n'
+ '```\n'
+ '{{{{\n'
+ ' "action": "Final Answer",\n'
+ ' "action_input": "Final response to human"\n'
+ '}}}}\n'
+ 'Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary.\n'
+ 'Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.\n'
+ 'Question: {input}\n\n'
+ '{agent_scratchpad}\n',
+ "qwen":
+ 'Answer the following questions as best you can. You have access to the following APIs:\n\n'
+ '{tools}\n\n'
+ 'Use the following format:\n\n'
+ 'Question: the input question you must answer\n'
+ 'Thought: you should always think about what to do\n'
+ 'Action: the action to take, should be one of [{tool_names}]\n'
+ 'Action Input: the input to the action\n'
+ 'Observation: the result of the action\n'
+ '... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\n'
+ 'Thought: I now know the final answer\n'
+ 'Final Answer: the final answer to the original input question\n\n'
+ 'Format the Action Input as a JSON object.\n\n'
+ 'Begin!\n\n'
+ 'Question: {input}\n\n'
+ '{agent_scratchpad}\n\n',
+ "structured-chat-agent":
+ 'Respond to the human as helpfully and accurately as possible. You have access to the following tools:\n\n'
+ '{tools}\n\n'
+ 'Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).\n\n'
+ 'Valid "action" values: "Final Answer" or {tool_names}\n\n'
+ 'Provide only ONE action per $JSON_BLOB, as shown:\n\n'
+ '```\n{{\n "action": $TOOL_NAME,\n "action_input": $INPUT\n}}\n```\n\n'
+ 'Follow this format:\n\n'
+ 'Question: input question to answer\n'
+ 'Thought: consider previous and subsequent steps\n'
+ 'Action:\n```\n$JSON_BLOB\n```\n'
+ 'Observation: action result\n'
+ '... (repeat Thought/Action/Observation N times)\n'
+ 'Thought: I know what to respond\n'
+ 'Action:\n```\n{{\n "action": "Final Answer",\n "action_input": "Final response to human"\n}}\n\n'
+ 'Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation\n'
+ '{input}\n\n'
+ '{agent_scratchpad}\n\n'
+ # '(reminder to respond in a JSON blob no matter what)'
+ },
+ "postprocess_model": {
+ "default": "{{input}}",
+ }
+}
+
+TOOL_CONFIG = {
+ "search_local_knowledgebase": {
+ "use": False,
+ "top_k": 3,
+ "score_threshold": 1,
+ "conclude_prompt": {
+ "with_result":
+ '<指令>根据已知信息,简洁和专业的来回答问题。如果无法从中得到答案,请说 "根据已知信息无法回答该问题",'
+ '不允许在答案中添加编造成分,答案请使用中文。 指令>\n'
+ '<已知信息>{{ context }}已知信息>\n'
+ '<问题>{{ question }}问题>\n',
+ "without_result":
+ '请你根据我的提问回答我的问题:\n'
+ '{{ question }}\n'
+ '请注意,你必须在回答结束后强调,你的回答是根据你的经验回答而不是参考资料回答的。\n',
+ }
+ },
+ "search_internet": {
+ "use": False,
+ "search_engine_name": "bing",
+ "search_engine_config":
+ {
+ "bing": {
+ "result_len": 3,
+ "bing_search_url": "https://api.bing.microsoft.com/v7.0/search",
+ "bing_key": "680a39347d7242c5bd2d7a9576a125b7",
+ },
+ "metaphor": {
+ "result_len": 3,
+ "metaphor_api_key": "",
+ "split_result": False,
+ "chunk_size": 500,
+ "chunk_overlap": 0,
+ },
+ "duckduckgo": {
+ "result_len": 3
+ }
+ },
+ "top_k": 10,
+ "verbose": "Origin",
+ "conclude_prompt":
+ "<指令>这是搜索到的互联网信息,请你根据这些信息进行提取并有调理,简洁的回答问题。如果无法从中得到答案,请说 “无法搜索到能回答问题的内容”。 "
+ "指令>\n<已知信息>{{ context }}已知信息>\n"
+ "<问题>\n"
+ "{{ question }}\n"
+ "问题>\n"
+ },
+ "arxiv": {
+ "use": False,
+ },
+ "shell": {
+ "use": False,
+ },
+ "weather_check": {
+ "use": False,
+ "api-key": "S8vrB4U_-c5mvAMiK",
+ },
+ "search_youtube": {
+ "use": False,
+ },
+ "wolfram": {
+ "use": False,
+ },
+ "calculate": {
+ "use": False,
+ },
+ "vqa_processor": {
+ "use": False,
+ "model_path": "your model path",
+ "tokenizer_path": "your tokenizer path",
+ "device": "cuda:1"
+ },
+ "aqa_processor": {
+ "use": False,
+ "model_path": "your model path",
+ "tokenizer_path": "yout tokenizer path",
+ "device": "cuda:2"
+ },
+
+ "text2images": {
+ "use": False,
+ },
+
+}
diff --git a/chatchat/configs/prompt_config.py.example b/chatchat/chatchat/configs/prompt_config.py.example
similarity index 100%
rename from chatchat/configs/prompt_config.py.example
rename to chatchat/chatchat/configs/prompt_config.py.example
diff --git a/chatchat/chatchat/configs/server_config.py b/chatchat/chatchat/configs/server_config.py
new file mode 100644
index 00000000..40485250
--- /dev/null
+++ b/chatchat/chatchat/configs/server_config.py
@@ -0,0 +1,25 @@
+import sys
+
+
+# httpx 请求默认超时时间(秒)。如果加载模型或对话较慢,出现超时错误,可以适当加大该值。
+HTTPX_DEFAULT_TIMEOUT = 300.0
+
+# API 是否开启跨域,默认为False,如果需要开启,请设置为True
+# is open cross domain
+OPEN_CROSS_DOMAIN = True
+
+# 各服务器默认绑定host。如改为"0.0.0.0"需要修改下方所有XX_SERVER的host
+DEFAULT_BIND_HOST = "127.0.0.1" if sys.platform != "win32" else "127.0.0.1"
+
+
+# webui.py server
+WEBUI_SERVER = {
+ "host": DEFAULT_BIND_HOST,
+ "port": 8501,
+}
+
+# api.py server
+API_SERVER = {
+ "host": DEFAULT_BIND_HOST,
+ "port": 7861,
+}
diff --git a/chatchat/configs/server_config.py.example b/chatchat/chatchat/configs/server_config.py.example
similarity index 100%
rename from chatchat/configs/server_config.py.example
rename to chatchat/chatchat/configs/server_config.py.example
diff --git a/chatchat/copy_config_example.py b/chatchat/chatchat/copy_config_example.py
similarity index 100%
rename from chatchat/copy_config_example.py
rename to chatchat/chatchat/copy_config_example.py
diff --git a/chatchat/chatchat/data/knowledge_base/info.db b/chatchat/chatchat/data/knowledge_base/info.db
new file mode 100644
index 00000000..95597ecf
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/info.db differ
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/README.md b/chatchat/chatchat/data/knowledge_base/samples/content/README.md
new file mode 100644
index 00000000..67aa6ef8
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/README.md
@@ -0,0 +1,159 @@
+
+
+
+🌍 [READ THIS IN ENGLISH](README_en.md)
+
+📃 **LangChain-Chatchat** (原 Langchain-ChatGLM)
+
+基于 ChatGLM 等大语言模型与 Langchain 等应用框架实现,开源、可离线部署的检索增强生成(RAG)大模型知识库项目。
+
+---
+
+## 目录
+
+* [介绍](README.md#介绍)
+* [解决的痛点](README.md#解决的痛点)
+* [快速上手](README.md#快速上手)
+ * [1. 环境配置](README.md#1-环境配置)
+ * [2. 模型下载](README.md#2-模型下载)
+ * [3. 初始化知识库和配置文件](README.md#3-初始化知识库和配置文件)
+ * [4. 一键启动](README.md#4-一键启动)
+ * [5. 启动界面示例](README.md#5-启动界面示例)
+* [联系我们](README.md#联系我们)
+
+
+## 介绍
+
+🤖️ 一种利用 [langchain](https://github.com/hwchase17/langchain) 思想实现的基于本地知识库的问答应用,目标期望建立一套对中文场景与开源模型支持友好、可离线运行的知识库问答解决方案。
+
+💡 受 [GanymedeNil](https://github.com/GanymedeNil) 的项目 [document.ai](https://github.com/GanymedeNil/document.ai) 和 [AlexZhangji](https://github.com/AlexZhangji) 创建的 [ChatGLM-6B Pull Request](https://github.com/THUDM/ChatGLM-6B/pull/216) 启发,建立了全流程可使用开源模型实现的本地知识库问答应用。本项目的最新版本中通过使用 [FastChat](https://github.com/lm-sys/FastChat) 接入 Vicuna, Alpaca, LLaMA, Koala, RWKV 等模型,依托于 [langchain](https://github.com/langchain-ai/langchain) 框架支持通过基于 [FastAPI](https://github.com/tiangolo/fastapi) 提供的 API 调用服务,或使用基于 [Streamlit](https://github.com/streamlit/streamlit) 的 WebUI 进行操作。
+
+✅ 依托于本项目支持的开源 LLM 与 Embedding 模型,本项目可实现全部使用**开源**模型**离线私有部署**。与此同时,本项目也支持 OpenAI GPT API 的调用,并将在后续持续扩充对各类模型及模型 API 的接入。
+
+⛓️ 本项目实现原理如下图所示,过程包括加载文件 -> 读取文本 -> 文本分割 -> 文本向量化 -> 问句向量化 -> 在文本向量中匹配出与问句向量最相似的 `top k`个 -> 匹配出的文本作为上下文和问题一起添加到 `prompt`中 -> 提交给 `LLM`生成回答。
+
+📺 [原理介绍视频](https://www.bilibili.com/video/BV13M4y1e7cN/?share_source=copy_web&vd_source=e6c5aafe684f30fbe41925d61ca6d514)
+
+
+
+从文档处理角度来看,实现流程如下:
+
+
+
+🚩 本项目未涉及微调、训练过程,但可利用微调或训练对本项目效果进行优化。
+
+🌐 [AutoDL 镜像](https://www.codewithgpu.com/i/chatchat-space/Langchain-Chatchat/Langchain-Chatchat) 中 `v11` 版本所使用代码已更新至本项目 `v0.2.7` 版本。
+
+🐳 [Docker 镜像](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.6) 已经更新到 ```0.2.7``` 版本。
+
+🌲 一行命令运行 Docker :
+
+```shell
+docker run -d --gpus all -p 80:8501 registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.7
+```
+
+🧩 本项目有一个非常完整的[Wiki](https://github.com/chatchat-space/Langchain-Chatchat/wiki/) , README只是一个简单的介绍,__仅仅是入门教程,能够基础运行__。 如果你想要更深入的了解本项目,或者想对本项目做出贡献。请移步 [Wiki](https://github.com/chatchat-space/Langchain-Chatchat/wiki/) 界面
+
+## 解决的痛点
+
+该项目是一个可以实现 __完全本地化__推理的知识库增强方案, 重点解决数据安全保护,私域化部署的企业痛点。
+本开源方案采用```Apache License```,可以免费商用,无需付费。
+
+我们支持市面上主流的本地大预言模型和Embedding模型,支持开源的本地向量数据库。
+支持列表详见[Wiki](https://github.com/chatchat-space/Langchain-Chatchat/wiki/)
+
+
+## 快速上手
+
+### 1. 环境配置
+
++ 首先,确保你的机器安装了 Python 3.8 - 3.10
+```
+$ python --version
+Python 3.10.12
+```
+接着,创建一个虚拟环境,并在虚拟环境内安装项目的依赖
+```shell
+
+# 拉取仓库
+$ git clone https://github.com/chatchat-space/Langchain-Chatchat.git
+
+# 进入目录
+$ cd Langchain-Chatchat
+
+# 安装全部依赖
+$ pip install -r requirements.txt
+$ pip install -r requirements_api.txt
+$ pip install -r requirements_webui.txt
+
+# 默认依赖包括基本运行环境(FAISS向量库)。如果要使用 milvus/pg_vector 等向量库,请将 requirements.txt 中相应依赖取消注释再安装。
+```
+### 2, 模型下载
+
+如需在本地或离线环境下运行本项目,需要首先将项目所需的模型下载至本地,通常开源 LLM 与 Embedding 模型可以从 [HuggingFace](https://huggingface.co/models) 下载。
+
+以本项目中默认使用的 LLM 模型 [THUDM/ChatGLM2-6B](https://huggingface.co/THUDM/chatglm2-6b) 与 Embedding 模型 [moka-ai/m3e-base](https://huggingface.co/moka-ai/m3e-base) 为例:
+
+下载模型需要先[安装 Git LFS](https://docs.github.com/zh/repositories/working-with-files/managing-large-files/installing-git-large-file-storage),然后运行
+
+```Shell
+$ git lfs install
+$ git clone https://huggingface.co/THUDM/chatglm2-6b
+$ git clone https://huggingface.co/moka-ai/m3e-base
+```
+### 3. 初始化知识库和配置文件
+
+按照下列方式初始化自己的知识库和简单的复制配置文件
+```shell
+$ python copy_config_example.py
+$ python init_database.py --recreate-vs
+ ```
+### 4. 一键启动
+
+按照以下命令启动项目
+```shell
+$ python startup.py -a
+```
+### 5. 启动界面示例
+
+如果正常启动,你将能看到以下界面
+
+1. FastAPI Docs 界面
+
+
+
+2. Web UI 启动界面示例:
+
+- Web UI 对话界面:
+
+
+
+- Web UI 知识库管理页面:
+
+
+
+
+### 注意
+
+以上方式只是为了快速上手,如果需要更多的功能和自定义启动方式 ,请参考[Wiki](https://github.com/chatchat-space/Langchain-Chatchat/wiki/)
+
+
+---
+## 项目里程碑
+
+
+---
+## 联系我们
+### Telegram
+[](https://t.me/+RjliQ3jnJ1YyN2E9)
+
+### 项目交流群
+
+
+🎉 Langchain-Chatchat 项目微信交流群,如果你也对本项目感兴趣,欢迎加入群聊参与讨论交流。
+
+### 公众号
+
+
+
+🎉 Langchain-Chatchat 项目官方公众号,欢迎扫码关注。
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-124076-270516.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-124076-270516.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-124076-270516.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-124076-270516.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-20096-279847.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-20096-279847.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-20096-279847.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-20096-279847.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-220157-552735.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-220157-552735.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-220157-552735.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-220157-552735.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-36114-765327.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-36114-765327.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-36114-765327.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-36114-765327.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-392521-261326.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-392521-261326.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-392521-261326.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-392521-261326.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-42284-124759.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-42284-124759.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-42284-124759.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-42284-124759.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-57107-679259.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-57107-679259.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-57107-679259.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-57107-679259.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-618350-869132.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-618350-869132.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-618350-869132.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-618350-869132.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-838373-426344.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-838373-426344.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-838373-426344.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-838373-426344.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-906937-836104.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-906937-836104.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-906937-836104.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/分布式训练技术原理-幕布图片-906937-836104.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-108319-429731.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-108319-429731.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-108319-429731.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-108319-429731.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-580318-260070.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-580318-260070.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-580318-260070.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-580318-260070.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-793118-735987.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-793118-735987.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-793118-735987.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-793118-735987.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-918388-323086.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-918388-323086.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-918388-323086.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型应用技术原理-幕布图片-918388-323086.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-19929-302935.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-19929-302935.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-19929-302935.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-19929-302935.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-299768-254064.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-299768-254064.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-299768-254064.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-299768-254064.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-454007-940199.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-454007-940199.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-454007-940199.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-454007-940199.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-628857-182232.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-628857-182232.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-628857-182232.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-628857-182232.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-729151-372321.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-729151-372321.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-729151-372321.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-729151-372321.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-81470-404273.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-81470-404273.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-81470-404273.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型技术栈-算法与原理-幕布图片-81470-404273.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-17565-176537.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-17565-176537.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-17565-176537.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-17565-176537.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-349153-657791.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-349153-657791.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-349153-657791.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-349153-657791.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-350029-666381.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-350029-666381.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-350029-666381.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-350029-666381.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-759487-923925.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-759487-923925.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-759487-923925.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-759487-923925.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-805089-731888.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-805089-731888.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-805089-731888.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-805089-731888.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-95996-523276.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-95996-523276.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-95996-523276.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型指令对齐训练原理-幕布图片-95996-523276.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-276446-401476.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-276446-401476.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-276446-401476.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-276446-401476.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-380552-579242.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-380552-579242.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-380552-579242.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-380552-579242.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-590671-36787.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-590671-36787.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-590671-36787.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-590671-36787.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-699343-219844.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-699343-219844.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-699343-219844.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-699343-219844.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-789705-122117.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-789705-122117.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-789705-122117.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-789705-122117.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-923924-83386.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-923924-83386.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-923924-83386.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-923924-83386.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-930255-616209.jpg b/chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-930255-616209.jpg
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-930255-616209.jpg
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/img/大模型推理优化策略-幕布图片-930255-616209.jpg
diff --git a/chatchat/data/knowledge_base/samples/content/llm/分布式训练技术原理.md b/chatchat/chatchat/data/knowledge_base/samples/content/llm/分布式训练技术原理.md
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/分布式训练技术原理.md
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/分布式训练技术原理.md
diff --git a/chatchat/data/knowledge_base/samples/content/llm/大模型应用技术原理.md b/chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型应用技术原理.md
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/大模型应用技术原理.md
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型应用技术原理.md
diff --git a/chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-实战与应用.md b/chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-实战与应用.md
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-实战与应用.md
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-实战与应用.md
diff --git a/chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-算法与原理.md b/chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-算法与原理.md
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-算法与原理.md
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型技术栈-算法与原理.md
diff --git a/chatchat/data/knowledge_base/samples/content/llm/大模型指令对齐训练原理.md b/chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型指令对齐训练原理.md
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/大模型指令对齐训练原理.md
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型指令对齐训练原理.md
diff --git a/chatchat/data/knowledge_base/samples/content/llm/大模型推理优化策略.md b/chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型推理优化策略.md
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/llm/大模型推理优化策略.md
rename to chatchat/chatchat/data/knowledge_base/samples/content/llm/大模型推理优化策略.md
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.csv b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.csv
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.csv
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.csv
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.jsonl b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.jsonl
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.jsonl
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.jsonl
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.xlsx b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.xlsx
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.xlsx
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_closed.xlsx
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.csv b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.csv
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.csv
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.csv
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.jsonl b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.jsonl
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.jsonl
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.jsonl
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.xlsx b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.xlsx
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.xlsx
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain-ChatGLM_open.xlsx
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/langchain.pdf b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain.pdf
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/langchain.pdf
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/langchain.pdf
diff --git a/chatchat/data/knowledge_base/samples/content/test_files/test.txt b/chatchat/chatchat/data/knowledge_base/samples/content/test_files/test.txt
similarity index 100%
rename from chatchat/data/knowledge_base/samples/content/test_files/test.txt
rename to chatchat/chatchat/data/knowledge_base/samples/content/test_files/test.txt
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/webui2.py b/chatchat/chatchat/data/knowledge_base/samples/content/webui2.py
new file mode 100644
index 00000000..b2637adc
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/webui2.py
@@ -0,0 +1,237 @@
+from nicegui import ui, Client, app, run
+from nicegui.events import ValueChangeEventArguments
+from configs import (VERSION, LLM_MODELS, TEMPERATURE, HISTORY_LEN,
+ VECTOR_SEARCH_TOP_K, SEARCH_ENGINE_TOP_K)
+from webui_pages.utils import AsyncApiRequest
+import asyncio
+from typing import Any, List, Dict, Any
+
+
+app.add_static_files("/image", "img")
+
+
+class Session:
+ def __init__(self) -> None:
+ user = app.storage.user
+ for k, v in self._attrs().items():
+ user.setdefault(k, v)
+
+ def _attrs(self) -> Dict[str, Any]:
+ return {
+ "messages": [],
+ "query": "",
+ "thinking": False,
+ "cur_kb": "",
+ "cur_temperature": TEMPERATURE,
+ "chat_list": [],
+ "cur_chat": "",
+ }
+
+ @property
+ def user(self):
+ return app.storage.user
+
+ def __getattr__(self, attr: str) -> Any:
+ if attr in self._attrs():
+ return self.user[attr]
+ else:
+ raise AttributeError(attr)
+
+ def __setattr__(self, attr: str, val: Any) -> None:
+ if attr in self._attrs():
+ self.user[attr] = val
+ else:
+ raise AttributeError(attr)
+
+
+def make_header(left_drawer, right_drawer):
+ with ui.header().classes("bg-black p-2") as header:
+ with ui.link():
+ ui.icon("menu", size="md").on("click", lambda: left_drawer.toggle())
+ ui.image("img/logo-long-chatchat-trans-v2.png").props("fit=scale-down").classes("h-8 w-48 float-left")
+ left_header = ui.row().props('id="left-header"')
+ ui.element("q-space")
+ right_header = ui.row().props('id="right-header"')
+ ui.label(f"(Version: {VERSION})").classes("text-grey text-xs pt-4")
+ with ui.link():
+ ui.icon("menu", size="md").on("click", lambda: right_drawer.toggle())
+ return left_header, right_header
+
+
+def make_left_drawer(links: List, current: str):
+ with ui.left_drawer(bordered=True, elevated=True) as drawer:
+ return drawer
+
+
+@ui.refreshable
+async def output_messages():
+ session = Session()
+
+ for msg in session.messages:
+ is_user = msg["role"] == "user"
+ if is_user:
+ name = "User"
+ avatar = "/image/user_avatar.png"
+ else:
+ name = "AI"
+ avatar = "/image/chatchat_icon_blue_square_v2.png"
+ ele = ui.chat_message([], sent=False, name=None, avatar=avatar)
+ with ele.add_slot("default"):
+ ui.markdown(msg["content"])
+
+ ui.query("img.q-message-avatar").classes("self-start")
+ (ui.query("div.q-message-text--received")
+ .classes("bg-green-100")
+ .style("border-radius: 5px;"))
+ # (ui.query("div.q-message-text--received")
+ # .run_method("remove_classes", ["q-message-text--received"]))
+ # await ui.run_javascript("window.sc")
+
+
+@ui.page("/", title="Langchain-Chatchat WebUI")
+async def index(client: Client):
+ ui.add_head_html('''''')
+
+ async def send():
+ question = query.value.strip()
+ query.value = ""
+
+ if not question:
+ return
+
+ if question == "/clear":
+ session.messages = []
+ output_messages.refresh()
+ return
+
+ session.thinking = True
+ session.messages.append({"role": "user", "content": question})
+ session.messages.append({"role": "assistant", "content": "Thinking..."})
+ output_messages.refresh()
+ await asyncio.sleep(0.1)
+
+ text = ""
+ async for chunk in api.chat_chat(question,
+ stream=True,
+ conversation_id=None,
+ model=cur_llm_model.value,
+ temperature=temperature.value):
+ text += chunk.get("text", "")
+ tail = " ▌"
+ if text.count("```") % 2 == 1:
+ if text[-1] != "`":
+ tail += "\n```\n"
+ elif text[-2:] == "``":
+ tail += "`\n"
+ elif text[-1:] == "`":
+ tail += "``\n"
+ session.messages[-1]["content"] = text + tail
+ output_messages.refresh()
+ await asyncio.sleep(0.1)
+
+ session.messages[-1]["content"] = text
+ output_messages.refresh()
+ await asyncio.sleep(0.1)
+ session.thinking = False
+
+ session = Session()
+ api = AsyncApiRequest()
+
+ left_drawer = make_left_drawer([], "")
+
+ with ui.right_drawer(bordered=True, elevated=True) as right_drawer:
+ ui.markdown("### 灵感大全")
+ user_name = ui.input("用户名称", value="用户")
+ system_message = (ui.input("AI系统消息",
+ value="你是一个聪明的人工智能助手,可以回答用户提出的问题。")
+ .props("autogrow"))
+ chat_image = ui.upload(label="上传图片").classes("w-full mt-5")
+ chat_file = ui.upload(label="上传文件").classes("w-full mt-5")
+
+ left_header, right_header = make_header(left_drawer, right_drawer)
+
+ with left_header:
+ chat_session = (ui.radio(["会话1", "会话2"], value="会话1")
+ .props("inline")
+ .classes("p-0"))
+
+ with left_drawer:
+ ui.markdown("### 配置项")
+
+ def on_chat_mode_change(e: ValueChangeEventArguments):
+ if e.value == "Agent对话":
+ session.cur_temperature = temperature.value
+ temperature.set_value(0.01)
+ else:
+ temperature.set_value(session.cur_temperature)
+
+ chat_mode = ui.select(["LLM 对话", "知识库问答", "搜索引擎问答", "Agent对话"],
+ label="对话模式",
+ value="LLM 对话",
+ on_change=on_chat_mode_change,
+ )
+ ui.separator()
+
+ with ui.expansion("模型配置", icon="psychology", value=True):
+ running_models = await api.list_running_models()
+ config_models = await api.list_config_models()
+ models = {x: f"{x}(running)" for x in running_models}
+ for v in config_models.values():
+ for m in v:
+ if m not in running_models:
+ models.update({m: m})
+ cur_llm_model = ui.select(models, label="LLM模型", value=LLM_MODELS[0], with_input=True, clearable=True)
+ temperature = ui.number("Temperature", value=TEMPERATURE, min=0, max=1, step=0.01)
+ history_len = ui.number("历史对话轮数", value=HISTORY_LEN, min=0, max=10)
+
+ with (ui.expansion("知识库配置", icon="book", value=True)
+ .bind_visibility_from(chat_mode, "value", value="知识库问答")):
+ def on_kb_change(e: ValueChangeEventArguments):
+ session.cur_kb = e.value
+
+ kb_names = await api.list_knowledge_bases()
+ kb_name = ui.select(kb_names,
+ label="知识库",
+ value=session.cur_kb or kb_names[0],
+ on_change=on_kb_change,
+ )
+ vector_top_k = ui.number("Top K", value=VECTOR_SEARCH_TOP_K, min=1, max=10)
+
+ with (ui.expansion("搜索引擎配置", icon="travel_explore", value=True)
+ .bind_visibility_from(chat_mode, "value", value="搜索引擎问答")):
+ search_engine = ui.select(["Bing", "Duckduckgo"], value="Bing")
+ search_top_k = ui.number("Top K", value=SEARCH_ENGINE_TOP_K, min=1, max=10)
+
+ await client.connected()
+ with ui.column():
+ await output_messages()
+
+ with ui.row().classes("absolute bottom-2 left-20 right-20"):
+ # command = ui.select(["/clear", "/upload"]).classes("w-1/4")
+ query = (ui.input(autocomplete=["/clear", "/upload"],
+ placeholder="input your question here.")
+ .classes("flex-grow")
+ .props('autogrow outlined autofocus counter dense clearable')
+ .bind_value(session, "query")
+ .on("keydown.enter.prevent", send)
+ )
+ with query.add_slot("after"):
+ ui.button(icon="send", on_click=send).classes("self-center").props("small dense p-0 m-0")
+ # query._props["autofocus"] = True
+ # query._props["autogrow"] = True
+ # query._props["placeholder"] = "input your question here."
+ # query._props[":list"] = '["/clear", "/upload"]'
+ # query._props["shadow-text"] = ["/clear", "/upload"]
+ # ui.input(autocomplete=["/clear", "/upload"])
+
+
+
+# TODO:
+# 右侧栏上下文:system_message, picture, file, 知识库文档预览
+
+
+if __name__ in {"__main__", "__mp_main__"}:
+ ui.run(port=5000, storage_secret="111111", reload=True)
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/wiki/Home.md b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/Home.md
new file mode 100644
index 00000000..71a324cb
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/Home.md
@@ -0,0 +1,74 @@
+
+
+
+> 欢迎来到 Langchain‐Chatchat 的 Wiki , 在这里开启 Langchain 与大模型的邂逅!
+
+
+## 项目简介
+
+📃 **LangChain-Chatchat** (原 Langchain-ChatGLM): 基于 Langchain 与 ChatGLM 等大语言模型的本地知识库问答应用实现。
+
+🤖️ 一种利用 [langchain](https://github.com/hwchase17/langchain) 思想实现的基于本地知识库的问答应用,目标期望建立一套对中文场景与开源模型支持友好、可离线运行的知识库问答解决方案。
+
+💡 受 [GanymedeNil](https://github.com/GanymedeNil) 的项目 [document.ai](https://github.com/GanymedeNil/document.ai) 和 [AlexZhangji](https://github.com/AlexZhangji) 创建的 [ChatGLM-6B Pull Request](https://github.com/THUDM/ChatGLM-6B/pull/216) 启发,建立了全流程可使用开源模型实现的本地知识库问答应用。本项目的最新版本中通过使用 [FastChat](https://github.com/lm-sys/FastChat) 接入 Vicuna, Alpaca, LLaMA, Koala, RWKV 等模型,依托于 [langchain](https://github.com/langchain-ai/langchain) 框架支持通过基于 [FastAPI](https://github.com/tiangolo/fastapi) 提供的 API 调用服务,或使用基于 [Streamlit](https://github.com/streamlit/streamlit) 的 WebUI 进行操作。
+
+✅ 依托于本项目支持的开源 LLM 与 Embedding 模型,本项目可实现全部使用**开源**模型**离线私有部署**。与此同时,本项目也支持 OpenAI GPT API 的调用,并将在后续持续扩充对各类模型及模型 API 的接入。
+
+⛓️ 本项目实现原理如下图所示,过程包括加载文件 -> 读取文本 -> 文本分割 -> 文本向量化 -> 问句向量化 -> 在文本向量中匹配出与问句向量最相似的 `top k`个 -> 匹配出的文本作为上下文和问题一起添加到 `prompt`中 -> 提交给 `LLM`生成回答。
+
+
+## 算法流程
+
+大家可以前往Bilibili平台查看原理介绍视频:
+
+📺 [原理介绍视频](https://www.bilibili.com/video/BV13M4y1e7cN/?share_source=copy_web&vd_source=e6c5aafe684f30fbe41925d61ca6d514)
+
+开发组也为大家绘制了一张实现原理图,效果如下:
+
+
+
+从文档处理角度来看,实现流程如下:
+
+
+
+
+## 技术路线图(截止0.2.10)
+
+- [X] Langchain 应用
+ - [X] 本地数据接入
+ - [X] 接入非结构化文档
+ - [X] .txt, .rtf, .epub, .srt
+ - [X] .eml, .msg
+ - [X] .html, .xml, .toml, .mhtml
+ - [X] .json, .jsonl
+ - [X] .md, .rst
+ - [X] .docx, .doc, .pptx, .ppt, .odt
+ - [X] .enex
+ - [X] .pdf
+ - [X] .jpg, .jpeg, .png, .bmp
+ - [X] .py, .ipynb
+ - [X] 结构化数据接入
+ - [X] .csv, .tsv
+ - [X] .xlsx, .xls, .xlsd
+ - [X] 分词及召回
+ - [X] 接入不同类型 TextSplitter
+ - [X] 优化依据中文标点符号设计的 ChineseTextSplitter
+ - [X] 搜索引擎接入
+ - [X] Bing 搜索
+ - [X] DuckDuckGo 搜索
+ - [X] Metaphor 搜索
+ - [X] Agent 实现
+ - [X] 基础React形式的Agent实现,包括调用计算器等
+ - [X] Langchain 自带的Agent实现和调用
+ - [X] 智能调用不同的数据库和联网知识
+- [X] LLM 模型接入
+ - [X] 支持通过调用 [FastChat](https://github.com/lm-sys/fastchat) api 调用 llm
+ - [X] 支持 ChatGLM API 等 LLM API 的接入
+ - [X] 支持 Langchain 框架支持的LLM API 接入
+- [X] Embedding 模型接入
+ - [X] 支持调用 HuggingFace 中各开源 Emebdding 模型
+ - [X] 支持 OpenAI Embedding API 等 Embedding API 的接入
+ - [X] 支持 智谱AI、百度千帆、千问、MiniMax 等在线 Embedding API 的接入
+- [X] 基于 FastAPI 的 API 方式调用
+- [X] Web UI
+ - [X] 基于 Streamlit 的 Web UI
\ No newline at end of file
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/wiki/_Sidebar.md b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/_Sidebar.md
new file mode 100644
index 00000000..6d7fb6f6
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/_Sidebar.md
@@ -0,0 +1,58 @@
+__导航栏,一切从这里出发__
+## [Home](https://github.com/chatchat-space/Langchain-Chatchat/wiki)
+## [支持列表](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8)
+* [LLM 模型支持列表](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8#llm-%E6%A8%A1%E5%9E%8B%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8)
+* [Embedding 模型支持列表](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8#embedding-%E6%A8%A1%E5%9E%8B%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8)
+* [分词器支持列表](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8#%E5%88%86%E8%AF%8D%E5%99%A8%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8)
+* [向量数据库支持列表](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8#%E5%90%91%E9%87%8F%E6%95%B0%E6%8D%AE%E5%BA%93%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8)
+* [工具支持列表](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8#%E5%B7%A5%E5%85%B7%E6%94%AF%E6%8C%81%E5%88%97%E8%A1%A8)
+
+## [开发环境部署](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2)
+
+### 前期准备
+ * [软件要求](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E8%BD%AF%E4%BB%B6%E8%A6%81%E6%B1%82)
+ * [硬件要求](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E7%A1%AC%E4%BB%B6%E8%A6%81%E6%B1%82)
+ * [VPN](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#vpn)
+
+### 部署代码
+ * [Docker 部署](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#docker-%E9%83%A8%E7%BD%B2)
+ * [最轻模式部署方案](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E6%9C%80%E8%BD%BB%E6%A8%A1%E5%BC%8F%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E6%96%B9%E6%A1%88)
+ * [常规模式本地部署方案](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E5%B8%B8%E8%A7%84%E6%A8%A1%E5%BC%8F%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E6%96%B9%E6%A1%88)
+ + [环境安装](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E6%9C%AC%E5%9C%B0%E9%83%A8%E7%BD%B2%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85)
+ + [模型下载](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E6%A8%A1%E5%9E%8B%E4%B8%8B%E8%BD%BD)
+ + [初始化知识库](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E5%88%9D%E5%A7%8B%E5%8C%96%E7%9F%A5%E8%AF%86%E5%BA%93)
+ + [一键启动](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E4%B8%80%E9%94%AE%E5%90%AF%E5%8A%A8)
+ + [多卡加载](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E9%83%A8%E7%BD%B2#%E5%A4%9A%E5%8D%A1%E5%8A%A0%E8%BD%BD)
+
+## [参数配置](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE)
+
+* [基础配置项 basic_config.py](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE#%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE%E9%A1%B9-basic_configpy)
+* [模型配置项 model_config.py](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE#%E6%A8%A1%E5%9E%8B%E9%85%8D%E7%BD%AE%E9%A1%B9-model_configpy)
+* [提示词配置项 prompt_config.py](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE#%E6%8F%90%E7%A4%BA%E8%AF%8D%E9%85%8D%E7%BD%AE%E9%A1%B9-prompt_configpy)
+* [数据库配置 kb_config.py](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE#%E6%95%B0%E6%8D%AE%E5%BA%93%E9%85%8D%E7%BD%AE-kb_configpy)
+* [服务和端口配置项 server_config.py](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE#%E6%9C%8D%E5%8A%A1%E5%92%8C%E7%AB%AF%E5%8F%A3%E9%85%8D%E7%BD%AE%E9%A1%B9-server_configpy)
+* [覆盖配置文件 或者配置 startup.py](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE#%E8%A6%86%E7%9B%96%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-%E6%88%96%E8%80%85%E9%85%8D%E7%BD%AE-startuppy)
+
+## [自定义](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89)
+
+* [使用自定义的分词器](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E5%88%86%E8%AF%8D%E5%99%A8)
+* [使用自定义的 Agent 工具](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84-agent-%E5%B7%A5%E5%85%B7)
+* [使用自定义的微调模型](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E5%BE%AE%E8%B0%83%E6%A8%A1%E5%9E%8B)
+* [使用自定义的嵌入模型](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89#%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E5%B5%8C%E5%85%A5%E6%A8%A1%E5%9E%8B)
+* [日志功能](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5#%E6%97%A5%E5%BF%97%E5%8A%9F%E8%83%BD)
+
+## [最佳实践](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5)
+* [推荐的模型组合](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5#%E6%8E%A8%E8%8D%90%E7%9A%84%E6%A8%A1%E5%9E%8B%E7%BB%84%E5%90%88)
+* [微调模型加载实操](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5#%E5%BE%AE%E8%B0%83%E6%A8%A1%E5%9E%8B%E5%8A%A0%E8%BD%BD%E5%AE%9E%E6%93%8D)
+* [预处理知识库文件](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5#%E9%A2%84%E5%A4%84%E7%90%86%E7%9F%A5%E8%AF%86%E5%BA%93%E6%96%87%E4%BB%B6)
+* [自定义的关键词调整Embedding模型](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E5%85%B3%E9%94%AE%E8%AF%8D%E8%B0%83%E6%95%B4embedding%E6%A8%A1%E5%9E%8B)
+* [实际使用效果](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5#%E5%AE%9E%E9%99%85%E4%BD%BF%E7%94%A8%E6%95%88%E6%9E%9C)
+
+## [做出贡献](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%81%9A%E5%87%BA%E8%B4%A1%E7%8C%AE)
+
+* [Issue 规范](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%81%9A%E5%87%BA%E8%B4%A1%E7%8C%AE#issue-%E8%A7%84%E8%8C%83)
+* [PR 规范](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%81%9A%E5%87%BA%E8%B4%A1%E7%8C%AE#pr-%E8%A7%84%E8%8C%83)
+
+## [合作伙伴](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%90%88%E4%BD%9C%E4%BC%99%E4%BC%B4)
+
+## [常见问题](https://github.com/chatchat-space/Langchain-Chatchat/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
\ No newline at end of file
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/wiki/做出贡献.md b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/做出贡献.md
new file mode 100644
index 00000000..50d73b7f
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/做出贡献.md
@@ -0,0 +1,51 @@
+## Issue 规范
+> 什么样的 issue 是不会被回复的
+
+1. 在提出issue前,请查看您的提出的问题是否已经在 issue 列表或者 discussion 内出现,提出重复的问题将 **被关闭** 。
+2. 非项目推荐配置的任何关于环境配置问题的 issue 通常将 **不会由官方回复**,请您在微信沟通群内咨询。
+3. 与项目无关的 issue 将 **不会被回复** 。
+4. 超过30天没有更新动态的 issue 将 **被关闭** 。
+5. 语言非中文和英语的 issue 将 **被关闭** 。
+6. 没有尝试过解决方案的 issue 将 **被关闭** 。
+7. 没有提出任何贡献(例如PR,论文)的 feature / enhancement 将会 **被关闭** 。您可以在 discussion 中的 **希望开发的功能** 讨论区中留言,我们开发组会进行回复。
+8. 不按照 Issue 规范提出的 issue 可能将 **被关闭** 。
+
+> 如何提 issue
+
+1. 简要阐述你的问题
+2. 配上报错日志以(运行报错)或者运行不理想的效果图(原本期望和现实的)
+3. 配上对应的配置文件以你的环境
+4. 你尝试过的解决方法。(非常重要)
+5. 按照模板提出Issue
+
+## PR 规范
+
+> 什么样的 PR 是不会被接受的
+1. 非紧急bug修复的PR并直接提交到```master```的PR。
+2. 仅仅修改```Readme.md```和```配置文件```的。
+3. 跟项目组已经开发的内容冲突的(dev版本),将可能被拒绝。
+
+首先请注意所有的PR需要以dev分支为基准,master分支仅用来发行与紧急bug修复。
+
+> 提出新的通用自定义分词器
+
+1. 将您的分词器所在的代码文件放在```text_splitter```文件夹下,文件名为您的分词器名字`my_splitter.py`,然后在`__init__.py`中导入您的分词器。
+2. 发起PR,并说明您的分词器面向的场景或者改进之处。我们非常期待您能举例一个具体的应用场景。
+
+> 提出新的 Agent 工具
+
+1. 将您的Agent工具所在的代码放在 ```server/agent```文件夹下,文件名为您的工具名字`my_tools.py`,然后在`tools.py`中导入您的工具。
+2. 发起PR,说明您的工具面向的场景或改进之处,并说明如何进行测试和调用。我们非常期待您能举例一个具体的应用场景。
+
+> 提出新的自定义模型
+
+1. 将您的模型贡献到huggingface平台上,并开放给开发人员下载。
+2. 发起PR,说明您的工具面向的场景或改进之处,并说明如何进行测试和调用。我们非常期待您能举例一个具体的应用场景。
+3. 由开发人员测试通过后,将您的模型添加到合作模型名单中。
+
+
+> 修复 Bug & 增加其他新功能
+
+1. 一个 PR 中必须 **只有一个或者一类功能增加,或者修复一个bug** ,多个功能混合的 PR 将 **不会被接受** 。
+2. 说明您增加的功能或者改进之处,并说明如何进行测试和调用。我们非常期待您能举例一个具体的应用场景。
+
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/wiki/参数配置.md b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/参数配置.md
new file mode 100644
index 00000000..23408613
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/参数配置.md
@@ -0,0 +1,156 @@
+在开始参数配置之前,先执行以下脚本
+```shell
+python copy_config_example.py
+```
+该脚本将会将所有```config```目录下的配置文件样例复制一份到```config```目录下,方便开发者进行配置。
+接着,开发者可以根据自己的需求,对配置文件进行修改。
+
+## 基础配置项 basic_config.py
+该配置基负责记录日志的格式和储存路径,通常不需要修改。
+
+## 模型配置项 model_config.py
+本文件包含本地LLM模型、本地Embeddings模型、在线LLM模型API的相关配置。
+
+- 本地模型路径配置。建议将所有下载的模型放到一个统一的目录下,然后将`MODEL_ROOT_PATH`指定为该目录,只要模型目录名称符合下列情况之一(以text2vec为例),即可自动识别加载:
+ - text2vec,即MODEL_PATH中的键
+ - GanymedeNil/text2vec-large-chinese,即MODEL_PATH中的值
+ - text2vec-large-chinese,即MODEL_PATH中的值的简写形式
+
+- 在线模型API配置。在`ONLINE_LLM_MODEL`已经预先写好了所有支持的在线API服务,通常只需要把申请的API_KEY等填入即可。
+有些在线API服务需要安装额外的依赖:
+ - zhipu-api: zhipuai
+ - fangzhou-api: volcengine>=1.0.106
+ - qianfan-api: qianfan
+ - qwen-api: dashscope
+
+- HISTORY_LEN。历史对话轮数通常不建议设置超过10,因为这可能导致以下问题
+ 1. 显存占用过高:尤其是部分模型,本身就已经要占用满显存的情况下,保留太多历史,一次传入token太多,可能会爆显存。
+ 2. 速度处理很慢:还是因为一次传入了太多token,导致速度很慢。
+
+- TEMPERATURE。通常不建议设置过高。
+在Agent对话模式和知识库问答中,我们强烈建议将要其设置成0或者接近于0。
+
+- Agent_MODEL = None
+我们支持用户使用“模型接力赛”的用法,即:
+选择的大模型仅能调用工具,但是在工具中表现较差,则这个工具作为 “模型调用工具”
+如果用户设置了Agent_MODEL,则在 Agent 中,使用Agent_MODEL来执行任务,否则,使用LLM_MODEL
+
+
+## 提示词配置项 prompt_config.py
+
+提示词配置分为三个板块,分别对应三种聊天类型。
+- llm_chat: 基础的对话提示词, 通常来说,直接是用户输入的内容,没有系统提示词。
+- knowledge_base_chat: 与知识库对话的提示词,在模板中,我们为开发者设计了一个系统提示词,开发者可以自行更改。
+- agent_chat: 与Agent对话的提示词,同样,我们为开发者设计了一个系统提示词,开发者可以自行更改。
+
+prompt模板使用Jinja2语法,简单点就是用双大括号代替f-string的单大括号
+请注意,本配置文件支持热加载,修改prompt模板后无需重启服务。
+
+## 数据库配置 kb_config.py
+请确认本地分词器路径是否已经填写,如:
+
+```
+text_splitter_dict = {
+ "ChineseRecursiveTextSplitter": {
+ "source":"huggingface", # 选择tiktoken则使用openai的方法,不填写则默认为字符长度切割方法。
+ "tokenizer_name_or_path":"", # 空格不填则默认使用大模型的分词器。
+ }
+}
+```
+设置好的分词器需要再```TEXT_SPLITTER_NAME```中指定并应用。
+
+在这里,通常使用```huggingface```的方法,并且,我们推荐使用大模型自带的分词器来完成任务。
+
+请注意,使用```gpt2```分词器将要访问huggingface官网下载权重。
+
+我们还支持使用```tiktoken``` 和传统的 按照长度分词的方式,开发者可以自行配置。
+
+如果希望调用自己的分词器,请参考[最佳实践]部分。
+
+```kbs_config```设置了使用的向量数据库,目前可以选择
+- ```faiss```: 使用faiss数据库,需要安装faiss-gpu
+- ```milvus```: 使用milvus数据库,需要安装milvus并进行端口配置
+- ```pg```: 使用pg数据库,需要配置connection_uri
+
+## 服务和端口配置项 server_config.py
+
+通常,这个页面并不需要进行大量的修改,仅需确保对应的端口打开,并不互相冲突即可。
+
+如果你是Linux系统推荐设置
+
+```
+DEFAULT_BIND_HOST ="0.0.0.0"
+```
+如果使用联网模型,则需要关注联网模型的端口。
+
+这些模型必须是在model_config.MODEL_PATH或ONLINE_MODEL中正确配置的。
+
+#在启动startup.py时,可用通过`--model-worker --model-name xxxx`指定模型,不指定则为LLM_MODEL
+
+
+## 覆盖配置文件 或者配置 startup.py
+
+在 ```server_config.py```中有以下配置文件被注释了
+
+```
+"gpus": None, # 使用的GPU,以str的格式指定,如"0,1",如失效请使用CUDA_VISIBLE_DEVICES="0,1"等形式指定
+"num_gpus": 1, # 使用GPU的数量
+"max_gpu_memory":"20GiB", # 每个GPU占用的最大显存
+
+ 以下为model_worker非常用参数,可根据需要配置
+"load_8bit": False, # 开启8bit量化
+"cpu_offloading": None,
+"gptq_ckpt": None,
+"gptq_wbits": 16,
+"gptq_groupsize": -1,
+"gptq_act_order": False,
+"awq_ckpt": None,
+"awq_wbits": 16,
+"awq_groupsize": -1,
+"model_names": [LLM_MODEL],
+"conv_template": None,
+"limit_worker_concurrency": 5,
+"stream_interval": 2,
+"no_register": False,
+"embed_in_truncate": False,
+
+ 以下为vllm_woker配置参数,注意使用vllm必须有gpu,仅在Linux测试通过
+
+ tokenizer = model_path # 如果tokenizer与model_path不一致在此处添加
+ 'tokenizer_mode':'auto',
+ 'trust_remote_code':True,
+ 'download_dir':None,
+ 'load_format':'auto',
+ 'dtype':'auto',
+ 'seed':0,
+ 'worker_use_ray':False,
+ 'pipeline_parallel_size':1,
+ 'tensor_parallel_size':1,
+ 'block_size':16,
+ 'swap_space':4 , # GiB
+ 'gpu_memory_utilization':0.90,
+ 'max_num_batched_tokens':2560,
+ 'max_num_seqs':256,
+ 'disable_log_stats':False,
+ 'conv_template':None,
+ 'limit_worker_concurrency':5,
+ 'no_register':False,
+ 'num_gpus': 1
+ 'engine_use_ray': False,
+ 'disable_log_requests': False
+```
+
+在这些参数中,如果没有设置,则使用```startup.py```中的默认值,如果设置了,则使用设置的值。
+因此,强烈建议开发不要在```startup.py```中进行配置,而应该在```server_config.py```中进行配置。避免配置文件覆盖。
+
+## 选择使用的模型
+在```model_config.py```完成模型配置后,还不能直接使用,需要在该文件下配置本地模型的运行方式或在线模型的API,例如
+```
+ "agentlm-7b": { # 使用default中的IP和端口
+ "device": "cuda",
+ },
+ "zhipu-api": { # 请为每个要运行的在线API设置不同的端口
+ "port": 21001,
+ },
+```
+本地模型使用default中的IP和端口,在线模型可以自己选择端口
\ No newline at end of file
diff --git a/chatchat/chatchat/data/knowledge_base/samples/content/wiki/合作伙伴.md b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/合作伙伴.md
new file mode 100644
index 00000000..e84b59c8
--- /dev/null
+++ b/chatchat/chatchat/data/knowledge_base/samples/content/wiki/合作伙伴.md
@@ -0,0 +1,37 @@
+## 合作伙伴名单
+🎉 Langchain-Chatchat 项目合作伙伴,感谢以下合作伙伴对本项目的支持。
+
+
|
+ |
+ + ChatGLM: 国内最早的开源中文大模型之一 + | +
|
+ |
+ + AutoDL 提供弹性、好用、省钱的云GPU租用服务。缺显卡就上 AutoDL.com + | +
|
+ |
+ + 全球云计算领导者 + | +
|
+ |
+ + 我们相信预测未来的最好方式是自己来创造。我们在这里等你。 + | +
+
+🎉 Langchain-Chatchat 项目微信交流群,如果你也对本项目感兴趣,欢迎加入群聊参与讨论交流。
+
+### 公众号
+
+
+
+🎉 Langchain-Chatchat 项目官方公众号,欢迎扫码关注。
diff --git a/chatchat/chatchat/data/knowledge_base/test/vector_store/bge-large-zh-v1.5/index.faiss b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge-large-zh-v1.5/index.faiss
new file mode 100644
index 00000000..700502e6
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge-large-zh-v1.5/index.faiss differ
diff --git a/chatchat/chatchat/data/knowledge_base/test/vector_store/bge-large-zh-v1.5/index.pkl b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge-large-zh-v1.5/index.pkl
new file mode 100644
index 00000000..1f7ca5b7
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge-large-zh-v1.5/index.pkl differ
diff --git a/chatchat/chatchat/data/knowledge_base/test/vector_store/bge/index.faiss b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge/index.faiss
new file mode 100644
index 00000000..ba31968e
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge/index.faiss differ
diff --git a/chatchat/chatchat/data/knowledge_base/test/vector_store/bge/index.pkl b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge/index.pkl
new file mode 100644
index 00000000..b731580d
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/test/vector_store/bge/index.pkl differ
diff --git a/chatchat/chatchat/data/knowledge_base/test/vector_store/qwen-api/index.faiss b/chatchat/chatchat/data/knowledge_base/test/vector_store/qwen-api/index.faiss
new file mode 100644
index 00000000..bb938827
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/test/vector_store/qwen-api/index.faiss differ
diff --git a/chatchat/chatchat/data/knowledge_base/test/vector_store/qwen-api/index.pkl b/chatchat/chatchat/data/knowledge_base/test/vector_store/qwen-api/index.pkl
new file mode 100644
index 00000000..3d9d7560
Binary files /dev/null and b/chatchat/chatchat/data/knowledge_base/test/vector_store/qwen-api/index.pkl differ
diff --git a/chatchat/data/nltk_data/corpora/cmudict/README b/chatchat/chatchat/data/nltk_data/corpora/cmudict/README
similarity index 100%
rename from chatchat/data/nltk_data/corpora/cmudict/README
rename to chatchat/chatchat/data/nltk_data/corpora/cmudict/README
diff --git a/chatchat/data/nltk_data/corpora/cmudict/cmudict b/chatchat/chatchat/data/nltk_data/corpora/cmudict/cmudict
similarity index 100%
rename from chatchat/data/nltk_data/corpora/cmudict/cmudict
rename to chatchat/chatchat/data/nltk_data/corpora/cmudict/cmudict
diff --git a/chatchat/data/nltk_data/taggers/averaged_perceptron_tagger/averaged_perceptron_tagger.pickle b/chatchat/chatchat/data/nltk_data/taggers/averaged_perceptron_tagger/averaged_perceptron_tagger.pickle
similarity index 100%
rename from chatchat/data/nltk_data/taggers/averaged_perceptron_tagger/averaged_perceptron_tagger.pickle
rename to chatchat/chatchat/data/nltk_data/taggers/averaged_perceptron_tagger/averaged_perceptron_tagger.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/README b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/README
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/README
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/README
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/czech.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/czech.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/czech.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/czech.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/danish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/danish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/danish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/danish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/dutch.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/dutch.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/dutch.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/dutch.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/english.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/english.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/english.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/english.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/estonian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/estonian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/estonian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/estonian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/finnish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/finnish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/finnish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/finnish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/french.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/french.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/french.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/french.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/german.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/german.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/german.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/german.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/greek.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/greek.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/greek.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/greek.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/italian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/italian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/italian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/italian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/malayalam.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/malayalam.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/malayalam.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/malayalam.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/norwegian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/norwegian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/norwegian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/norwegian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/polish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/polish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/polish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/polish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/portuguese.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/portuguese.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/portuguese.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/portuguese.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/russian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/russian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/russian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/russian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/slovene.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/slovene.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/slovene.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/slovene.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/spanish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/spanish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/spanish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/spanish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/swedish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/swedish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/swedish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/swedish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/PY3/turkish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/turkish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/PY3/turkish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/PY3/turkish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/README b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/README
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/README
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/README
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/czech.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/czech.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/czech.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/czech.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/danish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/danish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/danish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/danish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/dutch.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/dutch.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/dutch.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/dutch.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/english.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/english.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/english.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/english.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/estonian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/estonian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/estonian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/estonian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/finnish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/finnish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/finnish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/finnish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/french.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/french.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/french.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/french.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/german.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/german.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/german.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/german.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/greek.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/greek.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/greek.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/greek.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/italian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/italian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/italian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/italian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/malayalam.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/malayalam.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/malayalam.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/malayalam.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/norwegian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/norwegian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/norwegian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/norwegian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/polish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/polish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/polish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/polish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/portuguese.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/portuguese.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/portuguese.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/portuguese.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/russian.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/russian.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/russian.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/russian.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/slovene.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/slovene.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/slovene.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/slovene.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/spanish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/spanish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/spanish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/spanish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/swedish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/swedish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/swedish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/swedish.pickle
diff --git a/chatchat/data/nltk_data/tokenizers/punkt/turkish.pickle b/chatchat/chatchat/data/nltk_data/tokenizers/punkt/turkish.pickle
similarity index 100%
rename from chatchat/data/nltk_data/tokenizers/punkt/turkish.pickle
rename to chatchat/chatchat/data/nltk_data/tokenizers/punkt/turkish.pickle
diff --git a/chatchat/img/LLM_success.png b/chatchat/chatchat/img/LLM_success.png
similarity index 100%
rename from chatchat/img/LLM_success.png
rename to chatchat/chatchat/img/LLM_success.png
diff --git a/chatchat/img/agent_continue.png b/chatchat/chatchat/img/agent_continue.png
similarity index 100%
rename from chatchat/img/agent_continue.png
rename to chatchat/chatchat/img/agent_continue.png
diff --git a/chatchat/img/agent_success.png b/chatchat/chatchat/img/agent_success.png
similarity index 100%
rename from chatchat/img/agent_success.png
rename to chatchat/chatchat/img/agent_success.png
diff --git a/chatchat/img/chatchat-qrcode.jpg b/chatchat/chatchat/img/chatchat-qrcode.jpg
similarity index 100%
rename from chatchat/img/chatchat-qrcode.jpg
rename to chatchat/chatchat/img/chatchat-qrcode.jpg
diff --git a/chatchat/img/chatchat_icon_blue_square_v2.png b/chatchat/chatchat/img/chatchat_icon_blue_square_v2.png
similarity index 100%
rename from chatchat/img/chatchat_icon_blue_square_v2.png
rename to chatchat/chatchat/img/chatchat_icon_blue_square_v2.png
diff --git a/chatchat/img/docker_logs.png b/chatchat/chatchat/img/docker_logs.png
similarity index 100%
rename from chatchat/img/docker_logs.png
rename to chatchat/chatchat/img/docker_logs.png
diff --git a/chatchat/img/fastapi_docs_026.png b/chatchat/chatchat/img/fastapi_docs_026.png
similarity index 100%
rename from chatchat/img/fastapi_docs_026.png
rename to chatchat/chatchat/img/fastapi_docs_026.png
diff --git a/chatchat/img/init_knowledge_base.jpg b/chatchat/chatchat/img/init_knowledge_base.jpg
similarity index 100%
rename from chatchat/img/init_knowledge_base.jpg
rename to chatchat/chatchat/img/init_knowledge_base.jpg
diff --git a/chatchat/img/knowledge_base_success.jpg b/chatchat/chatchat/img/knowledge_base_success.jpg
similarity index 100%
rename from chatchat/img/knowledge_base_success.jpg
rename to chatchat/chatchat/img/knowledge_base_success.jpg
diff --git a/chatchat/img/langchain+chatglm.png b/chatchat/chatchat/img/langchain+chatglm.png
similarity index 100%
rename from chatchat/img/langchain+chatglm.png
rename to chatchat/chatchat/img/langchain+chatglm.png
diff --git a/chatchat/img/langchain+chatglm2.png b/chatchat/chatchat/img/langchain+chatglm2.png
similarity index 100%
rename from chatchat/img/langchain+chatglm2.png
rename to chatchat/chatchat/img/langchain+chatglm2.png
diff --git a/chatchat/img/logo-long-chatchat-trans-v2.png b/chatchat/chatchat/img/logo-long-chatchat-trans-v2.png
similarity index 100%
rename from chatchat/img/logo-long-chatchat-trans-v2.png
rename to chatchat/chatchat/img/logo-long-chatchat-trans-v2.png
diff --git a/chatchat/img/official_account_qr.png b/chatchat/chatchat/img/official_account_qr.png
similarity index 100%
rename from chatchat/img/official_account_qr.png
rename to chatchat/chatchat/img/official_account_qr.png
diff --git a/chatchat/img/official_wechat_mp_account.png b/chatchat/chatchat/img/official_wechat_mp_account.png
similarity index 100%
rename from chatchat/img/official_wechat_mp_account.png
rename to chatchat/chatchat/img/official_wechat_mp_account.png
diff --git a/chatchat/img/partners/autodl.svg b/chatchat/chatchat/img/partners/autodl.svg
similarity index 100%
rename from chatchat/img/partners/autodl.svg
rename to chatchat/chatchat/img/partners/autodl.svg
diff --git a/chatchat/img/partners/aws.svg b/chatchat/chatchat/img/partners/aws.svg
similarity index 100%
rename from chatchat/img/partners/aws.svg
rename to chatchat/chatchat/img/partners/aws.svg
diff --git a/chatchat/img/partners/chatglm.svg b/chatchat/chatchat/img/partners/chatglm.svg
similarity index 100%
rename from chatchat/img/partners/chatglm.svg
rename to chatchat/chatchat/img/partners/chatglm.svg
diff --git a/chatchat/img/partners/zhenfund.svg b/chatchat/chatchat/img/partners/zhenfund.svg
similarity index 100%
rename from chatchat/img/partners/zhenfund.svg
rename to chatchat/chatchat/img/partners/zhenfund.svg
diff --git a/chatchat/img/qr_code_90.jpg b/chatchat/chatchat/img/qr_code_90.jpg
similarity index 100%
rename from chatchat/img/qr_code_90.jpg
rename to chatchat/chatchat/img/qr_code_90.jpg
diff --git a/chatchat/img/qr_code_90.png b/chatchat/chatchat/img/qr_code_90.png
similarity index 100%
rename from chatchat/img/qr_code_90.png
rename to chatchat/chatchat/img/qr_code_90.png
diff --git a/chatchat/img/qr_code_91.jpg b/chatchat/chatchat/img/qr_code_91.jpg
similarity index 100%
rename from chatchat/img/qr_code_91.jpg
rename to chatchat/chatchat/img/qr_code_91.jpg
diff --git a/chatchat/img/qr_code_92.jpg b/chatchat/chatchat/img/qr_code_92.jpg
similarity index 100%
rename from chatchat/img/qr_code_92.jpg
rename to chatchat/chatchat/img/qr_code_92.jpg
diff --git a/chatchat/img/qr_code_93.jpg b/chatchat/chatchat/img/qr_code_93.jpg
similarity index 100%
rename from chatchat/img/qr_code_93.jpg
rename to chatchat/chatchat/img/qr_code_93.jpg
diff --git a/chatchat/img/qr_code_94.jpg b/chatchat/chatchat/img/qr_code_94.jpg
similarity index 100%
rename from chatchat/img/qr_code_94.jpg
rename to chatchat/chatchat/img/qr_code_94.jpg
diff --git a/chatchat/img/qr_code_95.jpg b/chatchat/chatchat/img/qr_code_95.jpg
similarity index 100%
rename from chatchat/img/qr_code_95.jpg
rename to chatchat/chatchat/img/qr_code_95.jpg
diff --git a/chatchat/img/qr_code_96.jpg b/chatchat/chatchat/img/qr_code_96.jpg
similarity index 100%
rename from chatchat/img/qr_code_96.jpg
rename to chatchat/chatchat/img/qr_code_96.jpg
diff --git a/chatchat/img/qrcode_90_2.jpg b/chatchat/chatchat/img/qrcode_90_2.jpg
similarity index 100%
rename from chatchat/img/qrcode_90_2.jpg
rename to chatchat/chatchat/img/qrcode_90_2.jpg
diff --git a/chatchat/init_database.py b/chatchat/chatchat/init_database.py
similarity index 100%
rename from chatchat/init_database.py
rename to chatchat/chatchat/init_database.py
diff --git a/chatchat/model_loaders/xinference_manager.py b/chatchat/chatchat/model_loaders/xinference_manager.py
similarity index 100%
rename from chatchat/model_loaders/xinference_manager.py
rename to chatchat/chatchat/model_loaders/xinference_manager.py
diff --git a/chatchat/startup.py b/chatchat/chatchat/startup.py
similarity index 98%
rename from chatchat/startup.py
rename to chatchat/chatchat/startup.py
index eeef005e..839ae8b5 100644
--- a/chatchat/startup.py
+++ b/chatchat/chatchat/startup.py
@@ -57,13 +57,16 @@ def run_api_server(started_event: mp.Event = None, run_mode: str = None):
def run_webui(started_event: mp.Event = None, run_mode: str = None):
+ import sys
from chatchat_server.utils import set_httpx_config
+
set_httpx_config()
host = WEBUI_SERVER["host"]
port = WEBUI_SERVER["port"]
- cmd = ["streamlit", "run", "webui.py",
+ st_exe = os.path.join(os.path.dirname(sys.executable),"scripts","streamlit.exe")
+ cmd = [st_exe, "run", "chatchat/chatchat/webui.py",
"--server.address", host,
"--server.port", str(port),
"--theme.base", "light",
diff --git a/chatchat/tests/api/test_kb_api.py b/chatchat/chatchat/tests/api/test_kb_api.py
similarity index 100%
rename from chatchat/tests/api/test_kb_api.py
rename to chatchat/chatchat/tests/api/test_kb_api.py
diff --git a/chatchat/tests/api/test_kb_api_request.py b/chatchat/chatchat/tests/api/test_kb_api_request.py
similarity index 100%
rename from chatchat/tests/api/test_kb_api_request.py
rename to chatchat/chatchat/tests/api/test_kb_api_request.py
diff --git a/chatchat/tests/api/test_kb_summary_api.py b/chatchat/chatchat/tests/api/test_kb_summary_api.py
similarity index 100%
rename from chatchat/tests/api/test_kb_summary_api.py
rename to chatchat/chatchat/tests/api/test_kb_summary_api.py
diff --git a/chatchat/tests/api/test_openai_wrap.py b/chatchat/chatchat/tests/api/test_openai_wrap.py
similarity index 100%
rename from chatchat/tests/api/test_openai_wrap.py
rename to chatchat/chatchat/tests/api/test_openai_wrap.py
diff --git a/chatchat/tests/api/test_server_state_api.py b/chatchat/chatchat/tests/api/test_server_state_api.py
similarity index 100%
rename from chatchat/tests/api/test_server_state_api.py
rename to chatchat/chatchat/tests/api/test_server_state_api.py
diff --git a/chatchat/tests/api/test_stream_chat_api.py b/chatchat/chatchat/tests/api/test_stream_chat_api.py
similarity index 100%
rename from chatchat/tests/api/test_stream_chat_api.py
rename to chatchat/chatchat/tests/api/test_stream_chat_api.py
diff --git a/chatchat/tests/api/test_stream_chat_api_thread.py b/chatchat/chatchat/tests/api/test_stream_chat_api_thread.py
similarity index 100%
rename from chatchat/tests/api/test_stream_chat_api_thread.py
rename to chatchat/chatchat/tests/api/test_stream_chat_api_thread.py
diff --git a/chatchat/tests/api/test_tools.py b/chatchat/chatchat/tests/api/test_tools.py
similarity index 100%
rename from chatchat/tests/api/test_tools.py
rename to chatchat/chatchat/tests/api/test_tools.py
diff --git a/chatchat/tests/custom_splitter/test_different_splitter.py b/chatchat/chatchat/tests/custom_splitter/test_different_splitter.py
similarity index 100%
rename from chatchat/tests/custom_splitter/test_different_splitter.py
rename to chatchat/chatchat/tests/custom_splitter/test_different_splitter.py
diff --git a/chatchat/tests/document_loader/test_imgloader.py b/chatchat/chatchat/tests/document_loader/test_imgloader.py
similarity index 100%
rename from chatchat/tests/document_loader/test_imgloader.py
rename to chatchat/chatchat/tests/document_loader/test_imgloader.py
diff --git a/chatchat/tests/document_loader/test_pdfloader.py b/chatchat/chatchat/tests/document_loader/test_pdfloader.py
similarity index 100%
rename from chatchat/tests/document_loader/test_pdfloader.py
rename to chatchat/chatchat/tests/document_loader/test_pdfloader.py
diff --git a/chatchat/tests/kb_vector_db/__init__.py b/chatchat/chatchat/tests/kb_vector_db/__init__.py
similarity index 100%
rename from chatchat/tests/kb_vector_db/__init__.py
rename to chatchat/chatchat/tests/kb_vector_db/__init__.py
diff --git a/chatchat/tests/kb_vector_db/test_faiss_kb.py b/chatchat/chatchat/tests/kb_vector_db/test_faiss_kb.py
similarity index 100%
rename from chatchat/tests/kb_vector_db/test_faiss_kb.py
rename to chatchat/chatchat/tests/kb_vector_db/test_faiss_kb.py
diff --git a/chatchat/tests/kb_vector_db/test_milvus_db.py b/chatchat/chatchat/tests/kb_vector_db/test_milvus_db.py
similarity index 100%
rename from chatchat/tests/kb_vector_db/test_milvus_db.py
rename to chatchat/chatchat/tests/kb_vector_db/test_milvus_db.py
diff --git a/chatchat/tests/kb_vector_db/test_pg_db.py b/chatchat/chatchat/tests/kb_vector_db/test_pg_db.py
similarity index 100%
rename from chatchat/tests/kb_vector_db/test_pg_db.py
rename to chatchat/chatchat/tests/kb_vector_db/test_pg_db.py
diff --git a/chatchat/tests/samples/ocr_test.docx b/chatchat/chatchat/tests/samples/ocr_test.docx
similarity index 100%
rename from chatchat/tests/samples/ocr_test.docx
rename to chatchat/chatchat/tests/samples/ocr_test.docx
diff --git a/chatchat/tests/samples/ocr_test.jpg b/chatchat/chatchat/tests/samples/ocr_test.jpg
similarity index 100%
rename from chatchat/tests/samples/ocr_test.jpg
rename to chatchat/chatchat/tests/samples/ocr_test.jpg
diff --git a/chatchat/tests/samples/ocr_test.pdf b/chatchat/chatchat/tests/samples/ocr_test.pdf
similarity index 100%
rename from chatchat/tests/samples/ocr_test.pdf
rename to chatchat/chatchat/tests/samples/ocr_test.pdf
diff --git a/chatchat/tests/samples/ocr_test.pptx b/chatchat/chatchat/tests/samples/ocr_test.pptx
similarity index 100%
rename from chatchat/tests/samples/ocr_test.pptx
rename to chatchat/chatchat/tests/samples/ocr_test.pptx
diff --git a/chatchat/tests/test_migrate.py b/chatchat/chatchat/tests/test_migrate.py
similarity index 100%
rename from chatchat/tests/test_migrate.py
rename to chatchat/chatchat/tests/test_migrate.py
diff --git a/chatchat/tests/test_qwen_agent.py b/chatchat/chatchat/tests/test_qwen_agent.py
similarity index 100%
rename from chatchat/tests/test_qwen_agent.py
rename to chatchat/chatchat/tests/test_qwen_agent.py
diff --git a/chatchat/webui.py b/chatchat/chatchat/webui.py
similarity index 95%
rename from chatchat/webui.py
rename to chatchat/chatchat/webui.py
index 5520a9cf..396d5d48 100644
--- a/chatchat/webui.py
+++ b/chatchat/chatchat/webui.py
@@ -24,7 +24,7 @@ if __name__ == "__main__":
st.set_page_config(
"Langchain-Chatchat WebUI",
- os.path.join("img", "chatchat_icon_blue_square_v2.png"),
+ os.path.join("chatchat", "chatchat", "img", "chatchat_icon_blue_square_v2.png"),
initial_sidebar_state="expanded",
menu_items={
'Get Help': 'https://github.com/chatchat-space/Langchain-Chatchat',
@@ -75,6 +75,8 @@ if __name__ == "__main__":
with st.sidebar:
st.image(
os.path.join(
+ "chatchat",
+ "chatchat",
"img",
"logo-long-chatchat-trans-v2.png"
),
diff --git a/chatchat/data/knowledge_base/samples/content/wiki b/chatchat/data/knowledge_base/samples/content/wiki
deleted file mode 160000
index 28f664aa..00000000
--- a/chatchat/data/knowledge_base/samples/content/wiki
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 28f664aa08f8191a70339c9ecbe7a89b35a1032a
diff --git a/chatchat/poetry.toml b/chatchat/poetry.toml
index 42159b24..3b673ef3 100644
--- a/chatchat/poetry.toml
+++ b/chatchat/poetry.toml
@@ -3,3 +3,7 @@ in-project = true
[installer]
modern-installation = false
+
+[plugins]
+[plugins.pypi_mirror]
+url = "https://pypi.tuna.tsinghua.edu.cn/simple"
diff --git a/chatchat/pyproject.toml b/chatchat/pyproject.toml
index f4ff6359..3d996615 100644
--- a/chatchat/pyproject.toml
+++ b/chatchat/pyproject.toml
@@ -7,7 +7,7 @@ readme = "README.md"
[tool.poetry.dependencies]
-python = ">=3.8,<4.0,!=3.9.7"
+python = ">=3.8.1,<4.0,!=3.9.7"
chatchat-model-providers = "^0.3.0"
chatchat-server = "^0.3.0"
chatchat-webui-pages = "^0.3.0"
@@ -170,7 +170,7 @@ omit = [
]
[build-system]
-requires = ["poetry-core>=1.0.0"]
+requires = ["poetry-core>=1.0.0", "poetry-plugin-pypi-mirror==0.4.2"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
diff --git a/model-providers/poetry.toml b/model-providers/poetry.toml
index 42159b24..3b673ef3 100644
--- a/model-providers/poetry.toml
+++ b/model-providers/poetry.toml
@@ -3,3 +3,7 @@ in-project = true
[installer]
modern-installation = false
+
+[plugins]
+[plugins.pypi_mirror]
+url = "https://pypi.tuna.tsinghua.edu.cn/simple"
diff --git a/model-providers/pyproject.toml b/model-providers/pyproject.toml
index 2da32369..b53822fc 100644
--- a/model-providers/pyproject.toml
+++ b/model-providers/pyproject.toml
@@ -6,13 +6,13 @@ authors = ["glide-the <2533736852@qq.com>"]
readme = "README.md"
[tool.poetry.dependencies]
-python = ">=3.8,<4.0,!=3.9.7"
+python = ">=3.8.1,<4.0,!=3.9.7"
transformers = "4.31.0"
fastapi = "^0.109.2"
uvicorn = ">=0.27.0.post1"
sse-starlette = "^1.8.2"
pyyaml = "6.0.1"
-pydantic = "1.10.14"
+pydantic = "2.6.4"
redis = "4.5.4"
# modle_runtime
openai = "1.13.3"
@@ -167,7 +167,7 @@ omit = [
]
[build-system]
-requires = ["poetry-core>=1.0.0"]
+requires = ["poetry-core>=1.0.0", "poetry-plugin-pypi-mirror==0.4.2"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
diff --git a/poetry.toml b/poetry.toml
index 42159b24..3b673ef3 100644
--- a/poetry.toml
+++ b/poetry.toml
@@ -3,3 +3,7 @@ in-project = true
[installer]
modern-installation = false
+
+[plugins]
+[plugins.pypi_mirror]
+url = "https://pypi.tuna.tsinghua.edu.cn/simple"
diff --git a/pyproject.toml b/pyproject.toml
index 373a0d4e..e9f0409d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,7 @@ repository = "https://github.com/chatchat-space/Langchain-Chatchat.git"
[tool.poetry.dependencies]
-python = ">=3.8,<4.0,!=3.9.7"
+python = ">=3.8.1,<4.0,!=3.9.7"
[tool.poetry.group.lint.dependencies]
diff --git a/webui-pages/chatchat_webui_pages/dialogue/dialogue.py b/webui-pages/chatchat_webui_pages/dialogue/dialogue.py
index e3936d59..6f9e286e 100644
--- a/webui-pages/chatchat_webui_pages/dialogue/dialogue.py
+++ b/webui-pages/chatchat_webui_pages/dialogue/dialogue.py
@@ -19,11 +19,11 @@ from chatchat_server.utils import MsgType, get_config_models
import uuid
from typing import List, Dict
-import streamlit_antd_components as sac
-
chat_box = ChatBox(
assistant_avatar=os.path.join(
+ "chatchat",
+ "chatchat",
"img",
"chatchat_icon_blue_square_v2.png"
)
diff --git a/webui-pages/poetry.toml b/webui-pages/poetry.toml
index 42159b24..3b673ef3 100644
--- a/webui-pages/poetry.toml
+++ b/webui-pages/poetry.toml
@@ -3,3 +3,7 @@ in-project = true
[installer]
modern-installation = false
+
+[plugins]
+[plugins.pypi_mirror]
+url = "https://pypi.tuna.tsinghua.edu.cn/simple"
diff --git a/webui-pages/pyproject.toml b/webui-pages/pyproject.toml
index bd7b6018..d3b1d194 100644
--- a/webui-pages/pyproject.toml
+++ b/webui-pages/pyproject.toml
@@ -6,7 +6,7 @@ authors = ["chatchat"]
readme = "README.md"
[tool.poetry.dependencies]
-python = ">=3.8,<4.0,!=3.9.7"
+python = ">=3.8.1,<4.0,!=3.9.7"
chatchat-model-providers = "^0.3.0"
chatchat-server = "^0.3.0"
streamlit = "1.30.0"
@@ -54,7 +54,7 @@ optional = true
[tool.poetry.group.dev.dependencies]
jupyter = "^1.0.0"
setuptools = "^67.6.1"
-chatchat-model-providers = { path = "../model_providers", develop = true }
+chatchat-model-providers = { path = "../model-providers", develop = true }
chatchat-server = { path = "../chatchat-server", develop = true }
[tool.poetry.extras]
@@ -170,7 +170,7 @@ omit = [
]
[build-system]
-requires = ["poetry-core>=1.0.0"]
+requires = ["poetry-core>=1.0.0", "poetry-plugin-pypi-mirror==0.4.2"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]