travel-agent

travel-agent

Enables travel-related queries and planning including weather, train and flight information, itinerary generation, and travel knowledge retrieval via RAG, using an AI agent with MCP protocol.

Category
Visit Server

README

AI 旅游助手

基于 Qwen2.5-1.5B + LoRA 微调与 ChromaDB + BGE 向量检索的智能旅游 Agent。 通过 MCP 协议 暴露工具服务,可被 Claude Code 等 AI 客户端直接调用。

功能一览

功能 说明
🌤️ 天气查询 30+ 城市实时/预报天气,支持"明天""后天"等中文日期
🚄 高铁查票 84 条内置线路,起止城市双向查询
✈️ 航班查询 89 条内置航线,含航司、时刻、参考票价
🗺️ 行程规划 智能解析预算/人数/天数/偏好,自动生成完整方案
📋 RAG 攻略 19 城旅游知识库,多轮对话记忆,追问自动补城市名
🔀 复合查询 多工具同时调用(如 "天气 + 高铁")
⚡ 流式响应 SSE 逐 token 推送,前端逐字渲染

快速开始

环境要求

  • Python 3.10+
  • CUDA 11.8+(显存 ≥ 4GB)
  • 已下载 Qwen2.5-1.5B-Instruct 模型到本地缓存

启动

pip install -r requirements.txt

# 方式一:一键启动
python launch_api.py

# 方式二:直接运行
python api/main.py

# 访问 http://127.0.0.1:8000

测试

python test_api.py "深圳明天天气怎么样"
python test_api.py "北京故宫有什么特色"

项目结构

├── api/                    # Web API
│   ├── main.py             # FastAPI 主入口(REST + SSE 端点)
│   ├── session_store.py    # SQLite 会话持久化
│   └── static/index.html   # 卡片式聊天前端
├── agent/                  # Agent 核心
│   ├── dispatcher.py       # 工具调度器
│   ├── agent_loop.py       # 复合意图编排器
│   ├── planner.py          # 行程规划器
│   ├── mcp_server.py       # MCP 协议服务器
│   └── tools/              # 工具实现
│       ├── weather.py      # 天气工具
│       ├── train.py        # 高铁工具
│       └── flight.py       # 航班工具
├── finetune/               # LoRA 微调
│   ├── train_lora.py       # 训练脚本
│   └── rebuild_chroma_v3.py # 重建向量库
├── docs/                    # 知识文档
│   └── travel_knowledge     # 19 城攻略原始数据
├── launch_api.py           # 一键启动脚本
└── requirements.txt        # 依赖清单

技术栈

模型与推理: Qwen2.5-1.5B · LoRA (PEFT) · BitsAndBytes 4-bit · Transformers
RAG 检索: BAAI/bge-small-zh-v1.5 · ChromaDB · LangChain
Web 框架: FastAPI · Uvicorn · SSE 流式 · Pydantic
前端: 原生 HTML/CSS/JS · 卡片式 UI · 响应式布局
协议: MCP (Model Context Protocol) — stdio + SSE 双模式
持久化: SQLite · WAL 模式 · 线程安全
工具: wttr.in API · 内置 84 条高铁线路 · 89 条航线

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured