← Back to Skills Marketplace
jeremycooper2077

Parcel Station Chat

by JeremyCooper2077 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
39
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install parcel-station-chat
Description
Build a courier station AI chat system with Express, GPT-5.5, local JSON DB, OCR, and WeChat-style frontend.
README (SKILL.md)

快递驿站智能客服系统

快速搭建快递驿站 AI 客服系统。Express 后端 + GPT-5.5 对话 + JSON 本地数据库 + 面单 OCR + 微信风格聊天前端。

系统架构

用户 (微信小程序/浏览器)
        │
   POST /api/chat
   POST /api/ocr
   GET  /api/packages/:code
        │
┌───────▼──────────────────────┐
│  Express server.js (v3.1)    │
│  ├ loadApiConfig() → SU2     │
│  ├ buildLookupBlock()        │
│  │  ├ extractPickupCode()    │
│  │  └ extractTrackingTail()  │
│  ├ callAI() → GPT-5.5       │
│  └ handleFallback()          │
├──────────────────────────────┤
│  db.js (JSON 文件存储)        │
│  ├ findByPickupCode()        │
│  ├ findByTrackingTail()      │
│  ├ findByPhoneTail()         │
│  ├ listPackages() (分页)     │
│  └ insertPackage()           │
├──────────────────────────────┤
│  ocr.js (GPT-5.5 Vision)    │
│  └ recognizeWaybill()        │
└──────────────────────────────┘

取件码格式

1-2-25001
│ │ ││││
│ │ │││└── 001 = 当天第1个包裹
│ │ ││└─── 25 = 日期(当月第几天)
│ │ └┴──── 5位日期序号(DDNNN)
│ └────── 排号
└──────── 货架号

正则:/(\d{1,2})\s*[--—–]\s*(\d{1,2})\s*[--—–]\s*(\d{5})/

搭建步骤

1. 初始化项目

mkdir parcel-help && cd parcel-help
npm init -y
npm install express

2. 创建 db.js

JSON 文件存储,零原生依赖。关键函数:

  • findByPickupCode(code) — 取件码查询
  • findByTrackingTail(tail) — 运单号后5位查询
  • findByPhoneTail(tail) — 手机尾号4位查询
  • listPackages({page, pageSize, q}) — 分页+搜索
  • insertPackage(p) — 新增包裹(含冲突检测)

种子数据:12条包裹覆盖全部货架,当天日期自动计算。

3. 创建 ocr.js

调用 GPT-5.5 Vision 识别面单,返回 JSON:

{"pickup_code":"","tracking_no":"","recipient_name":"","recipient_phone_tail":"","carrier":"","confidence":"low|medium|high"}

注意:AI 可能返回 markdown 包裹的 JSON,parseOcrJson 需处理 ```json ```

4. 创建 server.js

核心逻辑流程:

  1. loadApiConfig() → 读 SU2_API_KEY + baseUrl
  2. buildLookupBlock(message) → 自动识别取件码/运单号尾号
  3. 有 AI → callAI() → 带会话历史 + 查库结果
  4. 无 AI → handleFallback() → 本地关键词+查库

会话管理:30分钟 TTL,保留最近5轮对话。

5. 创建前端 (public/index.html)

微信风格聊天界面,注意:

  • ❌ 不加入"管理"入口(客户端)
  • ✅ 底部快捷按钮:找不到包裹 / 取件码说明 / 运单号查询
  • ✅ 支持图片上传拍照
  • ✅ 移动端优化

6. 启动测试

node server.js
# 聊天界面: http://localhost:3000
# 管理后台: http://localhost:3000/admin.html
# 健康检查: http://localhost:3000/api/health

API 接口

方法 路径 说明
GET /api/health 健康检查(版本、AI状态、数据库总量)
POST /api/chat 聊天(message + image + sessionId)
POST /api/ocr 面单识别(image)
GET /api/packages 包裹列表(page, pageSize, q)
POST /api/packages 录入包裹
GET /api/packages/:code 按取件码查询

核心设计决策

  1. 不用 better-sqlite3 — Windows 需要 VC++ 编译工具,改用纯 JS JSON 文件存储
  2. 不用 shelf_color/shelf_area — 真实驿站用"第X号货架 第Y排",不设颜色/区号
  3. 取件码正则匹配 5 位日期序号 — 区别于其他数字输入
  4. 运单号查询 — 匹配 5 位及以上连续数字,支持部分单号
  5. 管理后台单独存在 — 不和客户端 UI 混在一起

坑与注意事项

  • better-sqlite3 在 Windows 编译失败 → 换 JSON
  • Unicode 中文在 taskkill /F /IM node.exe 后可能输出乱码,但服务正常
  • API 调用超时默认 30s,中转站偶尔延迟需重试
  • curl.exe 在 PowerShell 中 JSON 引号会转义出错 → 用 Invoke-RestMethod
Usage Guidance
Review before installing or using this as a deployable template. It should be acceptable for a local prototype, but before real station use add authentication for admin and package APIs, avoid exposing management endpoints publicly, minimize data sent to the AI provider, document consent/privacy handling, and define retention/deletion rules for package records and chat history.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
The OCR, chat, local package database, and package lookup/listing APIs fit the stated courier-station support purpose.
Instruction Scope
The skill describes sending waybill images, chat messages, session history, and lookup results to an AI service, but does not specify privacy notice, minimization, consent, or retention guidance.
Install Mechanism
The artifact is a Markdown skill only; it contains setup instructions and no executable install script, hidden payload, or automatic runtime action.
Credentials
The proposed Express app includes package listing and insertion endpoints plus an admin page, while the instructions do not require authentication, authorization, field restriction, or public-deployment safeguards.
Persistence & Privilege
Local JSON storage and a 30-minute in-memory chat TTL are disclosed and purpose-aligned, but package-record retention and deletion controls are not addressed.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install parcel-station-chat
  3. After installation, invoke the skill by name or use /parcel-station-chat
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: Express + GPT-5.5 + JSON DB + OCR 驿站智能客服系统
Metadata
Slug parcel-station-chat
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Parcel Station Chat?

Build a courier station AI chat system with Express, GPT-5.5, local JSON DB, OCR, and WeChat-style frontend. It is an AI Agent Skill for Claude Code / OpenClaw, with 39 downloads so far.

How do I install Parcel Station Chat?

Run "/install parcel-station-chat" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Parcel Station Chat free?

Yes, Parcel Station Chat is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Parcel Station Chat support?

Parcel Station Chat is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Parcel Station Chat?

It is built and maintained by JeremyCooper2077 (@jeremycooper2077); the current version is v1.0.0.

💬 Comments