diff --git a/README_ZH.md b/README_ZH.md index f3d8c551..d09fb702 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -49,7 +49,7 @@ MemoryScope 是一个为LLM聊天机器人服务的强大且灵活的长期记 ## 🚀 安装 -完整的安装方法请参考[Installation.md](docs/Installation.md)。 +完整的安装方法请参考[安装指南](docs/installation_zh.md)。 ### 一键运行Demo diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 00000000..75bf8cf2 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,101 @@ +# Installing MemoryScope + +## I. Install with docker [Recommended] +1. Clone the repository and edit settings + ```bash + # clone project + git clone https://github.com/modelscope/memoryscope + cd memoryscope + # edit configuration, e.g. add api keys + vim memoryscope/core/config/demo_config_zh.yaml + ``` + +2. Build Docker image + ```bash + sudo docker build --network=host -t memoryscope . + ``` + + +3. Launch Docker container + ```bash + sudo docker run -it --rm --net=host memoryscope + ``` + + +## II. Install with docker compose [Recommended] + + +1. Clone the repository and edit settings + ```bash + # clone project + git clone https://github.com/modelscope/memoryscope + cd memoryscope + # edit configuration, e.g. add api keys + vim memoryscope/core/config/demo_config_zh.yaml + ``` + + +2. Edit `docker-compose.yml` to change environment variable. + ``` + DASHSCOPE_API_KEY: "sk-0000000000" + ``` + +3. Run `docker-compose up` to build and launch the memory-scope cli interface. + + +## III. Install from PYPI [Linux only] + +1. Install from pypi: + + ```bash + pip install memoryscope + ``` + + +2. test Chinese / Dashscope chat configuration: + + ```bash + export DASHSCOPE_API_KEY="sk-0000000000" + memoryscope --config_path=memoryscope/core/config/demo_config_zh.yaml + ``` + +3. test English / OpenAI chat configuration: + + ```bash + export OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + python quick-start-demo.py --config_path=memoryscope/core/config/demo_config.yaml + ``` + + +## IV. Install from source [Linux only] + +1. Clone the repository and edit settings + ```bash + # clone project + git clone https://github.com/modelscope/memoryscope + cd memoryscope + # edit configuration, e.g. add api keys + vim memoryscope/core/config/demo_config_zh.yaml + ``` + +2. Install + ```bash + poetry install + ``` + +3. Run Elasticsearch service, refer to [elasticsearch documents](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started.html). +The docker method is recommended: + ``` + sudo docker run -p 9200:9200 \ + -e "discovery.type=single-node" \ + -e "xpack.security.enabled=false" \ + -e "xpack.license.self_generated.type=trial" \ + docker.elastic.co/elasticsearch/elasticsearch:8.13.2 + ``` + +4. Launch memoryscope, also refer to [cli documents](../examples/cli/README.md) + ```bash + pip install -r requirements.txt + export DASHSCOPE_API_KEY="sk-0000000000" + python quick-start-demo.py --config_path=memoryscope/core/config/demo_config_zh.yaml + ``` diff --git a/docs/installation_zh.md b/docs/installation_zh.md new file mode 100644 index 00000000..e5b9d604 --- /dev/null +++ b/docs/installation_zh.md @@ -0,0 +1,96 @@ +# MemoryScope 安装指南 + +## 一、使用 Docker 安装 [推荐] + +1. 克隆仓库并编辑配置 + ```bash + # 克隆项目 + git clone https://github.com/modelscope/memoryscope + cd memoryscope + # 编辑配置,例如添加 API 密钥 + vim memoryscope/core/config/demo_config_zh.yaml + ``` + +2. 构建 Docker 镜像 + ```bash + sudo docker build --network=host -t memoryscope . + ``` + +3. 启动 Docker 容器 + ```bash + sudo docker run -it --rm --net=host memoryscope + ``` + + +## 二、使用 Docker Compose 安装 [推荐] + +1. 克隆仓库并编辑配置 + ```bash + # 克隆项目 + git clone https://github.com/modelscope/memoryscope + cd memoryscope + # 编辑配置,例如添加 API 密钥 + vim memoryscope/core/config/demo_config_zh.yaml + ``` + +2. 编辑 `docker-compose.yml` 文件以更改环境变量。 + ``` + DASHSCOPE_API_KEY: "sk-0000000000" + ``` + +3. 运行 `docker-compose up` 命令来构建并启动 MemoryScope CLI 界面。 + + +## 三、通过 PYPI 安装 [仅限 Linux] + +1. 从 PyPI 安装: + ```bash + pip install memoryscope + ``` + +2. 测试中文 / Dashscope 对话配置: + ```bash + export DASHSCOPE_API_KEY="sk-0000000000" + memoryscope --config_path=memoryscope/core/config/demo_config_zh.yaml + ``` + +3. 测试英文 / OpenAI 对话配置: + ```bash + export OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + python quick-start-demo.py --config_path=memoryscope/core/config/demo_config.yaml + ``` + + +## 四、从源码安装 [仅限 Linux] + +1. 克隆仓库并编辑设置 + ```bash + # 克隆项目 + git clone https://github.com/modelscope/memoryscope + cd memoryscope + # 编辑配置,例如添加 API 密钥 + vim memoryscope/core/config/demo_config_zh.yaml + ``` + +2. 安装依赖 + ```bash + poetry install + ``` + +3. 运行 Elasticsearch 服务,参照 [Elasticsearch 文档](https://www.elastic.co/guide/cn/elasticsearch/reference/current/getting-started.html)。 +推荐使用 Docker 方法: + ``` + sudo docker run -p 9200:9200 \ + -e "discovery.type=single-node" \ + -e "xpack.security.enabled=false" \ + -e "xpack.license.self_generated.type=trial" \ + docker.elastic.co/elasticsearch/elasticsearch:8.13.2 + ``` + +4. 启动 MemoryScope,同时参考 [CLI 文档](../examples/cli/README.md) + ```bash + pip install -r requirements.txt + export DASHSCOPE_API_KEY="sk-0000000000" + python quick-start-demo.py --config_path=memoryscope/core/config/demo_config_zh.yaml + ``` + diff --git a/quick-start-demo.py b/quick-start-demo.py index 91d1dd07..203ad412 100644 --- a/quick-start-demo.py +++ b/quick-start-demo.py @@ -1,7 +1,7 @@ import os if os.environ.get('DASHSCOPE_API_KEY', None) is None \ - and os.environ.get('API_KEY', None) is None: + and os.environ.get('OPENAI_API_KEY', None) is None: os.environ['DASHSCOPE_API_KEY'] = \ input( '\n\n'