行程助手:AI 旅游与预订自动化 - Openclaw 技能

作者:互联网

2026-04-18

AI教程

什么是 行程助手?

行程助手是一款先进的对话代理,旨在简化旅行物流和规划。它允许用户通过直观的英文和中文自然语言命令查询航班动态、火车时刻表和酒店住宿。作为 Openclaw 技能的专用组件,该工具可处理复杂的日期解析和多城市行程,在用户意图与后端预订系统之间提供无缝衔接。

下载入口:https://github.com/openclaw/skills/tree/main/skills/yeohx/anidyforest2

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install anidyforest2

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 anidyforest2。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

行程助手 应用场景

  • 在多家航空公司中搜索实时航班动态和机票价格。
  • 查询国内旅行的高铁和传统火车时刻表。
  • 根据特定的距离或日期寻找当地酒店住宿和住宿选项。
  • 为复杂行程生成全面的旅行计划并识别最快的中转路线。
行程助手 工作原理
  1. 用户向由 Openclaw 技能驱动的代理提交自然语言旅游查询。
  2. 该技能触发一个 Python 脚本,捕获完整的原始消息和相关的用户元数据。
  3. 请求传输到 FastAPI 后端服务器,解析意图并从生产或测试环境获取数据。
  4. 系统处理多城市停靠和相对日期等复杂参数。
  5. 返回人类可读的响应并显示给用户,以方便立即执行预订操作。

行程助手 配置指南

要将此工具集成到您的 Openclaw 技能环境中,首先请确保 FastAPI 后端已运行:

uvicorn booking_assitant.fastapi_serve:app --host 0.0.0.0 --port 8763

然后,使用带有必要环境变量的查询脚本执行查询:

python SKILL_DIR/scripts/query.py r
  --query "" r
  --user-id "${BOOKING_API_USER_ID}" r
  --env "prod" r
  --base-url "http://host.docker.internal:8763"

行程助手 数据架构与分类体系

该技能通过一组结构化的 CLI 参数和环境配置来组织其操作,以确保 Openclaw 技能工作流中的数据完整性。

参数 描述 环境变量
用户 ID 用于跟踪会话的唯一标识符 BOOKING_API_USER_ID
环境 目标后端 (prod 或 fat) BOOKING_API_ENV
基础 URL API 服务器的端点 BOOKING_API_BASE_URL
查询 原始自然语言输入 N/A
name: trip-assistant
description: Query flight, train, and hotel booking information via a backend AI assistant. Activate this skill when the user asks about flights (机票/航班/飞机), trains (火车/高铁/动车/列车), hotels (酒店/住宿/宾馆), or travel planning (出行规划/旅行安排).
tags: [travel, booking, flight, train, hotel, 机票, 火车, 酒店]

Trip Assistant Skill

A conversational AI assistant for booking and querying flights, trains, and hotels. The assistant communicates in natural language and handles complex travel queries including date parsing, multi-city trips, and comparisons.

When to Use

Activate this skill when the user:

  • Asks about flights: 机票, 航班, 飞机, 坐飞机, 飞到, 航空
  • Asks about trains: 火车, 高铁, 动车, 列车, 火车票, 高铁票
  • Asks about hotels: 酒店, 住宿, 宾馆, 旅馆, 住哪里
  • Asks for travel planning: 出行规划, 怎么去, 旅行安排, 最快怎么到

How to Use

Run the query script, passing the user's complete natural language query:

python SKILL_DIR/scripts/query.py r
  --query "" r
  --user-id "${BOOKING_API_USER_ID:-624e5b8b3f4a2f4ec566e3d3}" r
  --env "${BOOKING_API_ENV:-prod}" r
  --base-url "${BOOKING_API_BASE_URL:-http://host.docker.internal:8763}"

Key notes:

  • Replace SKILL_DIR with the absolute path to this skill's directory
  • The --query value should be the user's full original message (do not rewrite or simplify)
  • The script outputs the assistant's reply to stdout; pass it back to the user verbatim
  • If the script returns a connection error, inform the user the service is unavailable and ask them to check that the FastAPI server is running (uvicorn booking_assitant.fastapi_serve:app --host 0.0.0.0 --port 8763)

Configuration

Parameter CLI Flag Environment Variable Default
User ID --user-id BOOKING_API_USER_ID 624e5b8b3f4a2f4ec566e3d3
Environment --env BOOKING_API_ENV prod
API Base URL --base-url BOOKING_API_BASE_URL http://host.docker.internal:8763

Environments:

  • prod — Production data
  • fat — Test/staging data

Examples

Query flight

User: "帮我查一下明天北京到上海的机票"

python ~/.claude/skills/trip-assistant/scripts/query.py r
  --query "帮我查一下明天北京到上海的机票" r
  --user-id "user123" r
  --env prod

Query train

User: "3月10日从上海去杭州有哪些高铁?"

python ~/.claude/skills/trip-assistant/scripts/query.py r
  --query "3月10日从上海去杭州有哪些高铁?" r
  --user-id "user123" r
  --env prod

Query hotel

User: "查一下北京王府井附近明天的酒店"

python ~/.claude/skills/trip-assistant/scripts/query.py r
  --query "查一下北京王府井附近明天的酒店" r
  --user-id "user123" r
  --env prod

Error Handling

Exit Code Meaning Action
0 Success Display output to user
1 (connection error) FastAPI server not reachable Ask user to start the server
1 (HTTP error) API returned error Display the error message
1 (timeout) Request timed out Suggest retrying

相关推荐