diff --git a/db/pbClient.ts b/db/pbClient.ts index f6a2c9a..2356814 100644 --- a/db/pbClient.ts +++ b/db/pbClient.ts @@ -4,8 +4,11 @@ const pbClient = new PocketBase(Bun.env.PB_URL) pbClient.autoCancellation(false) -await pbClient - .collection("_superusers") - .authWithPassword(Bun.env.PB_USER, Bun.env.PB_PASS) +export const loginPbClient = async () => + await pbClient + .collection("_superusers") + .authWithPassword(Bun.env.PB_USER, Bun.env.PB_PASS) + +await loginPbClient() export default pbClient diff --git a/schedule/index.ts b/schedule/index.ts index 2f8e23f..abcaa43 100644 --- a/schedule/index.ts +++ b/schedule/index.ts @@ -1,6 +1,7 @@ import schedule from "node-schedule" import report from "../controller/groupAgent/report" +import { loginPbClient } from "../db/pbClient" import fmMonitor from "./fmMonitor" import sendZhongNotify from "./zhongNotify" @@ -16,4 +17,7 @@ export const initSchedule = async () => { // 定时任务,每5分钟执行一次 schedule.scheduleJob("*/5 * * * *", fmMonitor) + + // 定时任务,每小时执行一次 + schedule.scheduleJob("0 * * * *", loginPbClient) } diff --git a/test/llm/intentRecognition.ts b/test/llm/intentRecognition.ts new file mode 100644 index 0000000..711b005 --- /dev/null +++ b/test/llm/intentRecognition.ts @@ -0,0 +1,15 @@ +import initAppConfig from "../../constant/config" +import llm from "../../utils/llm" + +await initAppConfig() + +const res = await llm.invoke( + "intentRecognition", + { + userInput: "你是干嘛的", + time: new Date().toLocaleString("zh-CN", { timeZone: "Asia/Shanghai" }), + }, + "test" +) + +console.log(res)