From 61cd0557c166a9f51e7aedcaf44ab3bd56677b6d Mon Sep 17 00:00:00 2001 From: Hadouken <2340896+cyfyifanchen@users.noreply.github.com> Date: Tue, 30 Jul 2024 19:42:23 +0800 Subject: [PATCH] Update README-CN.md (#135) --- docs/readmes/README-CN.md | 129 +++++++++++++------------------------- 1 file changed, 42 insertions(+), 87 deletions(-) diff --git a/docs/readmes/README-CN.md b/docs/readmes/README-CN.md index adc568ad..80521e20 100644 --- a/docs/readmes/README-CN.md +++ b/docs/readmes/README-CN.md @@ -16,8 +16,8 @@ [![GitHub forks](https://img.shields.io/github/forks/rte-design/astra.ai?style=social&label=Fork)](https://GitHub.com/rte-design/astra.ai/network/?WT.mc_id=academic-105485-koreyst) [![GitHub stars](https://img.shields.io/github/stars/rte-design/astra.ai?style=social&label=Star)](https://GitHub.com/rte-design/astra.ai/stargazers/?WT.mc_id=academic-105485-koreyst) -README in English -简体中文 +README in English +简体中文
@@ -63,80 +63,68 @@ $ go env -w GO111MODULE=on $ go env -w GOPROXY=https://goproxy.cn,direct ``` -#### 1. 在 Docker 镜像中构建 agent +#### 1.创建 manifest 配置文件 +从示例文件创建 manifest: ```bash -# 从示例文件创建 manifest cp ./agents/manifest.json.example ./agents/manifest.json +``` -# 拉取带有开发工具的 Docker 镜像,并将当前文件夹挂载为工作区 -docker run -itd -v $(pwd):/app -w /app -p 8080:8080 --name astra_agents_dev ghcr.io/rte-design/astra_agents_build - -# 对于 Windows Git Bash -# docker run -itd -v //$(pwd):/app -w //app -p 8080:8080 --name astra_agents_dev ghcr.io/rte-design/astra_agents_build - -# 进入 Docker 镜像 -docker exec -it astra_agents_dev bash +#### 2. 基本配置 -# 构建 agent -make build +在 manifest 里面找到下列属性替换: +```json +"app_id": "" +"api_key": "" +"agora_asr_vendor_key": "" +"agora_asr_vendor_region": "" +"azure_subscription_key": "" +"azure_subscription_region": "" ``` -#### 2. 改动 prompts -上述代码生成了一个代理可执行文件。要自定义提示和 OpenAI 参数,请修改 `agents/addon/extension/openai_chatgpt/openai_chatgpt.go` 中的以下代码: - -```go -func defaultOpenaiChatGPTConfig() openaiChatGPTConfig { - return openaiChatGPTConfig{ - BaseUrl: "https://api.openai.com/v1", - ApiKey: "", - Model: openai.GPT4o, - Prompt: "You are a voice assistant who talks in a conversational way and can chat with me like my friends. i will speak to you in english or chinese, and you will answer in the corrected and improved version of my text with the language i use. Don't talk like a robot, instead i would like you to talk like real human with emotions. i will use your answer for text-to-speech, so don't return me any meaningless characters. I want you to be helpful, when i'm asking you for advices, give me precise, practical and useful advices instead of being vague. When giving me list of options, express the options in a narrative way instead of bullet points.", - FrequencyPenalty: 0.9, - PresencePenalty: 0.9, - TopP: 1.0, - Temperature: 0.1, - MaxTokens: 512, - Seed: rand.Int(), - ProxyUrl: "", - } +#### 3. 定制化 +在 manifest 可以直接改 propmt 和问候语: +```json +"property": { + "base_url": "", + "api_key": "", + "frequency_penalty": 0.9, + "model": "gpt-3.5-turbo", + "max_tokens": 512, + "prompt": "", + "proxy_url": "", + "greeting": "ASTRA agent connected. How can i help you today?", + "max_memory_length": 10 } ``` -#### 3. 启动本地服务器 +#### 4. 在 Docker 镜像中构建 agent -通过运行以下终端命令启动服务器: +打开 Terminal, 跑下列命令: ```bash -# Agora App ID and Agora App Certificate -export AGORA_APP_ID= -export AGORA_APP_CERTIFICATE= +# 拉取带有开发工具的 Docker 镜像,并将当前文件夹挂载为工作区 +docker run -itd -v $(pwd):/app -w /app -p 8080:8080 --name astra_agents_dev ghcr.io/rte-design/astra_agents_build -# OpenAI API key -export OPENAI_API_KEY= +# 对于 Windows Git Bash +# docker run -itd -v //$(pwd):/app -w //app -p 8080:8080 --name astra_agents_dev ghcr.io/rte-design/astra_agents_build -# Azure STT key and region -export AZURE_STT_KEY= -export AZURE_STT_REGION= +# 进入 Docker 容器 +docker exec -it astra_agents_dev bash -# TTS -# Here are three TTS options, either one will work -# Make sure to comment out the one you don't use +# 在容器里构建 agent +make build +``` -# 1. using Azure -export TTS_VENDOR_CHINESE=azure -export AZURE_TTS_KEY= -export AZURE_TTS_REGION= +#### 5. 启动本地服务器 -# 2. using ElevenLabs -export TTS_VENDOR_ENGLISH=elevenlabs -export ELEVENLABS_TTS_KEY= +```bash # Agent is ready to start on port 8080 make run-server ``` -#### 4. 运行 voice agent 界面 +#### 6. 运行 voice agent 界面 voice agent 界面是基于 NextJS 14 构建的,因此需要 Node 18 或更高版本。 @@ -149,7 +137,7 @@ cp .env.example .env npm install && npm run dev ``` -#### 5. 验证您定制的 voice agent 🎉 +#### 7. 验证您定制的 voice agent 🎉 在浏览器中打开 `localhost:3000`,您应该能够看到一个与示例项目一样的 voice angent,但是这次是带有定制的 voice agent。 @@ -172,39 +160,6 @@ npm install && npm run dev ![ASTRAvoice agent架构图](../../images/image-2.png) -
-

搭建无界面的 voice agent

- -#### 1. 在 Docker 镜像中搭建 voice agent - -``` -# 从示例文件创建 manifest -cp ./agents/manifest.json.example ./agents/manifest.json - -# 拉取带有开发工具的 Docker 镜像,并将当前文件夹挂载为工作区 -docker run -itd -v $(pwd):/app -w /app -p 8080:8080 --name astra_agents_dev ghcr.io/rte-design/astra_agents_build - -# 对于 Windows Git Bash -# docker run -itd -v //$(pwd):/app -w //app -p 8080:8080 --name astra_agents_dev ghcr.io/rte-design/astra_agents_build - -# 进入 Docker 镜像 -docker exec -it astra_agents_dev bash - -# 构建 agent -make build - -# 启动 agent -cd ./agents && ./bin/start -``` - -#### 2. 测试 voice agent - -前往 [Agora Web Demo](https://webdemo.agora.io/) 进行快速测试。 - -请注意,`channel` 和 `remote_stream_id` 需要与您在 `https://webdemo.agora.io/` 上使用的一致。 - -输入相应的 RTC ID 和频道名称后,您应该能够看到日志并听到音频输出。 -

ASTRA 服务