dfs

A skill to implement conversational inventory queries for a WMS. Users can initiate queries in natural language; the system recognizes SKU and warehouse code parameters, asks for missing parameters when needed, and ultimately calls existing WMS interfaces to return inventory results. It supports multi-turn dialogue and context memory.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "dfs" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-588aa2a6abcfdbc50fa12fe072b108ffdbe3e90fa7d724adb381943ee77848d6. Verify the upstream source and version against https://skillhub.cn/skills/user_ade43103/fsd-sds before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A skill to implement conversational inventory queries for a WMS. Users can initiate queries in natural language; the system recognizes SKU and warehouse code parameters, asks for missing parameters when needed, and ultimately calls existing WMS interfaces to return inventory results. It supports multi-turn dialogue and context memory.

0 Downloads

Introduction source: third_party · user_ade43103 · 1.0.0 Reference

SkillPi interpretation

Tasks
dfs
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: dfs
description: dfs

WMS AI 助手 MVP 设计文档

创建日期:2026-04-16 状态:已批准

1. 背景与目标

当前项目目标是挂到 WMS,提供对话式业务查询能力。首期需要以最小可行方案验证:用户通过自然语言发起库存查询,系统能够识别并追问必要参数,然后复用现有 WMS 接口返回库存结果。

本期目标聚焦单一场景:用户显式提供 SKU 和仓库编码后,查询该商品在指定仓库下的库存信息。若缺少仓库编码,系统必须追问;会话上下文由后端维护,以支持补充参数后的继续对话。

2. 解决方案

2.1 方案概述

采用 LangChain4j AIService + 单一 Tool + 后端会话记忆 + 现有 WmsQryService 的方案:AIService 负责多轮对话和工具编排,Tool 负责触发库存查询动作,底层复用 Feign 调用 WMS 接口。

2.2 为什么选择这个方案

该方案同时满足以下要求:

  • 满足使用 langchain4j AIService 与 Tool 的技术方向。
  • 复用现有 WmsQryService 聚合能力,避免把 WMS 业务逻辑散落到 AI 层。
  • 支持后端托管会话,在缺少仓库编码时可追问并承接下一轮输入。
  • 对当前 MVP 范围足够简单,不引入多 Tool Agent、RAG、模型路由等额外复杂度。

2.3 备选方案(已否决)

方案 描述 否决原因
方案 B 规则提取参数,直接调用应用服务,AI 仅润色返回文案 实现更稳,但无法体现 AIService + Tool 的目标能力
方案 C 拆成多 Tool Agent,分别处理仓库识别、库存查询、结果解释 对单场景 MVP 过度设计,调试成本和不确定性偏高

3. 技术设计

3.1 架构图

用户
  -> InventoryChatController
  -> InventoryAssistantFacade
  -> InventoryAssistantAiService
       -> 若参数不全:直接返回追问
       -> 若参数齐全:调用 InventoryQueryTool
            -> WmsQryService
                 -> WmsWarehouseGateway -> WmsWarehouseFeignClient
                 -> WmsInventoryGateway -> WmsInventoryFeignClient
                 -> WmsConvertor
  -> ChatQueryResult

3.2 核心组件

组件 职责 技术选型
InventoryChatController 接收前端对话请求并返回统一响应 Spring MVC
InventoryAssistantFacade 封装 AIService 调用和 JSON 结果解析 Spring Service
InventoryAssistantAiService 负责对话编排、缺参追问、决定是否调用 Tool LangChain4j AIService
InventoryQueryTool 暴露单一库存查询动作,执行参数校验并调用应用服务 LangChain4j @Tool
WmsQryService 聚合仓库校验、库存查询和结果拼装 Application Service
WmsWarehouseFeignClient / WmsInventoryFeignClient 调用 WMS HTTP 接口 OpenFeign
ChatMemoryStore 实现 按 sessionId 保存会话消息,支持多轮上下文 MVP 先内存实现,后续可切 Redis
ChatQueryResult 统一对话响应载体 Domain Model

3.3 模块划分

  • sc-agent-interfaces
    • InventoryChatController
    • InventoryAssistantFacade
    • InventoryAssistantAiService
    • InventoryQueryTool
    • 原因:作为入站层,最适合承接 HTTP 请求与 AI 编排。
  • sc-agent-application
    • WmsQryService
    • WmsQryServiceImpl
    • 原因:保持业务聚合与查询规则在应用层闭环。
  • sc-agent-infrastructure
    • LangChain4jConfig
    • ChatModel 配置
    • ChatMemoryStore 实现
    • FeignClient 与对应 Gateway 实现
    • 原因:模型接入、远程调用、持久化都属于基础设施职责。
  • sc-agent-domain
    • ChatQueryResult
    • ChatReplyTypeEnum
    • InventoryQueryData
    • InventorySummary
    • WmsWarehouseInfo

3.4 数据流

  1. 前端调用聊天接口,传入 sessionId 和用户消息。
  2. InventoryChatController 将请求转给 InventoryAssistantFacade。
  3. InventoryAssistantFacade 调用 InventoryAssistantAiService.chat(sessionId, message)。
  4. AIService 结合会话记忆判断参数是否齐全:
    • 若缺少 SKU 或 warehouseCode,直接返回追问文本。
    • 若参数齐全,则调用 InventoryQueryTool。
  5. InventoryQueryTool 做最后一道参数校验,再调用 WmsQryService.queryInventory(productCode, warehouseCode)。
  6. WmsQryService 先查询仓库,再查询库存,并通过 WmsConvertor 转换结果。
  7. AIService 输出固定 JSON 字符串。
  8. InventoryAssistantFacade 解析 JSON,返回 ChatQueryResult。

