release: v1.0.0

This commit is contained in:
WJG 2024-03-05 23:40:52 +08:00
parent e5a2889b8a
commit b88aa350fd
No known key found for this signature in database
GPG Key ID: 258474EF8590014A
7 changed files with 33 additions and 42 deletions

View File

@ -15,7 +15,7 @@
- **💬 流式响应**。爱情来得太快就像龙卷风,而你的小爱音箱也是,对你的爱意秒回,爱你不会让你等太久。
- **🧠 长短期记忆**。小爱音箱现在能记住你们之间的每一次对话,越聊越默契,就像是你身边的老朋友。
- **🔊 自定义 TTS**。厌倦了小爱同学的语音?帮你解锁[「豆包」](https://doubao.com)同款音色,就像真人在回你的消息。
- **🤖️ 智能家居 Agent**。心情不好?小爱立刻懂你,自动帮你播放喜欢的音乐,调节灯光,逗你开心。*TODO*
- **🤖️ 智能家居 Agent**。心情不好?小爱立刻懂你,自动帮你播放喜欢的音乐,调节灯光,逗你开心。_TODO_
## ⚡️ 使用教程
@ -27,6 +27,8 @@
#### 📦 Docker
[![Docker Image Version](https://img.shields.io/docker/v/idootop/mi-gpt?color=%23086DCD&label=docker%20image)](https://hub.docker.com/r/idootop/mi-gpt)
对于电脑小白或者不想自己配置代码运行环境Node的同学可以使用 Docker 启动方式。
请先按照[「配置参数」](#%EF%B8%8F-配置参数)章节,配置好你的 `.env``.migpt.js` 文件。然后使用以下命令启动 docker
@ -39,6 +41,8 @@ docker run -d --env-file $(pwd)/.env \
#### ⭐️ NPM
[![npm version](https://badge.fury.io/js/mi-gpt.svg)](https://www.npmjs.com/package/mi-gpt)
如果你是一名前端 (Node) 开发者,也可以通过 NPM 安装 `mi-gpt` 包的方式,使用代码启动 `MiGPT`
```shell

View File

@ -1,8 +0,0 @@
- ✅ Auto mute XiaoAi reply (not perfect yet)
- ✅ Stream response
- ✅ Deactivate Xiaoai
- ✅ Update long/short memories
- ✅ Logger
- ✅ Npm export
- ✅ 更新人设:你是[xxx]你[xxx]
- Docker

View File

@ -29,7 +29,7 @@
"axios": "^1.6.5",
"fs-extra": "^11.2.0",
"https-proxy-agent": "^7.0.4",
"mi-service-lite": "^2.2.0",
"mi-service-lite": "^2.3.0",
"openai": "^4.28.0",
"prisma": "^5.8.1"
},

View File

@ -93,7 +93,7 @@ export class MyBot {
if (config) {
this.speaker.name = config?.bot.name;
await this.speaker.response({
text: `我是${name},很高兴认识你!`,
text: `你好,我是${name},很高兴认识你!`,
keepAlive: this.speaker.keepAlive,
});
} else {

View File

@ -88,11 +88,11 @@ export class AISpeaker extends Speaker {
askAI: AISpeakerConfig["askAI"];
name: string;
switchSpeakerPrefix: string[];
onEnterAI: string[];
onExitAI: string[];
callAIPrefix: string[];
wakeUpKeywords: string[];
exitKeywords: string[];
onEnterAI: () => string[];
onExitAI: () => string[];
callAIPrefix: () => string[];
wakeUpKeywords: () => string[];
exitKeywords: () => string[];
onAIAsking: string[];
onAIError: string[];
audio_active?: string;
@ -119,23 +119,18 @@ export class AISpeaker extends Speaker {
this.audio_error = audio_error;
this.switchSpeakerPrefix =
switchSpeakerPrefix ?? getDefaultSwitchSpeakerPrefix();
this.wakeUpKeywords = wakeUpKeywords.map((e) => e + this.name);
this.exitKeywords = exitKeywords.map((e) => e + this.name);
this.onEnterAI = config.onEnterAI ?? [
`你好,我是${this.name},很高兴为你服务!`,
];
this.onExitAI = config.onExitAI ?? [`${this.name}已关闭!`];
this.callAIPrefix = config.callAIPrefix ?? [
"请",
"你",
this.name,
"问问" + this.name,
];
this.wakeUpKeywords = () => wakeUpKeywords.map((e) => e + this.name);
this.exitKeywords = () => exitKeywords.map((e) => e + this.name);
this.onEnterAI = () =>
config.onEnterAI ?? [`你好,我是${this.name},很高兴为你服务!`];
this.onExitAI = () => config.onExitAI ?? [`${this.name}已关闭!`];
this.callAIPrefix = () =>
config.callAIPrefix ?? ["请", "你", this.name, "问问" + this.name];
}
async enterKeepAlive() {
// 回应
await this.response({ text: pickOne(this.onEnterAI)!, keepAlive: true });
await this.response({ text: pickOne(this.onEnterAI())!, keepAlive: true });
// 唤醒
await super.enterKeepAlive();
}
@ -145,7 +140,7 @@ export class AISpeaker extends Speaker {
await super.exitKeepAlive();
// 回应
await this.response({
text: pickOne(this.onExitAI)!,
text: pickOne(this.onExitAI())!,
keepAlive: false,
playSFX: false,
});
@ -155,13 +150,13 @@ export class AISpeaker extends Speaker {
get commands() {
return [
{
match: (msg) => this.wakeUpKeywords.some((e) => msg.text.includes(e)),
match: (msg) => this.wakeUpKeywords().some((e) => msg.text.includes(e)),
run: async (msg) => {
await this.enterKeepAlive();
},
},
{
match: (msg) => this.exitKeywords.some((e) => msg.text.includes(e)),
match: (msg) => this.exitKeywords().some((e) => msg.text.includes(e)),
run: async (msg) => {
await this.exitKeepAlive();
},
@ -188,7 +183,7 @@ export class AISpeaker extends Speaker {
{
match: (msg) =>
this.keepAlive ||
this.callAIPrefix.some((e) => msg.text.startsWith(e)),
this.callAIPrefix().some((e) => msg.text.startsWith(e)),
run: (msg) => this.askAIForAnswer(msg),
},
] as SpeakerCommand[];

View File

@ -6,14 +6,14 @@ export const kAreYouOK = "¿ʞо ∩оʎ ǝɹɐ"; // are you ok?
export const kBannerASCII = `
/$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$$
/ $$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$$$
| $$$ /$$$|__/ /$$__ $$| $$__ $$|__ $$__/
| $$$$ /$$$$ /$$| $$ \__/| $$ \ $$ | $$
| $$$$ /$$$$ /$$| $$ \\__/| $$ \\ $$ | $$
| $$ $$/$$ $$| $$| $$ /$$$$| $$$$$$$/ | $$
| $$ $$$| $$| $$| $$|_ $$| $$____/ | $$
| $$\ $ | $$| $$| $$ \ $$| $$ | $$
| $$ \/ | $$| $$| $$$$$$/| $$ | $$
|__/ |__/|__/ \______/ |__/ |__/
| $$\\ $ | $$| $$| $$ \\ $$| $$ | $$
| $$ \\/ | $$| $$| $$$$$$/| $$ | $$
|__/ |__/|__/ \\______/ |__/ |__/
MiGPT v1.0.0 by: del-wang.eth

View File

@ -927,10 +927,10 @@ merge2@^1.3.0, merge2@^1.4.1:
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
mi-service-lite@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/mi-service-lite/-/mi-service-lite-2.2.0.tgz#30bcebaa8faeb83d1606be0c2ef552a4621dc722"
integrity sha512-rcepSHGA4yUOjI9Tim/1kgu6BzMGeblMl+Nm5aevlRoXw7vv/x8fGx3jiwMV+LX6aDyY7NABEBbjwdPc98wlGA==
mi-service-lite@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/mi-service-lite/-/mi-service-lite-2.3.0.tgz#cb24477e37b674d9f758790c9f8fbb3637de1753"
integrity sha512-a9r5quQjwGRz7aE7oOjLAJfgwp0E6nKpP2c/ZYbl6jYKsvz05f/e8bPGY73dDtCtQHGTONxPZjeoGraQbQLJZg==
dependencies:
axios "^1.6.5"
pako "^2.1.0"