mirror of
https://github.com/idootop/mi-gpt.git
synced 2025-04-12 23:27:18 +00:00
release: v1.0.0
This commit is contained in:
parent
e5a2889b8a
commit
b88aa350fd
|
@ -15,7 +15,7 @@
|
||||||
- **💬 流式响应**。爱情来得太快就像龙卷风,而你的小爱音箱也是,对你的爱意秒回,爱你不会让你等太久。
|
- **💬 流式响应**。爱情来得太快就像龙卷风,而你的小爱音箱也是,对你的爱意秒回,爱你不会让你等太久。
|
||||||
- **🧠 长短期记忆**。小爱音箱现在能记住你们之间的每一次对话,越聊越默契,就像是你身边的老朋友。
|
- **🧠 长短期记忆**。小爱音箱现在能记住你们之间的每一次对话,越聊越默契,就像是你身边的老朋友。
|
||||||
- **🔊 自定义 TTS**。厌倦了小爱同学的语音?帮你解锁[「豆包」](https://doubao.com)同款音色,就像真人在回你的消息。
|
- **🔊 自定义 TTS**。厌倦了小爱同学的语音?帮你解锁[「豆包」](https://doubao.com)同款音色,就像真人在回你的消息。
|
||||||
- **🤖️ 智能家居 Agent**。心情不好?小爱立刻懂你,自动帮你播放喜欢的音乐,调节灯光,逗你开心。*TODO*
|
- **🤖️ 智能家居 Agent**。心情不好?小爱立刻懂你,自动帮你播放喜欢的音乐,调节灯光,逗你开心。_TODO_
|
||||||
|
|
||||||
## ⚡️ 使用教程
|
## ⚡️ 使用教程
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#### 📦 Docker
|
#### 📦 Docker
|
||||||
|
|
||||||
|
[](https://hub.docker.com/r/idootop/mi-gpt)
|
||||||
|
|
||||||
对于电脑小白或者不想自己配置代码运行环境(Node)的同学,可以使用 Docker 启动方式。
|
对于电脑小白或者不想自己配置代码运行环境(Node)的同学,可以使用 Docker 启动方式。
|
||||||
|
|
||||||
请先按照[「配置参数」](#%EF%B8%8F-配置参数)章节,配置好你的 `.env` 和 `.migpt.js` 文件。然后使用以下命令启动 docker:
|
请先按照[「配置参数」](#%EF%B8%8F-配置参数)章节,配置好你的 `.env` 和 `.migpt.js` 文件。然后使用以下命令启动 docker:
|
||||||
|
@ -39,6 +41,8 @@ docker run -d --env-file $(pwd)/.env \
|
||||||
|
|
||||||
#### ⭐️ NPM
|
#### ⭐️ NPM
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/mi-gpt)
|
||||||
|
|
||||||
如果你是一名前端 (Node) 开发者,也可以通过 NPM 安装 `mi-gpt` 包的方式,使用代码启动 `MiGPT`。
|
如果你是一名前端 (Node) 开发者,也可以通过 NPM 安装 `mi-gpt` 包的方式,使用代码启动 `MiGPT`。
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
8
TODO.md
8
TODO.md
|
@ -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
|
|
|
@ -29,7 +29,7 @@
|
||||||
"axios": "^1.6.5",
|
"axios": "^1.6.5",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"https-proxy-agent": "^7.0.4",
|
"https-proxy-agent": "^7.0.4",
|
||||||
"mi-service-lite": "^2.2.0",
|
"mi-service-lite": "^2.3.0",
|
||||||
"openai": "^4.28.0",
|
"openai": "^4.28.0",
|
||||||
"prisma": "^5.8.1"
|
"prisma": "^5.8.1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class MyBot {
|
||||||
if (config) {
|
if (config) {
|
||||||
this.speaker.name = config?.bot.name;
|
this.speaker.name = config?.bot.name;
|
||||||
await this.speaker.response({
|
await this.speaker.response({
|
||||||
text: `我是${name},很高兴认识你!`,
|
text: `你好,我是${name},很高兴认识你!`,
|
||||||
keepAlive: this.speaker.keepAlive,
|
keepAlive: this.speaker.keepAlive,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -88,11 +88,11 @@ export class AISpeaker extends Speaker {
|
||||||
askAI: AISpeakerConfig["askAI"];
|
askAI: AISpeakerConfig["askAI"];
|
||||||
name: string;
|
name: string;
|
||||||
switchSpeakerPrefix: string[];
|
switchSpeakerPrefix: string[];
|
||||||
onEnterAI: string[];
|
onEnterAI: () => string[];
|
||||||
onExitAI: string[];
|
onExitAI: () => string[];
|
||||||
callAIPrefix: string[];
|
callAIPrefix: () => string[];
|
||||||
wakeUpKeywords: string[];
|
wakeUpKeywords: () => string[];
|
||||||
exitKeywords: string[];
|
exitKeywords: () => string[];
|
||||||
onAIAsking: string[];
|
onAIAsking: string[];
|
||||||
onAIError: string[];
|
onAIError: string[];
|
||||||
audio_active?: string;
|
audio_active?: string;
|
||||||
|
@ -119,23 +119,18 @@ export class AISpeaker extends Speaker {
|
||||||
this.audio_error = audio_error;
|
this.audio_error = audio_error;
|
||||||
this.switchSpeakerPrefix =
|
this.switchSpeakerPrefix =
|
||||||
switchSpeakerPrefix ?? getDefaultSwitchSpeakerPrefix();
|
switchSpeakerPrefix ?? getDefaultSwitchSpeakerPrefix();
|
||||||
this.wakeUpKeywords = wakeUpKeywords.map((e) => e + this.name);
|
this.wakeUpKeywords = () => wakeUpKeywords.map((e) => e + this.name);
|
||||||
this.exitKeywords = exitKeywords.map((e) => e + this.name);
|
this.exitKeywords = () => exitKeywords.map((e) => e + this.name);
|
||||||
this.onEnterAI = config.onEnterAI ?? [
|
this.onEnterAI = () =>
|
||||||
`你好,我是${this.name},很高兴为你服务!`,
|
config.onEnterAI ?? [`你好,我是${this.name},很高兴为你服务!`];
|
||||||
];
|
this.onExitAI = () => config.onExitAI ?? [`${this.name}已关闭!`];
|
||||||
this.onExitAI = config.onExitAI ?? [`${this.name}已关闭!`];
|
this.callAIPrefix = () =>
|
||||||
this.callAIPrefix = config.callAIPrefix ?? [
|
config.callAIPrefix ?? ["请", "你", this.name, "问问" + this.name];
|
||||||
"请",
|
|
||||||
"你",
|
|
||||||
this.name,
|
|
||||||
"问问" + this.name,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async enterKeepAlive() {
|
async enterKeepAlive() {
|
||||||
// 回应
|
// 回应
|
||||||
await this.response({ text: pickOne(this.onEnterAI)!, keepAlive: true });
|
await this.response({ text: pickOne(this.onEnterAI())!, keepAlive: true });
|
||||||
// 唤醒
|
// 唤醒
|
||||||
await super.enterKeepAlive();
|
await super.enterKeepAlive();
|
||||||
}
|
}
|
||||||
|
@ -145,7 +140,7 @@ export class AISpeaker extends Speaker {
|
||||||
await super.exitKeepAlive();
|
await super.exitKeepAlive();
|
||||||
// 回应
|
// 回应
|
||||||
await this.response({
|
await this.response({
|
||||||
text: pickOne(this.onExitAI)!,
|
text: pickOne(this.onExitAI())!,
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
playSFX: false,
|
playSFX: false,
|
||||||
});
|
});
|
||||||
|
@ -155,13 +150,13 @@ export class AISpeaker extends Speaker {
|
||||||
get commands() {
|
get commands() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
match: (msg) => this.wakeUpKeywords.some((e) => msg.text.includes(e)),
|
match: (msg) => this.wakeUpKeywords().some((e) => msg.text.includes(e)),
|
||||||
run: async (msg) => {
|
run: async (msg) => {
|
||||||
await this.enterKeepAlive();
|
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) => {
|
run: async (msg) => {
|
||||||
await this.exitKeepAlive();
|
await this.exitKeepAlive();
|
||||||
},
|
},
|
||||||
|
@ -188,7 +183,7 @@ export class AISpeaker extends Speaker {
|
||||||
{
|
{
|
||||||
match: (msg) =>
|
match: (msg) =>
|
||||||
this.keepAlive ||
|
this.keepAlive ||
|
||||||
this.callAIPrefix.some((e) => msg.text.startsWith(e)),
|
this.callAIPrefix().some((e) => msg.text.startsWith(e)),
|
||||||
run: (msg) => this.askAIForAnswer(msg),
|
run: (msg) => this.askAIForAnswer(msg),
|
||||||
},
|
},
|
||||||
] as SpeakerCommand[];
|
] as SpeakerCommand[];
|
||||||
|
|
|
@ -6,14 +6,14 @@ export const kAreYouOK = "¿ʞо ∩оʎ ǝɹɐ"; // are you ok?
|
||||||
|
|
||||||
export const kBannerASCII = `
|
export const kBannerASCII = `
|
||||||
|
|
||||||
/$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$$
|
/ $$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$$$
|
||||||
| $$$ /$$$|__/ /$$__ $$| $$__ $$|__ $$__/
|
| $$$ /$$$|__/ /$$__ $$| $$__ $$|__ $$__/
|
||||||
| $$$$ /$$$$ /$$| $$ \__/| $$ \ $$ | $$
|
| $$$$ /$$$$ /$$| $$ \\__/| $$ \\ $$ | $$
|
||||||
| $$ $$/$$ $$| $$| $$ /$$$$| $$$$$$$/ | $$
|
| $$ $$/$$ $$| $$| $$ /$$$$| $$$$$$$/ | $$
|
||||||
| $$ $$$| $$| $$| $$|_ $$| $$____/ | $$
|
| $$ $$$| $$| $$| $$|_ $$| $$____/ | $$
|
||||||
| $$\ $ | $$| $$| $$ \ $$| $$ | $$
|
| $$\\ $ | $$| $$| $$ \\ $$| $$ | $$
|
||||||
| $$ \/ | $$| $$| $$$$$$/| $$ | $$
|
| $$ \\/ | $$| $$| $$$$$$/| $$ | $$
|
||||||
|__/ |__/|__/ \______/ |__/ |__/
|
|__/ |__/|__/ \\______/ |__/ |__/
|
||||||
|
|
||||||
MiGPT v1.0.0 by: del-wang.eth
|
MiGPT v1.0.0 by: del-wang.eth
|
||||||
|
|
||||||
|
|
|
@ -927,10 +927,10 @@ merge2@^1.3.0, merge2@^1.4.1:
|
||||||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||||
|
|
||||||
mi-service-lite@^2.2.0:
|
mi-service-lite@^2.3.0:
|
||||||
version "2.2.0"
|
version "2.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/mi-service-lite/-/mi-service-lite-2.2.0.tgz#30bcebaa8faeb83d1606be0c2ef552a4621dc722"
|
resolved "https://registry.yarnpkg.com/mi-service-lite/-/mi-service-lite-2.3.0.tgz#cb24477e37b674d9f758790c9f8fbb3637de1753"
|
||||||
integrity sha512-rcepSHGA4yUOjI9Tim/1kgu6BzMGeblMl+Nm5aevlRoXw7vv/x8fGx3jiwMV+LX6aDyY7NABEBbjwdPc98wlGA==
|
integrity sha512-a9r5quQjwGRz7aE7oOjLAJfgwp0E6nKpP2c/ZYbl6jYKsvz05f/e8bPGY73dDtCtQHGTONxPZjeoGraQbQLJZg==
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "^1.6.5"
|
axios "^1.6.5"
|
||||||
pako "^2.1.0"
|
pako "^2.1.0"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user