diff --git a/docker-setup.sh b/docker-setup.sh index 04ea547a3..2067ef39d 100755 --- a/docker-setup.sh +++ b/docker-setup.sh @@ -74,6 +74,17 @@ else $DOWNLOAD_CMD "data/.config.yaml" "https://raw.githubusercontent.com/xinnan-tech/xiaozhi-esp32-server/main/main/xiaozhi-server/config.yaml" fi +# 下载量化模型 +echo "下载量化模型..." +mkdir -p models/all-MiniLM-L6-v2 +if [ "$DOWNLOAD_CMD" = "powershell -Command Invoke-WebRequest -Uri" ]; then + $DOWNLOAD_CMD "https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/all-MiniLM-L6-v2.zip" $DOWNLOAD_CMD_SUFFIX "models/all-MiniLM-L6-v2/all-MiniLM-L6-v2.zip" + +else + $DOWNLOAD_CMD "models/all-MiniLM-L6-v2.zip" "https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/all-MiniLM-L6-v2.zip" +fi +unzip models/all-MiniLM-L6-v2.zip -d models/all-MiniLM-L6-v2 + # 检查文件是否存在 echo "检查文件完整性..." FILES_TO_CHECK="docker-compose.yml data/.config.yaml models/SenseVoiceSmall/model.pt" diff --git a/docs/Deployment.md b/docs/Deployment.md index dfac9dcde..14241f678 100644 --- a/docs/Deployment.md +++ b/docs/Deployment.md @@ -306,6 +306,17 @@ LLM: - 线路二:百度网盘下载[SenseVoiceSmall](https://pan.baidu.com/share/init?surl=QlgM58FHhYv1tFnUT_A8Sg&pwd=qvna) 提取码: `qvna` +如果需要使用 oceanbase 的长期记忆向量化能力需要额外下载量化模型,用于把历史对话向量化到成向量化数据。目前支持 `all-MiniLM-L6-v2` 模型。因为模型较大,需要独立下载, + +``` +wget https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/all-MiniLM-L6-v2.zip +mkdir models/all-MiniLM-L6-v2 +``` +解压后放在`models/all-MiniLM-L6-v2`目录下。 + + +``` + ## 运行状态确认 如果你能看到,类似以下日志,则是本项目服务启动成功的标志。 diff --git a/main/xiaozhi-server/core/providers/memory/oceanbase/oceanbase.py b/main/xiaozhi-server/core/providers/memory/oceanbase/oceanbase.py index 95c6294ba..c5f49cd07 100644 --- a/main/xiaozhi-server/core/providers/memory/oceanbase/oceanbase.py +++ b/main/xiaozhi-server/core/providers/memory/oceanbase/oceanbase.py @@ -29,7 +29,7 @@ class MemoryProvider(MemoryProviderBase): self.model_path = config.get("model_path", "models/all-MiniLM-L6-v2") self.model_path = os.path.abspath(self.model_path) if not os.path.exists(self.model_path): - raise Exception(f"模型路径不存在,请下载到: {self.model_path}") + raise Exception(f"模型路径不存在,请下载量化模型 https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/all-MiniLM-L6-v2.zip 并解压到: {self.model_path}") print(f"连接到 oceanbase 服务: {self.uri}") self.client = self.connect_to_client()