Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SchneeHertz committed Mar 18, 2023
1 parent 6201c5e commit 37f94a7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 SchneeHertz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# Vue 3 + Vite
# chat-xiuliu

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
虚拟主播休留的双向语音单机版
[Bilibili 直播间](https://live.bilibili.com/27228804)

## Recommended IDE Setup
<img src="https://raw.githubusercontent.com/SchneeHertz/chat-xiuliu/master/public/chat-xiuliu.png" alt="chat-xiuliu.png" width="256"/>

- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## 功能
- 从麦克风或界面接收问题
- 使用语音回答问题并显示在界面

## 使用说明
1. 下载并安装sox https://sourceforge.net/projects/sox/files/sox/14.4.1/
2. 将sox所在文件夹添加到环境变量Path中
3. 下载sox MP3组件 https://www.videohelp.com/software?d=sox-14.4.0-libmad-libmp3lame.zip
4. 将libmp3lame.dll放入sox所在文件夹
5. 打开chat-xiuliu, 点击Open Config, 编辑配置文件
5. 获取一个openai的API key, 填入配置文件中
6. 创建一个Azure的语音资源 https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices , 区域见配置文件,将取得的API key 填入配置文件中
7. 修改配置文件的其他部分(可选)
8. 保存配置文件后重启chat-xiuliu

## 其他
关注休留喵,关注休留谢谢喵~
上舰或者[爱发电](https://afdian.net/a/xiuliu)捐赠等额可进舰长群727536542, 管理员提供附加的有限的技术支持
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
OPENAI_API_KEY, USE_MODEL,
SPEECH_KEY, SPEECH_AREA, SpeechSynthesisLanguage, SpeechSynthesisVoiceName,
ADMIN_NAME, AI_NAME,
speechPrompt,
systemPrompt,
} = config

let logFile = fs.createWriteStream(path.join(LOG_PATH, `log-${new Date().toLocaleString('zh-CN').replace(/[\/:]/gi, '-')}.txt`), {flags: 'w'})
Expand Down Expand Up @@ -121,7 +121,7 @@ const resloveAdminPrompt = async ({prompt, triggerRecord})=> {
context.push({role: 'assistant', content: conversation.assistant})
}
messages = [
{role: 'system', content: speechPrompt},
{role: 'system', content: systemPrompt},
{role: 'user', content: `我和${AI_NAME}的对话内容?`},
{role: 'assistant', content: history.memory},
{role: 'user', content: `我的名字是${ADMIN_NAME}`},
Expand Down Expand Up @@ -165,7 +165,7 @@ const updateMemory = ()=>{
context.push({role: 'assistant', content: conversation.assistant})
}
let messages = [
{role: 'system', content: speechPrompt},
{role: 'system', content: systemPrompt},
{role: 'user', content: `我和${AI_NAME}的对话内容?`},
{role: 'assistant', content: history.memory},
{role: 'user', content: `我的名字是${ADMIN_NAME}`},
Expand Down
Binary file added public/chat-xiuliu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions utils/initFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ try {
SPEECH_AREA: 'eastasia',
SpeechSynthesisLanguage: 'zh-CN',
SpeechSynthesisVoiceName: 'zh-CN-XiaoyiNeural',
ADMIN_NAME: '雪儿',
ADMIN_NAME: 'Chell',
AI_NAME: '休留',
speechPrompt: '你是女高中生休留'
systemPrompt: '你是女高中生休留'
}
fs.writeFileSync(path.join(STORE_PATH, 'config.json'), JSON.stringify(config, null, ' '), {encoding: 'utf-8'})
}
Expand Down

0 comments on commit 37f94a7

Please sign in to comment.