mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-19 13:23:16 +08:00
API前端丢失问题解决
This commit is contained in:
parent
22ee1a0c97
commit
ffbfcd41f2
@ -8,7 +8,7 @@
|
||||
基于 ChatGLM 等大语言模型与 Langchain 等应用框架实现,开源、可离线部署的检索增强生成(RAG)大模型知识库项目。
|
||||
|
||||
⚠️`0.2.10`将会是`0.2.x`系列的最后一个版本,`0.2.x`系列版本将会停止更新和技术支持,全力研发具有更强应用性的 `Langchain-Chatchat 0.3.x`。
|
||||
|
||||
`0.2.10` 的后续 bug 修复将会直接推送到`master`分支,而不在进行版本更新。
|
||||
---
|
||||
|
||||
## 目录
|
||||
|
||||
@ -9,7 +9,8 @@ A LLM application aims to implement knowledge and search engine based QA based o
|
||||
LLM API.
|
||||
|
||||
⚠️`0.2.10` will be the last version of the `0.2.x` series. The `0.2.x` series will stop updating and technical support,
|
||||
and strive to develop `Langchain-Chachat 0.3.x with stronger applicability. `.
|
||||
and strive to develop `Langchain-Chachat 0.3.x` with stronger applicability.
|
||||
Subsequent bug fixes for `0.2.10` will be pushed directly to the `master` branch without version updates.
|
||||
|
||||
|
||||
---
|
||||
@ -61,7 +62,8 @@ The main process analysis from the aspect of document process:
|
||||
🚩 The training or fine-tuning are not involved in the project, but still, one always can improve performance by do
|
||||
these.
|
||||
|
||||
🌐 [AutoDL image](https://www.codewithgpu.com/i/chatchat-space/Langchain-Chatchat/Langchain-Chatchat) is supported, and in v14 the codes are update to v0.2.10.
|
||||
🌐 [AutoDL image](https://www.codewithgpu.com/i/chatchat-space/Langchain-Chatchat/Langchain-Chatchat) is supported, and
|
||||
in v14 the codes are update to v0.2.10.
|
||||
|
||||
🐳 [Docker image](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.7) is supported to 0.2.7
|
||||
|
||||
|
||||
64
README_ja.md
64
README_ja.md
@ -3,9 +3,14 @@
|
||||
🌍 [中文文档](README.md)
|
||||
🌍 [READ THIS IN ENGLISH](README_en.md)
|
||||
|
||||
📃 **LangChain-Chatchat** (旧名 Langchain-ChatGLM):
|
||||
📃 **LangChain-Chatchat** (旧名 Langchain-ChatGLM)
|
||||
|
||||
LLM アプリケーションは、Langchain とオープンソースまたはリモートの LLM API に基づいて、知識と検索エンジンベースの QA を実装することを目的としています。
|
||||
ChatGLM などの大規模な言語モデルや Langchain などのアプリケーション フレームワークに基づいた、オープン
|
||||
ソースのオフライン展開可能な検索拡張生成 (RAG) 大規模モデル ナレッジ ベース プロジェクトです。
|
||||
|
||||
⚠️`0.2.10` は `0.2.x` シリーズの最終バージョンとなり、`0.2.x`
|
||||
シリーズはアップデートと技術サポートを終了し、より適用性の高い `Langchain-Chachat 0.3.x` の開発に努めます。 。
|
||||
`0.2.10` のその後のバグ修正は、バージョン更新なしで `master` ブランチに直接プッシュされます。
|
||||
|
||||
---
|
||||
|
||||
@ -23,20 +28,29 @@ LLM アプリケーションは、Langchain とオープンソースまたはリ
|
||||
|
||||
## イントロ
|
||||
|
||||
🤖️ [langchain](https://github.com/hwchase17/langchain) のアイデアを用いて実装された、ローカルナレッジベースに基づく Q&A アプリケーション。
|
||||
目標は、中国のシナリオとオープンソースモデルに親和性があり、オフラインとオンラインの両方で実行可能な KBQA(ナレッジベースの Q&A)ソリューションを構築することです。
|
||||
🤖️ [langchain](https://github.com/hwchase17/langchain) のアイデアを用いて実装された、ローカルナレッジベースに基づく Q&A
|
||||
アプリケーション。
|
||||
目標は、中国のシナリオとオープンソースモデルに親和性があり、オフラインとオンラインの両方で実行可能な KBQA(ナレッジベースの
|
||||
Q&A)ソリューションを構築することです。
|
||||
|
||||
💡 [document.ai](https://github.com/GanymedeNil/document.ai) と [ChatGLM-6B Pull Request](https://github.com/THUDM/ChatGLM-6B/pull/216) に触発され、
|
||||
💡 [document.ai](https://github.com/GanymedeNil/document.ai)
|
||||
と [ChatGLM-6B Pull Request](https://github.com/THUDM/ChatGLM-6B/pull/216) に触発され、
|
||||
プロセス全体を通してオープンソースモデルまたはリモート LLM api を使用して実装することができるローカルナレッジベースの質問応答アプリケーションを構築します。
|
||||
このプロジェクトの最新バージョンでは、[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を通してサービスを呼び出したり、
|
||||
このプロジェクトの最新バージョンでは、[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 や Zhipu API の呼び出しにも対応しており、今後も様々な機種やリモート API へのアクセスを拡大していきます。
|
||||
✅ オープンソースの LLM と Embedding モデルに依存して、このプロジェクトはフルプロセスの **オフラインプライベートデプロイメント
|
||||
** を実現することができます。
|
||||
同時に、本プロジェクトは OpenAI GPT API や Zhipu API の呼び出しにも対応しており、今後も様々な機種やリモート API
|
||||
へのアクセスを拡大していきます。
|
||||
|
||||
⛓️ このプロジェクトの実施原則を下のグラフに示します。主なプロセスは以下の通りです:
|
||||
ファイルの読み込み -> テキストの読み込み -> テキストのセグメンテーション -> テキストのベクトル化 -> 質問のベクトル化 -> 質問ベクトルと最も似ている `top-k` をテキストベクトルでマッチング -> マッチしたテキストをコンテキストと質問として `prompt` に追加 -> 回答を生成するために `LLM` に送信。
|
||||
ファイルの読み込み -> テキストの読み込み -> テキストのセグメンテーション -> テキストのベクトル化 -> 質問のベクトル化 ->
|
||||
質問ベクトルと最も似ている `top-k` をテキストベクトルでマッチング ->
|
||||
マッチしたテキストをコンテキストと質問として `prompt` に追加 -> 回答を生成するために `LLM` に送信。
|
||||
|
||||
📺[video introduction](https://www.bilibili.com/video/BV13M4y1e7cN/?share_source=copy_web&vd_source=e6c5aafe684f30fbe41925d61ca6d514)
|
||||
|
||||
@ -48,7 +62,8 @@ LLM アプリケーションは、Langchain とオープンソースまたはリ
|
||||
|
||||
🚩 トレーニングやファインチューニングはプロジェクトには含まれないが、これらを行うことで必ずパフォーマンスを向上させることができます。
|
||||
|
||||
🌐 [AutoDL イメージ](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.5)がサポートされ、v13 では v0.2.9 にアップデートされました。
|
||||
🌐 [AutoDL イメージ](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.5)がサポートされ、v13 では v0.2.9
|
||||
にアップデートされました。
|
||||
|
||||
🐳 [Docker イメージ](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.7)
|
||||
|
||||
@ -67,7 +82,7 @@ LLM アプリケーションは、Langchain とオープンソースまたはリ
|
||||
|
||||
```
|
||||
$ python --version
|
||||
Python 3.10.12
|
||||
Python 3.11.7
|
||||
```
|
||||
|
||||
次に、仮想環境を作成し、プロジェクトの依存関係を仮想環境内にインストールする。
|
||||
@ -87,6 +102,7 @@ $ pip install -r requirements_webui.txt
|
||||
|
||||
# デフォルトの依存関係には、基本的な実行環境(FAISS ベクターライブラリ)が含まれます。milvus/pg_vector などのベクターライブラリを使用する場合は、requirements.txt 内の対応する依存関係のコメントを解除してからインストールしてください。
|
||||
```
|
||||
|
||||
LangChain-Chachat `0.2.x` シリーズは Langchain `0.0.x` シリーズ用です。Langchain `0.1.x` シリーズをお使いの場合は、ダウングレードする必要があります。
|
||||
|
||||
### モデルをダウンロード
|
||||
@ -94,9 +110,12 @@ LangChain-Chachat `0.2.x` シリーズは Langchain `0.0.x` シリーズ用で
|
||||
このプロジェクトをローカルまたはオフライン環境で実行する必要がある場合は、まずプロジェクトに必要なモデルをダウンロードする必要があります。
|
||||
通常、オープンソースの LLM と Embedding モデルは Hugging Face からダウンロードできる。
|
||||
|
||||
このプロジェクトで使用されているデフォルトの LLM モデルである [THUDM/chatglm2-6b](https://huggingface.co/THUDM/chatglm2-6b)と、Embedding モデル [moka-ai/m3e-base](https://huggingface.co/moka-ai/m3e-base) を例にとると、次のようになります:
|
||||
このプロジェクトで使用されているデフォルトの 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) をインストールし、次のように実行する必要があります:
|
||||
モデルをダウンロードするには、まず [Git LFS](https://docs.github.com/zh/repositories/working-with-files/managing-large-files/installing-git-large-file-storage)
|
||||
をインストールし、次のように実行する必要があります:
|
||||
|
||||
```Shell
|
||||
$ git lfs install
|
||||
@ -139,7 +158,22 @@ $ python startup.py -a
|
||||
|
||||
### 注
|
||||
|
||||
上記の手順はクイックスタートのために提供されています。より多くの機能が必要な場合や、起動方法をカスタマイズしたい場合は、[Wiki](https://github.com/chatchat-space/Langchain-Chatchat/wiki/) を参照してください。
|
||||
上記の手順はクイックスタートのために提供されています。より多くの機能が必要な場合や、起動方法をカスタマイズしたい場合は、[Wiki](https://github.com/chatchat-space/Langchain-Chatchat/wiki/)
|
||||
を参照してください。
|
||||
|
||||
---
|
||||
|
||||
## プロジェクトのマイルストーン
|
||||
|
||||
+ `2023 年 4 月`: `Langchain-ChatGLM 0.1.0` がリリースされ、ChatGLM-6B モデルに基づくローカル ナレッジ ベースの質問と回答がサポートされました。
|
||||
+ `2023 年 8 月`: `Langchain-ChatGLM` は `Langchain-Chatchat` に名前変更され、モデル読み込みソリューションとして `fastchat` を使用し、より多くのモデルとデータベースをサポートする `0.2.0` がリリースされました。
|
||||
+ `2023 年 10 月`: `Langchain-Chachat 0.2.5` リリース、エージェント コンテンツ、オープンソース プロジェクトを`Founder Park & Zhipu AI & Zilliz`で開始
|
||||
開催したハッカソンでは3位に入賞しました。
|
||||
+ `2023 年 12 月`: `Langchain-Chachat`オープンソース プロジェクトは **20,000** つ以上のスターを獲得しました。
|
||||
+ `2024 年 1 月`: `LangChain 0.1.x` がリリースされ、`Langchain-Chachat 0.2.x` が安定版 `0.2.10` をリリースしました。
|
||||
今後はアップデートと技術サポートを停止し、より適用性の高い`Langchain-Chachat 0.3.x`の開発に努める予定です。
|
||||
|
||||
+ 🔥 これからのChatchatストーリーを一緒に楽しみにしましょう···
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ torch==2.1.2
|
||||
torchvision==0.16.2
|
||||
torchaudio==2.1.2
|
||||
xformers==0.0.23.post1
|
||||
transformers==4.36.2
|
||||
transformers==4.37.1
|
||||
sentence_transformers==2.2.2
|
||||
langchain==0.0.354
|
||||
langchain-experimental==0.0.47
|
||||
@ -12,7 +12,7 @@ openai==1.9.0
|
||||
fastapi==0.109.0
|
||||
sse_starlette==1.8.2
|
||||
nltk==3.8.1
|
||||
uvicorn==0.24.0.post1
|
||||
uvicorn>=0.27.0.post1
|
||||
starlette==0.35.0
|
||||
unstructured[all-docs] # ==0.11.8
|
||||
python-magic-bin; sys_platform == 'win32'
|
||||
|
||||
@ -2,7 +2,7 @@ torch~=2.1.2
|
||||
torchvision~=0.16.2
|
||||
torchaudio~=2.1.2
|
||||
xformers>=0.0.23.post1
|
||||
transformers==4.36.2
|
||||
transformers==4.37.1
|
||||
sentence_transformers==2.2.2
|
||||
langchain==0.0.354
|
||||
langchain-experimental==0.0.47
|
||||
@ -12,7 +12,7 @@ openai~=1.9.0
|
||||
fastapi~=0.109.0
|
||||
sse_starlette==1.8.2
|
||||
nltk>=3.8.1
|
||||
uvicorn>=0.24.0.post1
|
||||
uvicorn>=0.27.0.post1
|
||||
starlette~=0.35.0
|
||||
unstructured[all-docs]==0.11.0
|
||||
python-magic-bin; sys_platform == 'win32'
|
||||
|
||||
@ -6,7 +6,7 @@ openai~=1.9.0
|
||||
fastapi~=0.109.0
|
||||
sse_starlette~=1.8.2
|
||||
nltk~=3.8.1
|
||||
uvicorn~=0.24.0.post1
|
||||
uvicorn>=0.27.0.post1
|
||||
starlette~=0.35.0
|
||||
unstructured[all-docs]~=0.12.0
|
||||
python-magic-bin; sys_platform == 'win32'
|
||||
@ -33,3 +33,7 @@ watchdog~=3.0.0
|
||||
# psycopg2==2.9.9
|
||||
# pgvector>=0.2.4
|
||||
# chromadb==0.4.13
|
||||
# jq==1.6.0
|
||||
# beautifulsoup4~=4.12.2
|
||||
# pysrt~=1.1.2
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
10
startup.py
10
startup.py
@ -763,24 +763,23 @@ async def start_main_server():
|
||||
p.start()
|
||||
p.name = f"{p.name} ({p.pid})"
|
||||
|
||||
# 等待所有model_worker启动完成
|
||||
for e in model_worker_started:
|
||||
e.wait()
|
||||
|
||||
if p := processes.get("api"):
|
||||
p.start()
|
||||
p.name = f"{p.name} ({p.pid})"
|
||||
api_started.wait() # 等待api.py启动完成
|
||||
api_started.wait()
|
||||
|
||||
if p := processes.get("webui"):
|
||||
p.start()
|
||||
p.name = f"{p.name} ({p.pid})"
|
||||
webui_started.wait() # 等待webui.py启动完成
|
||||
webui_started.wait()
|
||||
|
||||
dump_server_info(after_start=True, args=args)
|
||||
|
||||
while True:
|
||||
cmd = queue.get() # 收到切换模型的消息
|
||||
cmd = queue.get()
|
||||
e = manager.Event()
|
||||
if isinstance(cmd, list):
|
||||
model_name, cmd, new_model_name = cmd
|
||||
@ -851,9 +850,6 @@ async def start_main_server():
|
||||
logger.error(e)
|
||||
logger.warning("Caught KeyboardInterrupt! Setting stop event...")
|
||||
finally:
|
||||
# Send SIGINT if process doesn't exit quickly enough, and kill it as last resort
|
||||
# .is_alive() also implicitly joins the process (good practice in linux)
|
||||
# while alive_procs := [p for p in processes.values() if p.is_alive()]:
|
||||
|
||||
for p in processes.values():
|
||||
logger.warning("Sending SIGKILL to %s", p)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user