feat: 开放小爱音箱接入 MiGPT-Next 源代码

This commit is contained in:
Del Wang
2025-04-09 21:59:38 +08:00
parent 6237c46441
commit f65f34d115
17 changed files with 2644 additions and 3 deletions
+21
View File
@@ -0,0 +1,21 @@
import { sleep } from "@mi-gpt/utils";
import { OpenXiaoAI } from "./xiaoai.js";
async function main() {
await OpenXiaoAI.start({
openai: {
model: "gpt-4o-mini",
baseURL: "https://api.openai.com/v1",
apiKey: "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
async onMessage(_engine, { text }) {
if (text.startsWith("你好")) {
await sleep(1000);
return { text: "你好,很高兴认识你!" };
}
},
});
process.exit(0);
}
main();