♻️ refactor(agent): 移除模式列表查询功能并更新数据结构

- 移除 shopTool 的 modeList 查询类型及相关 API 调用
- 移除 goodsTool 中的 categoryId 查询参数
- 更新 DTO 接口定义,调整字段命名规范
- 新增 ProductInfoDTO、CellInfoDTO、CabinetInfoDTO 接口

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
dzq 2026-01-10 09:36:02 +08:00
parent 09e71ca348
commit 3654ad60f7
4 changed files with 69 additions and 45 deletions

View File

@ -48,7 +48,7 @@ export const multiFunctionAgent = new Agent({
1. ****使ID获取单个商品详情
2. ****使ID查询智能柜详细信息
3. ****使ID获取门店详细信息
3. ****使ID获取门店详细信息
4. ****使IDID
5. ****使
-
@ -86,6 +86,7 @@ export const multiFunctionAgent = new Agent({
- cellusageStatus1- 2-
- 1 2 3 4

View File

@ -8,36 +8,53 @@ export interface IdNameDTO {
name: string
}
export interface CellDTO {
/** 单元格ID */
id: number
/** 单元格编号 */
cellNo: string
/** 单元格名称 */
cellName: string
/** 单元格状态 */
status: number
export interface ProductInfoDTO {
/** 商品ID */
goodsId: number
/** 商品名称 */
goodsName: string
/** 商品价格 */
price: number
/** 封面图URL */
coverImg: string
}
export interface CellInfoDTO {
/** 格子ID */
cellId: number
/** 格子编号 */
cellNo: number
/** 引脚编号 */
pinNo: number
/** 库存数量 */
stock: number
/** 格子价格 */
cellPrice: number
/** 订单ID */
orderId: number
/** 订单商品ID */
orderGoodsId: number
/** 商品信息 */
product: ProductInfoDTO
/** 密码 */
password: string
/** 使用状态1空闲 2已占用 */
usageStatus: number
/** 格口类型1小格 2中格 3大格 4超大格 */
cellType: number
/** 备注 */
remark: string
}
export interface CabinetDetailDTO {
/** 柜机ID */
id: number
/** 柜机编号 */
cabinetNo: string
cabinetId: number
/** 柜机名称 */
cabinetName: string
/** 所属店铺ID */
shopId: number
/** 所属店铺名称 */
shopName: string
/** 柜机状态 */
status: number
/** 单元格列表 */
cells: CellDTO[]
/** 锁控编号 */
lockControlNo: number
/** 格子列表 */
cells: CellInfoDTO[]
}
export interface CabinetSimpleDTO {
@ -53,21 +70,36 @@ export interface CabinetSimpleDTO {
export interface ShopDetailDTO {
/** 店铺ID */
id: number
shopId: number
/** 店铺名称 */
shopName: string
/** 店铺编码 */
shopCode: string
/** 联系人姓名 */
contactName: string
/** 联系电话 */
contactPhone: string
/** 店铺地址 */
address: string
/** 店铺状态 */
status: number
/** 企业微信id */
corpid: string
/** 归属类型0-借还柜 1-固资通) */
belongType: number
/** 运行模式0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式 5-暂存模式) */
mode: number
/** 借呗支付1-正常使用 0-禁止使用) */
balanceEnable: number
/** 柜机列表 */
cabinets: CabinetSimpleDTO[]
cabinets: CabinetInfoDTO[]
}
export interface CabinetInfoDTO {
/** 柜机唯一ID */
cabinetId: number
/** 柜机名称 */
cabinetName: string
/** 归属主柜ID */
mainCabinet: number
/** MQTT服务ID */
mqttServerId: number
/** 柜机模版编号 */
templateNo: string
/** 锁控板序号 */
lockControlNo: number
/** 归还期限0表示不限制 */
returnDeadline: number
}
export type EntityType = "shop" | "cabinet" | "goods"

View File

@ -76,7 +76,6 @@ export const goodsTool = createTool({
// 列表查询
const query: SearchShopGoodsQuery = {
goodsName,
categoryId,
status,
autoApproval,
minPrice,

View File

@ -2,7 +2,6 @@ import { createTool } from "@mastra/core/tools";
import { z } from "zod";
import {
getShopListApi,
getModeListApi,
GetShopListParams
} from "../api/shop";
import { shopDetail } from "../api/agent/agent";
@ -10,11 +9,11 @@ import { toolCacheService } from "../services";
export const shopTool = createTool({
id: "shop",
description: "查询门店相关信息,支持查询门店列表、模式列表、门店详情。查询结果会被缓存cacheId 可用于 code-executor-tool 进行数据处理。",
description: "查询门店相关信息,支持查询门店列表、门店详情。查询结果会被缓存cacheId 可用于 code-executor-tool 进行数据处理。",
inputSchema: z.object({
queryType: z.enum(["shopList", "modeList", "shopDetail"]).describe(
"查询类型:'shopList'表示获取门店列表,'modeList'表示获取模式列表,'shopDetail'表示获取门店详情"
queryType: z.enum(["shopList", "shopDetail"]).describe(
"查询类型:'shopList'表示获取门店列表,'shopDetail'表示获取门店详情"
),
corpid: z.string().optional().describe("企业微信ID查询门店列表时必填"),
mode: z.number().optional().describe("需要排除的运行模式(查询门店列表时可选,该参数表示不查询该运行模式的门店,默认值为-1"),
@ -57,13 +56,6 @@ export const shopTool = createTool({
data: response.data,
};
}
} else if (queryType === "modeList") {
const response = await getModeListApi();
result = {
success: response.code === 0,
message: response.msg || "查询成功",
data: response.data,
};
} else if (queryType === "shopDetail") {
if (!shopId) {
result = {