调整了agent

This commit is contained in:
lik
2026-10-28 11:15:29 +08:00
parent b8f53d3660
commit c4f6be6494
29 changed files with 703 additions and 921 deletions
+2 -2
View File
@@ -2,6 +2,7 @@ import { tool } from "@langchain/core/tools";
import z from "zod";
import mongoose from "mongoose";
import { DBModel } from "../../../../models/index.js";
import { escapeRegex } from "./utils.js";
const healthProfileQueryTool = tool(
async ({ profileId, userId, name, mobile, page = 1, pageSize = 20 }) => {
@@ -28,8 +29,7 @@ const healthProfileQueryTool = tool(
}
if (name) {
// 转义正则特殊字符,避免查询报错或 ReDoS;姓名支持中文、全拼、拼音首字母匹配
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const re = { $regex: escaped, $options: "i" };
const re = { $regex: escapeRegex(name), $options: "i" };
filter.$or = [{ "profile.name": re }, { "profile.pinyin": re }, { "profile.pinyinFL": re }];
}
if (mobile) {