feat: 重构pbClient登录逻辑为独立函数;添加定时任务每小时执行登录;新增意图识别测试文件

This commit is contained in:
zhaoyingbo 2025-01-25 09:08:11 +00:00
parent 5c356f31f3
commit 5085da7e12
3 changed files with 25 additions and 3 deletions

View File

@ -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

View File

@ -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)
}

View File

@ -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)