♻️ refactor(agent): 移除模式列表查询功能并更新数据结构
- 移除 shopTool 的 modeList 查询类型及相关 API 调用 - 移除 goodsTool 中的 categoryId 查询参数 - 更新 DTO 接口定义,调整字段命名规范 - 新增 ProductInfoDTO、CellInfoDTO、CabinetInfoDTO 接口 Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
09e71ca348
commit
3654ad60f7
|
|
@ -48,7 +48,7 @@ export const multiFunctionAgent = new Agent({
|
|||
|
||||
1. **商品查询**:使用商品工具查询商品信息,支持分页查询商品列表或根据商品ID获取单个商品详情。
|
||||
2. **柜机查询**:使用柜机工具根据柜机ID查询智能柜详细信息。
|
||||
3. **门店查询**:使用门店工具查询门店相关信息,支持查询门店列表、模式列表以及根据门店ID获取门店详细信息(含下属柜机列表)。
|
||||
3. **门店查询**:使用门店工具查询门店相关信息,支持查询门店列表以及根据门店ID获取门店详细信息(含下属柜机列表)。
|
||||
4. **借还动态查询**:使用借还动态工具查询商品借还记录,支持按商品ID、格口ID、状态、动态类型筛选,可查询借出和归还记录。
|
||||
5. **实体搜索**:使用实体搜索工具根据名称模糊查询店铺、柜机、商品等实体。
|
||||
- 输入参数:
|
||||
|
|
@ -86,6 +86,7 @@ export const multiFunctionAgent = new Agent({
|
|||
|
||||
业务概念:
|
||||
- 格口是否已被占用:格口(cell)的usageStatus(1-空闲 2-占用)。
|
||||
- 格口类型(1小格 2中格 3大格 4超大格)
|
||||
|
||||
请始终礼貌、乐于助人。如果用户询问超出你能力范围的事情,请礼貌解释你能做什么。
|
||||
你可以记住之前的对话和用户偏好。
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ export const goodsTool = createTool({
|
|||
// 列表查询
|
||||
const query: SearchShopGoodsQuery = {
|
||||
goodsName,
|
||||
categoryId,
|
||||
status,
|
||||
autoApproval,
|
||||
minPrice,
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue