tmp
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { tool } from "@langchain/core/tools";
|
||||
import z from "zod";
|
||||
import mongoose from "mongoose";
|
||||
import { DBModel } from "../../../../models/index.js";
|
||||
|
||||
const escortRecordSetTool = tool(
|
||||
@@ -8,18 +9,18 @@ const escortRecordSetTool = tool(
|
||||
if (!orderId) {
|
||||
return {
|
||||
success: false,
|
||||
error: "Order ID (_id or orderNo) is required as the lookup key",
|
||||
error: "Record ID (_id) is required as the lookup key",
|
||||
};
|
||||
}
|
||||
|
||||
const query = {
|
||||
$or: [
|
||||
{ _id: orderId },
|
||||
{ orderNo: orderId }
|
||||
]
|
||||
};
|
||||
if (!mongoose.Types.ObjectId.isValid(orderId)) {
|
||||
return {
|
||||
success: false,
|
||||
error: `Invalid record ID: ${orderId}. A valid record _id is required.`,
|
||||
};
|
||||
}
|
||||
|
||||
const record = await DBModel.EscortRecord.findOne(query);
|
||||
const record = await DBModel.EscortRecord.findById(orderId);
|
||||
if (!record) {
|
||||
return {
|
||||
success: false,
|
||||
@@ -79,11 +80,11 @@ const escortRecordSetTool = tool(
|
||||
{
|
||||
name: "escort_record_set",
|
||||
description:
|
||||
"Update escort record fields by order ID (_id or orderNo). Supports updating status, notes (patientNote, escortNote, medicalSummary), and payment (totalFee, paidFee, status). Only provided fields will be updated.",
|
||||
"Update escort record fields by record ID (_id). Supports updating status, notes (patientNote, escortNote, medicalSummary), and payment (totalFee, paidFee, status). Only provided fields will be updated.",
|
||||
schema: z.object({
|
||||
orderId: z
|
||||
.string()
|
||||
.describe("Order ID (_id or orderNo) used as the lookup key"),
|
||||
.describe("Record ID (_id) used as the lookup key"),
|
||||
status: z
|
||||
.enum(["pending", "confirmed", "in_progress", "completed", "cancelled"])
|
||||
.optional()
|
||||
|
||||
Reference in New Issue
Block a user