From f973bc3fe2bedaa9d10e2818a059ea967887322a Mon Sep 17 00:00:00 2001 From: lanvent Date: Tue, 4 Apr 2023 19:35:59 +0800 Subject: [PATCH] add requirements-optional.txt --- .github/ISSUE_TEMPLATE.md | 7 ++++--- README.md | 16 ++++++++++++---- docker/Dockerfile.alpine | 1 + docker/Dockerfile.debian | 3 ++- docker/Dockerfile.debian.latest | 1 + docker/Dockerfile.latest | 3 ++- requirements-optional.txt | 18 ++++++++++++++++++ requirements.txt | 13 +------------ 8 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 requirements-optional.txt diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 62c98d3..4abe428 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,8 +4,9 @@ 2. python 已安装:版本在 3.7 ~ 3.10 之间 3. `git pull` 拉取最新代码 4. 执行`pip3 install -r requirements.txt`,检查依赖是否满足 -5. 在已有 issue 中未搜索到类似问题 -6. [FAQS](https://github.com/zhayujie/chatgpt-on-wechat/wiki/FAQs) 中无类似问题 +5. 拓展功能请执行`pip3 install -r requirements-optional.txt`,检查依赖是否满足 +6. 在已有 issue 中未搜索到类似问题 +7. [FAQS](https://github.com/zhayujie/chatgpt-on-wechat/wiki/FAQs) 中无类似问题 ### 问题描述 @@ -18,7 +19,7 @@ ### 终端日志 (如有报错) ``` -[在此处粘贴终端日志] +[在此处粘贴终端日志, 可在主目录下`run.log`文件中找到] ``` diff --git a/README.md b/README.md index d0e3cb2..dc00646 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ ### 2.运行环境 支持 Linux、MacOS、Windows 系统(可在Linux服务器上长期运行),同时需安装 `Python`。 -> 建议Python版本在 3.7.1~3.9.X 之间,3.10及以上版本在 MacOS 可用,其他系统上不确定能否正常运行。 +> 建议Python版本在 3.7.1~3.9.X 之间,推荐3.8版本,3.10及以上版本在 MacOS 可用,其他系统上不确定能否正常运行。 **(1) 克隆项目代码:** @@ -80,9 +80,15 @@ cd chatgpt-on-wechat/ pip3 install -r requirements.txt ``` -其中`tiktoken`要求`python`版本在3.8以上,它用于精确计算会话使用的tokens数量,可以不装但建议安装。 +**(3) 拓展依赖 (可选,建议安装):** + +```bash +pip3 install -r requirements-optional.txt +``` +> 如果某项依赖安装失败请注释掉对应的行再继续。 + +其中`tiktoken`要求`python`版本在3.8以上,它用于精确计算会话使用的tokens数量,强烈建议安装。 -**(3) 拓展依赖 (可选):** 使用`google`或`baidu`语音识别需安装`ffmpeg`, @@ -90,10 +96,12 @@ pip3 install -r requirements.txt 参考[#415](https://github.com/zhayujie/chatgpt-on-wechat/issues/415) -使用`azure`语音功能需安装依赖: +使用`azure`语音功能需安装依赖(列在`requirements-optional.txt`内,但为便于`railway`部署已注释): + ```bash pip3 install azure-cognitiveservices-speech ``` + > 目前默认发布的镜像和`railway`部署,都基于`apline`,无法安装`azure`的依赖。若有需求请自行基于[`debian`](https://github.com/zhayujie/chatgpt-on-wechat/blob/master/docker/Dockerfile.debian.latest)打包。 参考[文档](https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?pivots=programming-language-python&tabs=linux%2Cubuntu%2Cdotnet%2Cjre%2Cmaven%2Cnodejs%2Cmac%2Cpypi) diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 6b3b1fb..324a76e 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -23,6 +23,7 @@ RUN apk add --no-cache \ && cp config-template.json ${BUILD_PREFIX}/config.json \ && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ && pip install --no-cache -r requirements.txt \ + && pip install --no-cache -r requirements-optional.txt \ && apk del curl wget WORKDIR ${BUILD_PREFIX} diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 0a17ae5..dfd289d 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -23,7 +23,8 @@ RUN apt-get update \ && cd ${BUILD_PREFIX} \ && cp config-template.json ${BUILD_PREFIX}/config.json \ && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ - && pip install --no-cache -r requirements.txt + && pip install --no-cache -r requirements.txt \ + && pip install --no-cache -r requirements-optional.txt WORKDIR ${BUILD_PREFIX} diff --git a/docker/Dockerfile.debian.latest b/docker/Dockerfile.debian.latest index 6e5a3fe..95bb352 100644 --- a/docker/Dockerfile.debian.latest +++ b/docker/Dockerfile.debian.latest @@ -16,6 +16,7 @@ RUN apt-get update \ && cp config-template.json config.json \ && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ && pip install --no-cache -r requirements.txt \ + && pip install --no-cache -r requirements-optional.txt \ && pip install azure-cognitiveservices-speech WORKDIR ${BUILD_PREFIX} diff --git a/docker/Dockerfile.latest b/docker/Dockerfile.latest index 53bb41b..c9a5a55 100644 --- a/docker/Dockerfile.latest +++ b/docker/Dockerfile.latest @@ -13,7 +13,8 @@ RUN apk add --no-cache bash ffmpeg espeak \ && cd ${BUILD_PREFIX} \ && cp config-template.json config.json \ && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ - && pip install --no-cache -r requirements.txt + && pip install --no-cache -r requirements.txt \ + && pip install --no-cache -r requirements-optional.txt WORKDIR ${BUILD_PREFIX} diff --git a/requirements-optional.txt b/requirements-optional.txt new file mode 100644 index 0000000..1b6ff50 --- /dev/null +++ b/requirements-optional.txt @@ -0,0 +1,18 @@ +tiktoken>=0.3.2 # openai calculate token + +#voice +pydub>=0.25.1 # need ffmpeg +SpeechRecognition # google speech to text +gTTS>=2.3.1 # google text to speech +pyttsx3>=2.90 # pytsx text to speech +baidu_aip>=4.16.10 # baidu voice +# azure-cognitiveservices-speech # azure voice + +# wechaty +wechaty>=0.10.7 +wechaty_puppet>=0.4.23 +pysilk_mod>=1.6.0 # needed by send voice + +# webuiapi plugin +webuiapi>=0.6.2 + diff --git a/requirements.txt b/requirements.txt index a38c622..4e1e6a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,6 @@ openai>=0.27.2 -baidu_aip>=4.16.10 -gTTS>=2.3.1 HTMLParser>=0.0.2 -pydub>=0.25.1 PyQRCode>=1.2.1 -pysilk>=0.0.1 -pysilk_mod>=1.6.0 -pyttsx3>=2.90 qrcode>=7.4.2 requests>=2.28.2 -webuiapi>=0.6.2 -wechaty>=0.10.7 -wechaty_puppet>=0.4.23 -chardet>=5.1.0 -SpeechRecognition -tiktoken>=0.3.2 \ No newline at end of file +chardet>=5.1.0 \ No newline at end of file