feat: 重构pbClient登录逻辑为独立函数;添加定时任务每小时执行登录;新增意图识别测试文件
This commit is contained in:
parent
5c356f31f3
commit
5085da7e12
@ -4,8 +4,11 @@ const pbClient = new PocketBase(Bun.env.PB_URL)
|
|||||||
|
|
||||||
pbClient.autoCancellation(false)
|
pbClient.autoCancellation(false)
|
||||||
|
|
||||||
await pbClient
|
export const loginPbClient = async () =>
|
||||||
.collection("_superusers")
|
await pbClient
|
||||||
.authWithPassword(Bun.env.PB_USER, Bun.env.PB_PASS)
|
.collection("_superusers")
|
||||||
|
.authWithPassword(Bun.env.PB_USER, Bun.env.PB_PASS)
|
||||||
|
|
||||||
|
await loginPbClient()
|
||||||
|
|
||||||
export default pbClient
|
export default pbClient
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import schedule from "node-schedule"
|
import schedule from "node-schedule"
|
||||||
|
|
||||||
import report from "../controller/groupAgent/report"
|
import report from "../controller/groupAgent/report"
|
||||||
|
import { loginPbClient } from "../db/pbClient"
|
||||||
import fmMonitor from "./fmMonitor"
|
import fmMonitor from "./fmMonitor"
|
||||||
import sendZhongNotify from "./zhongNotify"
|
import sendZhongNotify from "./zhongNotify"
|
||||||
|
|
||||||
@ -16,4 +17,7 @@ export const initSchedule = async () => {
|
|||||||
|
|
||||||
// 定时任务,每5分钟执行一次
|
// 定时任务,每5分钟执行一次
|
||||||
schedule.scheduleJob("*/5 * * * *", fmMonitor)
|
schedule.scheduleJob("*/5 * * * *", fmMonitor)
|
||||||
|
|
||||||
|
// 定时任务,每小时执行一次
|
||||||
|
schedule.scheduleJob("0 * * * *", loginPbClient)
|
||||||
}
|
}
|
||||||
|
15
test/llm/intentRecognition.ts
Normal file
15
test/llm/intentRecognition.ts
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user