feat(migpt): 新增 Docker 一键运行镜像

This commit is contained in:
Del Wang
2025-05-11 11:34:42 +08:00
parent a73ef08074
commit cde047af19
10 changed files with 218 additions and 70 deletions
+2 -23
View File
@@ -1,29 +1,8 @@
import { sleep } from "@mi-gpt/utils";
import { kOpenXiaoAIConfig } from "config.js";
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",
},
/**
* 默认只会处理以下关键词开头的消息,你也可以自定义:
* - 请问地球为什么是圆的?
* - 你知道世界上跑的最快的动物是什么吗?
*/
callAIKeywords: ["请", "你"],
/**
* 自定义消息回调
*/
async onMessage(_engine, { text }) {
if (text.startsWith("你好")) {
await sleep(1000);
return { text: "你好,很高兴认识你!" };
}
},
});
await OpenXiaoAI.start(kOpenXiaoAIConfig);
process.exit(0);
}
+1 -1
View File
@@ -6,7 +6,7 @@ import { RustServer } from "./open-xiaoai.js";
import { OpenXiaoAISpeaker } from "./speaker.js";
import { randomUUID } from "node:crypto";
type OpenXiaoAIConfig = Prettify<EngineConfig<OpenXiaoAIEngine>>;
export type OpenXiaoAIConfig = Prettify<EngineConfig<OpenXiaoAIEngine>>;
const kDefaultOpenXiaoAIConfig: OpenXiaoAIConfig = {
//