3.5 API 设计

聊天接口

POST /chat/inventory

请求体:

{
  "sessionId": "u123",
  "message": "查询 SKU123 在 WH001 的库存"
}

响应体:

{
  "replyType": "RESULT",
  "replyText": "在 WH001 仓,产品 SKU123 当前可用库存 100,冻结库存 20。",
  "finished": true,
  "data": {
    "inventorySummaryList": [
      {
        "productCode": "SKU123",
        "leftInventory": 100,
        "freezeInventory": 20
      }
    ]
  }
}

AIService 输出约束

AIService 最终必须输出固定 JSON 结构:

{"replyType":"ASK|RESULT|ERROR","replyText":"...","finished":true|false}

当缺参时:

{"replyType":"ASK","replyText":"请补充仓库编码","finished":false}

3.6 数据库变更

MVP 不涉及数据库表结构变更。

会话记忆首期采用内存存储,不落库。若后续切换 Redis,只涉及基础设施实现替换,不影响对外接口。

4. 错误处理

  • 参数缺失:AIService 返回 ASK,提示补充 SKU 或 warehouseCode。
  • 仓库不存在:WmsQryService 返回 ERROR,提示“未找到仓库编码,请确认后重试”。
  • 仓库编码歧义:WmsQryService 返回 ERROR,提示“仓库编码存在歧义,请确认后重试”。
  • 库存为空:返回 RESULT,提示“该仓库下未查询到该产品库存”。
  • WMS 超时或异常:统一映射为 ERROR,提示“WMS 查询暂不可用,请稍后重试”。
  • AI 输出非 JSON:在 InventoryAssistantFacade 中兜底,返回统一错误响应,避免把模型异常暴露给前端。

5. 测试策略

  • 单元测试
    • InventoryQueryTool:验证缺参校验、正常调用和错误透传。
    • InventoryAssistantFacade:验证 AI 输出 JSON 解析与异常兜底。
    • WmsQryServiceImpl:验证仓库不存在、仓库歧义、库存为空、库存命中等分支。
  • 集成测试
    • 启动 Spring Boot,上下文装配 AIService + Tool + Feign mock,验证完整请求链路。
  • 会话测试
    • 第一轮输入缺仓库时返回追问。
    • 第二轮仅输入仓库编码时,能够结合 sessionId 续接上一轮 SKU 并完成查询。
  • 非目标能力测试
    • 输入商品名称而非 SKU 时,必须明确拒绝并要求提供 SKU。

6. 实施计划

  1. 补齐 LangChain4j 主依赖及模型装配。
  2. 新增 AIService、Tool、Facade 和聊天接口。
  3. 在基础设施层实现会话记忆存储与 Feign 客户端。
  4. 补齐单元测试和集成测试,验证单场景库存查询闭环。

详细任务拆解由后续实现计划文档提供。

7. 风险与缓解

风险 影响 缓解措施
模型猜测仓库或 SKU 产生错误查询结果 在 system message 中禁止猜测,并在 Tool 中做强校验
AI 输出 JSON 不稳定 Controller 无法解析结果 低温度配置,固定输出格式,Facade 增加 JSON 解析兜底
会话串线 用户上下文混淆 强制使用 sessionId 作为 @MemoryId,并设置会话过期策略
WMS 接口超时或失败 对话无法完成 配置 Feign 超时与统一错误文案,避免底层异常外泄
MVP 范围膨胀 交付拖延 明确只保留单一库存查询 Tool,不加入模糊查询、RAG、模型路由

8. 验收标准

  • [ ] 提供一个库存查询聊天接口,支持 sessionId 多轮对话。
  • [ ] 用户显式提供 SKU + warehouseCode 时,能够成功返回库存结果。
  • [ ] 缺少仓库编码时,系统必须追问,且下一轮可承接上下文继续查询。
  • [ ] 不支持商品名称模糊查询,遇到此类请求时明确提示用户提供 SKU。
  • [ ] WMS 查询失败时返回统一错误文案,不泄露底层异常。
  • [ ] 单元测试和集成测试覆盖核心流程与异常分支。

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value65/100

Highlights

  • 针对 WMS 库存查询场景,具有明确的业务实用价值
  • 设计文档完整,涵盖架构、数据流、错误处理等关键环节
Trigger Precision55/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层 frontmatter 的 description 字段为空,实际描述内容位于 skill_body 内部

    Recommendation: 将 description 内容移至顶层 frontmatter 的 description 字段,确保触发词清晰可见

Structure and Standards60/100

Areas to improve

  • 文档过长 Reported severity: Minor

    SKILL.md 文件内容约 1800+ 行,远超 500 行规范限制

    Recommendation: 精简文档内容,保留核心功能说明与触发词,将详细设计文档拆分为独立文件或链接引用

Highlights

  • 文档结构清晰,包含背景、解决方案、技术设计、测试策略等完整章节
  • 提供了详细的 API 设计示例和数据流说明
Execution Reliability70/100

Highlights

  • 架构设计合理,采用 LangChain4j AIService + Tool 模式,符合技术规范
  • 错误处理机制完善,涵盖参数缺失、仓库不存在、WMS 异常等场景
  • 会话管理机制明确,支持多轮对话上下文维护
Evidence Verifiability (mean of the first four)63/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.