Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zRzRzRzRzRzRzR committed Jun 20, 2024
1 parent d4fbcc7 commit b874bb4
Show file tree
Hide file tree
Showing 12 changed files with 650 additions and 148 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- master
paths-ignore:
- 'README.md'
- 'README_en.md'
- 'README_en.md'
- 'README_ja.md'
env:
Expand Down Expand Up @@ -140,15 +140,15 @@ jobs:
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update README.md
- name: Update README_en.md
run: |
sed -i "s|uswccr.ccs.tencentyun.com/chatchat/chatchat:[^ ]*|uswccr.ccs.tencentyun.com/chatchat/chatchat:${{ steps.imageTag.outputs.image_tag }}|g" README.md
sed -i "s|uswccr.ccs.tencentyun.com/chatchat/chatchat:[^ ]*|uswccr.ccs.tencentyun.com/chatchat/chatchat:${{ steps.imageTag.outputs.image_tag }}|g" README_en.md
sed -i "s|uswccr.ccs.tencentyun.com/chatchat/chatchat:[^ ]*|uswccr.ccs.tencentyun.com/chatchat/chatchat:${{ steps.imageTag.outputs.image_tag }}|g" README_ja.md
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "feat:update docker image:tag"
- name: Push README.md
- name: Push README_en.md
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PAT }}
Expand Down
2 changes: 1 addition & 1 deletion README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ cd /root/anaconda3/envs/chatchat/lib/python3.11/site-packages/chatchat
vim model_providers.yaml
```

Refer to [model-providers/README.md](libs/model-providers/README.md) for configuration instructions.
Refer to [model-providers/README.md](libs/model-providers/README_en.md) for configuration instructions.

Refer to [model_providers.yaml](libs/model-providers/model_providers.yaml) for detailed configuration.

Expand Down
12 changes: 8 additions & 4 deletions docs/contributing/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@

### 贡献指南

各位开发者,chatchat由个人组织经过了不断地迭代和完善,作为一个不断进化的项目,
我们欢迎您的参与,无论是提交bug报告、功能请求、代码贡献、文档编写、测试、或者其他形式的贡献。

#### 贡献方式

这里列出了一些您可以为chatchat做出贡献的方式:

- [Code](code.md): 帮助我们编写代码,修复bug,或者改进基础设施。
- Documentation: 帮助我们编写文档,使chatchat更容易使用。
- Discussions: 帮助回答用户的使用问题,讨论问题。
当您的贡献被接受后,我们会将您的名字添加到贡献者列表中。
在功能贡献达到2次以上,我们会考虑将您加入到chatchat的开发团队中。
- Discussions: 帮助回答用户的使用问题,讨论问题。
当您的贡献被接受后,我们会将您的名字添加到贡献者列表中。
在功能贡献达到2次以上,我们会考虑将您加入到chatchat的开发团队中。

#### Github Issue

我们需要跟踪功能请求与bug报告

目前我们有使用Issue默认模板来让用户更好的描述问题,但是目前这个大部分issue的用户可能依然选择只回复一句话,
Expand All @@ -23,6 +26,7 @@
我们努力保持issue的更新,但是我们也需要您的帮助,如果您发现有问题没有得到及时回复,请在issue下@我们。

#### 寻求帮助

我们尽量使开发者更容易上手,当您遇到问题时,请联系维护人员,我们会尽力帮助您。

类似的 diff、formatting、linting、testing等问题,如果您不确定如何解决,请随时联系我们,
Expand Down
16 changes: 12 additions & 4 deletions docs/contributing/README_dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#### 源码启动chatchat-server

- 安装chatchat

```shell
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
```
Expand All @@ -10,14 +11,15 @@ git clone https://github.com/chatchat-space/Langchain-Chatchat.git
> [Code](code.md): 源码配置可以帮助我们更快的寻找bug,或者改进基础设施。
- 关于chatchat-config

> chatchat-config由ConfigWorkSpace接口提供知识库配置载入存储
>
> 具体实现可以参考basic_config.py
>
- ConfigWorkSpace接口说明
```text

```text
ConfigWorkSpace是一个配置工作空间的抽象类,提供基础的配置信息存储和读取功能。
提供ConfigFactory建造方法产生实例。
该类的实例对象用于存储工作空间的配置信息,如工作空间的路径等
Expand All @@ -29,26 +31,32 @@ ConfigWorkSpace是一个配置工作空间的抽象类,提供基础的配置

> 我们抽象了不同平台提供的 全局配置`provider_credential`,和模型配置`model_credential`
>关于设计文稿,请查看 [README_CN.md](../../libs/model-providers/model_providers/core/model_runtime/README_CN.md)
> 关于设计文稿,请查看 [README_CN.md](../../libs/model-providers/model_providers/core/model_runtime/README)
- 平台配置

> 注意: 在您配置平台之前,请确认平台依赖完整,例如智谱平台,您需要安装智谱sdk `pip install zhipuai`
>
> 详细配置请参考[README.md](../../libs/model-providers/README.md)

- 初始化仓库(使用默认 embedding 模型)

> 请注意:这个命令会清空数据库,如果您有重要数据,请备份
```shell
cd Langchain-Chatchat/libs/chatchat-server/chatchat
python init_database.py --recreate-vs
```

- 初始化仓库(指定 embedding 模型)

```shell
cd Langchain-Chatchat/libs/chatchat-server/chatchat
python init_database.py --recreate-vs --embed-model=text-embedding-3-small # embedding 模型名称
```

- 启动服务

```shell
cd Langchain-Chatchat/libs/chatchat-server/chatchat
python startup.py -a
Expand Down
187 changes: 187 additions & 0 deletions docs/install/README_xinference_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
#### xinference Installation Guide

- init conda

```shell
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ rm -rf ~/miniconda3/
$ bash Miniconda3-latest-Linux-x86_64.sh
$ conda config --remove channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
$ conda config --remove channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

```

- Create chatchat environment

```shell
$ conda create -p ~/miniconda3/envs/chatchat python=3.8
$ conda activate ~/miniconda3/envs/chatchat
$ pip install langchain-chatchat -U
$ pip install xinference_client faiss-gpu "unstructured[pdf]"
```

- Create xinference environment

```shell
$ conda create -p ~/miniconda3/envs/xinference python=3.8
$ conda activate ~/miniconda3/envs/xinference
$ pip install xinference --force
$ pip install tiktoken sentence-transformers
```

- Start the xinference service

```shell
$ conda activate ~/miniconda3/envs/xinference
$ xinference-local
```

- Edit the registration model script

```shell
$ vim model_registrations.sh
# Add the following content. The model path needs to be modified according to the actual situation
curl 'http://127.0.0.1:9997/v1/model_registrations/LLM' \
-H 'Accept: */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: token=no_auth' \
-H 'Origin: http://127.0.0.1:9997' \
-H 'Referer: http://127.0.0.1:9997/ui/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
--data-raw '{"model":"{\"version\":1,\"model_name\":\"autodl-tmp-glm-4-9b-chat\",\"model_description\":\"autodl-tmp-glm-4-9b-chat\",\"context_length\":2048,\"model_lang\":[\"en\",\"zh\"],\"model_ability\":[\"generate\",\"chat\"],\"model_family\":\"glm4-chat\",\"model_specs\":[{\"model_uri\":\"/root/autodl-tmp/glm-4-9b-chat\",\"model_size_in_billions\":9,\"model_format\":\"pytorch\",\"quantizations\":[\"none\"]}],\"prompt_style\":{\"style_name\":\"CHATGLM3\",\"system_prompt\":\"\",\"roles\":[\"user\",\"assistant\"],\"intra_message_sep\":\"\",\"inter_message_sep\":\"\",\"stop\":[\"<|endoftext|>\",\"<|user|>\",\"<|observation|>\"],\"stop_token_ids\":[151329,151336,151338]}}","persist":true}'
```

- Edit and register embedding script

```shell
$ vim model_registrations_emb.sh
# 添加以下内容。模型路径需要根据实际情况修改
curl 'http://127.0.0.1:9997/v1/model_registrations/embedding' \
-H 'Accept: */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: token=no_auth' \
-H 'Origin: http://127.0.0.1:9997' \
-H 'Referer: http://127.0.0.1:9997/ui/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
--data-raw '{"model":"{\"model_name\":\"autodl-tmp-bge-large-zh\",\"dimensions\":768,\"max_tokens\":512,\"model_uri\":\"/root/model/bge-large-zh\",\"language\":[\"en\",\"zh\"]}","persist":true}'
```

- Edit the startup model script

```shell
$ vim start_models.sh
# 添加以下内容。模型路径需要根据实际情况修改
curl 'http://127.0.0.1:9997/v1/models' \
-H 'Accept: */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: token=no_auth' \
-H 'Origin: http://127.0.0.1:9997' \
-H 'Referer: http://127.0.0.1:9997/ui/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
--data-raw '{"model_uid":null,"model_name":"autodl-tmp-glm-4-9b-chat","model_type":"LLM","model_engine":"Transformers","model_format":"pytorch","model_size_in_billions":9,"quantization":"none","n_gpu":"auto","replica":1,"request_limits":null,"worker_ip":null,"gpu_idx":null}'
```

- Edit and start embedding script

```shell
$ vim start_models_emb.sh
# 添加以下内容。模型路径需要根据实际情况修改
curl 'http://127.0.0.1:9997/v1/models' \
-H 'Accept: */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: token=no_auth' \
-H 'Origin: http://127.0.0.1:9997' \
-H 'Referer: http://127.0.0.1:9997/ui/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
--data-raw '{"model_uid":"bge-large-zh-v1.5","model_name":"autodl-tmp-bge-large-zh","model_type":"embedding","replica":1,"n_gpu":"auto","worker_ip":null,"gpu_idx":null}'
```

- Start the model

```shell
$ bash ./model_registrations.sh
$ bash ./model_registrations_emb.sh
$ bash ./start_models.sh
$ bash ./start_models_emb.sh

```

- Initialize chatchat configuration

```shell
$ conda activate ~/miniconda3/envs/chatchat
$ chatchat-config basic --verbose true
$ chatchat-config basic --data ~/chatchat-data
$ cp ~/miniconda3/envs/chatchat/lib/python3.8/site-packages/chatchat/configs/model_providers.yaml ~/chatchat-data/
```

- Set up the model

```shell
$ vim ~/chatchat-data/model_providers.yaml
# 修改model_providers.yaml文件,添加如下内容

xinference:
model_credential:
- model: 'autodl-tmp-glm-4-9b-chat'
model_type: 'llm'
model_credentials:
server_url: 'http://127.0.0.1:9997/'
model_uid: 'autodl-tmp-glm-4-9b-chat'
completion_type: 'chat'
- model: 'bge-large-zh-v1.5'
model_type: 'embeddings'
model_credentials:
server_url: 'http://127.0.0.1:9997/'
model_uid: 'bge-large-zh-v1.5'
```

- Initialize knowledge base

```shell
$ conda activate ~/miniconda3/envs/chatchat
$ chatchat-kb -r

```

- Start chatchat

```shell
$ conda activate ~/miniconda3/envs/chatchat
$ chatchat -a

```
Loading

0 comments on commit b874bb4

Please sign in to comment.