介绍
# Skånetrafiken Trip Planner
在瑞典斯科讷规划公共交通行程,获取实时出发信息。
## 命令
### 1. 搜索地点
搜索站点、地址或兴趣点。
```bash ./search-location.sh <query> [limit] ```
| 参数 | 描述 | |----------|-------------| | `query` | 要搜索的地点名称 | | `limit` | 显示的结果数量(默认:3,最大:10) |
**输出包括:** - `ID` - 地点标识符(在行程搜索中使用) - `Name` - 地点的官方名称 - `Type` - STOP_AREA(站点)、ADDRESS(地址)或 POI(兴趣点) - `Area` - 区域/市镇 - `Coordinates` - 纬度,经度
**何时增加 limit:** - 第一个结果不符合用户意图 - 用户的查询有歧义(例如 "station"、"centrum") - 需要向用户展示多个选项以供选择
### 2. 行程搜索
使用 ID 规划两个地点之间的行程。
```bash ./journey.sh <from-id> <from-type> <to-id> <to-type> [datetime] [mode] ```
| 参数 | 描述 | |----------|-------------| | `from-id` | 起点地点 ID(来自搜索)或坐标 (`lat#lon`) | | `from-type` | `STOP_AREA`、`ADDRESS`、`POI` 或 `LOCATION`(用于坐标) | | `to-id` | 目的地地点 ID 或坐标 | | `to-type` | 目的地类型 | | `datetime` | 可选:`"18:30"`、`"tomorrow 09:00"`、`"2026-01-15 09:00"` | | `mode` | 可选:`"depart"`(默认)或 `"arrive"` |
**重要提示:** 行程 API 仅接受 `STOP_AREA` 和 `LOCATION` 类型。对于 `ADDRESS` 或 `POI` 结果,请使用坐标作为 `lat#lon` 并指定类型为 `LOCATION`。
---
## 理解用户时间意图
在搜索之前,了解用户想要什么:
### 意图类型
| 用户说 | 意图 | 如何查询 | |-----------|--------|--------------| | "now", "next bus", "how do I get to" | **现在出发** | 无 datetime 参数 | | "in 30 minutes", "in 1 hour", "after lunch" | **稍后出发** | 计算时间,使用 `depart` 模式 | | "around 15:00", "sometime afternoon" | **大约在...时间** | 使用偏移量查询(见下文) | | "arrive by 18:00", "need to be there at 9" | **在...前到达** | 使用 `arrive` 模式 | | "tomorrow morning", "on Friday at 10" | **未来时间** | 使用具体的 datetime |
### 处理“大约在...时间”查询
当用户想要“大约”某个时间的选项时,请提前 15-30 分钟查询,以显示之前和之后的选项:
```bash # User: "I want to travel around 15:00" # Query at 14:30 to get options spanning 14:30-16:00+ ./journey.sh ... "14:30" depart ```
### 相对时间计算
将相对时间转换为绝对时间:
| 用户说 | 当前时间:14:00 | 查询时间 | |-----------|----------------|------------| | "in 30m" | → | "14:30" | | "in 1h" | → | "15:00" | | "in 2 hours" | → | "16:00" |
---
## LLM 响应格式
向用户展示行程结果时,请使用这些表情符号和格式指南。
### 表情符号参考
| 表情符号 | 用于 | |-------|---------| | 🚂 | 火车 (Pågatåg, Öresundståg) | | 🚌 | 公交车 | | 🚇 | 地铁 (哥本哈根) | | 🚋 | 有轨电车 | | ⛴️ | 轮渡 | | 🚶 | 步行路段 | | ⏱️ | 时间/时长 | | 🕐 | 出发时间 | | 🏁 | 到达时间 | | 📍 | 站点/车站 | | 🏠 | 起点(家/出发地) | | 🎯 | 目的地 | | ⚠️ | 晚点或中断 | | ✅ | 准点 | | 🔄 | 换乘/转车 | | 🛤️ | 站台/轨道 |
### 响应结构
**始终包含工具输出中的这些关键要素:**
1. **出发时间** - 用户实际需要开始的时间(包括步行) 2. **步行路段** - 任何步行的距离和时间 3. **交通出发** - 公交/火车实际出发的时间 4. **到达时间** - 用户到达目的地的时间 5. **任何晚点** - 显示与时刻表的偏差
### 响应格式示例
**对于简单的直达行程:** ``` 🏠 **Leave home at 09:00**
🚶 Walk 450m to Möllevångstorget (5 min)
📍 **Möllevångstorget** → 🎯 **Malmö C** 🚌 Bus 5 departs 09:07 from Möllevångstorget 🏁 Arrives 09:18 at Malmö C
⏱️ Total: 18 min ```
**对于换乘行程:** ``` 🏠 **Leave at 08:45**
🚶 Walk 300m to Västra Hamnen (4 min)
📍 **Västra Hamnen** → 🔄 **Malmö C** → 🎯 **Lund C**
**Leg 1:** 🚌 Bus 2 departs 08:51 [🛤️ Läge A] 🏁 Arrives Malmö C 09:05
🔄 Transfer at Malmö C (6 min)
**Leg 2:** 🚂 Pågatåg departs 09:11 [🛤️ Spår 4] 🏁 Arrives Lund C 09:23
⏱️ Total: 38 min | 🔄 1 change ```
**带有晚点:** ``` 🕐 **Depart 14:30** from Triangeln
🚂 Öresundståg 1042 → København H ⚠️ +8 min delay (expected 14:38 instead of 14:30) 🏁 Arrives ~15:25 (normally 15:17) ```
### 步行路段详情
**关键:始终显示来自工具输出的步行详情:**
- 以米为单位的距离(来自 `line.distance`) - 在“出发时间”计算中包含步行时间 - 在行程开始和结束时显示步行信息
工具输出示例: ``` → WALK 450m from Kalendegatan to Möllevångstorget ```
格式化为: ``` 🚶 Walk 450m to Möllevångstorget (~5 min) ```
步行时间估算:~100米/分钟(正常步行速度)
### 展示多个选项
当展示行程选项时,请使时间清晰明了:
``` I found 3 options for you:
**Option 1 - Leave now (09:00)** ✅ Recommended 🚶 5 min walk → 🚌 Bus 5 at 09:07 → arrives 09:25 ⏱️ Total: 25 min
**Option 2 - Leave in 15m (09:15)** 🚶 5 min walk → 🚌 Bus 5 at 09:22 → arrives 09:40 ⏱️ Total: 25 min
**Option 3 - Leave in 30m (09:30)** 🚶 5 min walk → 🚂 Train at 09:37 → arrives 09:48 ⏱️ Total: 18 min | Faster but later departure ```
### 时间偏移量符号
使用清晰的符号表示出发时间:
| 符号 | 含义 | |----------|---------| | "now" | 立即 | | "in 15m" | 15 分钟后 | | "in 1h" | 1 小时后 | | "at 14:30" | 具体时间 |
---
## LLM 工作流程:如何规划行程
当用户要求规划行程时,请遵循此工作流程:
### 步骤 1:理解时间意图
解析用户想要什么: - **“How do I get to...”** → 现在出发 - **“I need to be there at 18:00”** → 到达模式 - **“Sometime around 3pm”** → 查询 14:30,显示范围 - **“In about an hour”** → 从当前时间计算
### 步骤 2:搜索两个地点
分别搜索起点和目的地:
```bash ./search-location.sh "Malmö C" ./search-location.sh "Emporia" ```
### 步骤 3:验证搜索结果
**仔细检查每个结果:**
1. **精确匹配或接近匹配?** - 如果名称与用户询问的相符,请继续。
2. **返回了多个结果?** - 脚本最多显示 10 个匹配项。如果第一个结果明显不正确,请让用户确认。
3. **名称差异很大?** - 如果用户询问“Hyllie 附近的购物中心”而结果显示“Emporia”,请向用户确认:“我找到了 Hyllie 附近的 Emporia 购物中心。这是正确的吗?”
4. **未找到结果?** - 尝试替代策略(见下文)。
### 步骤 4:处理模糊或失败的搜索
**当结果不匹配或有歧义时,请提出澄清问题:**
``` I searched for "centrum" and found multiple locations: 1. Malmö Centrum (bus stop) 2. Lund Centrum (bus stop) 3. Helsingborg Centrum (bus stop)
Which one did you mean? ```
**当未找到结果时,请尝试以下策略:**
1. **尝试在地址中添加城市名称:** ```bash # If "Storgatan 10" fails, try: ./search-location.sh "Storgatan 10, Malmö" ```
2. **尝试官方车站名称:** ```bash # If "Malmö station" fails, try: ./search-location.sh "Malmö C" ```
3. **尝试仅使用地标名称(不带城市):** ```bash # If "Emporia, Malmö" fails, try: ./search-location.sh "Emporia" ```
4. **使用坐标作为最后手段:** - 如果您知道大致位置,请直接使用 `lat#lon` 格式 - 询问用户:“我找不到该地点。您能提供地址或坐标吗?”
### 步骤 5:为行程 API 转换类型
行程 API 仅接受: - `STOP_AREA` - 公交/火车站(直接使用 ID) - `LOCATION` - `lat#lon` 形式的 GPS 坐标
**如果搜索返回 ADDRESS 或 POI:** - 使用搜索结果中的坐标 - 格式化为 `lat#lon`,类型为 `LOCATION`
示例: ```bash # Search returns: ID: 123, Type: ADDRESS, Coordinates: 55.605, 13.003 # Use in journey as: ./journey.sh "55.605#13.003" LOCATION 9021012080000000 STOP_AREA ```
### 步骤 6:执行行程搜索
一旦您确认了两个地点的 ID/坐标:
```bash ./journey.sh <from-id> <from-type> <to-id> <to-type> [datetime] [mode] ```
### 步骤 7:使用表情符号格式化响应
使用上面的表情符号指南清晰地展示结果。**始终使用工具输出中的实际数字——切勿推测或估算。**
---
## 查询格式规则
**搜索 API 对格式敏感。请遵循以下规则:**
### 地标和 POI:仅名称
使用地标名称时不要带城市名称。
```bash # CORRECT ./search-location.sh "Emporia" ./search-location.sh "Triangeln" ./search-location.sh "Turning Torso"
# WRONG - city name breaks POI search ./search-location.sh "Emporia, Malmö" # May return wrong location! ./search-location.sh "Triangeln, Malmö" # Unnecessary, may fail ```
### 街道地址:包含城市
包含城市名称以提高准确性。
```bash # CORRECT ./search-location.sh "Kalendegatan 12, Malmö" ./search-location.sh "Storgatan 25, Lund" ./search-location.sh "Drottninggatan 5, Helsingborg"
# RISKY - may be ambiguous ./search-location.sh "Kalendegatan 12" # Works if unambiguous ```
### 火车站:使用官方名称
使用“C”后缀表示中央车站。
```bash # CORRECT ./search-location.sh "Malmö C" ./search-location.sh "Lund C" ./search-location.sh "Helsingborg C" ./search-location.sh "Malmö Hyllie" ./search-location.sh "Malmö Triangeln"
# WRONG ./search-location.sh "Malmö" # Ambiguous! ./search-location.sh "Malmö Central" # Not official name ./search-location.sh "Lund station" # Not official name ```
### 哥本哈根(跨境)
使用丹麦名称或通用别名。
```bash # All work ./search-location.sh "København H" ./search-location.sh "Nørreport" ./search-location.sh "Copenhagen Airport" ./search-location.sh "Köpenhamn" ```
---
## 示例
### 示例 1:现在出发
用户:“How do I get from Malmö C to Lund C?”
```bash ./search-location.sh "Malmö C" ./search-location.sh "Lund C" ./journey.sh 9021012080000000 STOP_AREA 9021012080040000 STOP_AREA ```
**响应:** ``` 🏠 **Leave now** from Malmö C
📍 **Malmö C** → 🎯 **Lund C** 🚂 Öresundståg 1324 departs 09:04 [🛤️ Spår 2b] 🏁 Arrives 09:16 at Lund C [🛤️ Spår 1]
⏱️ Total: 12 min | ✅ Direct, no changes ```
### 示例 2:包含步行的地址
用户:“I need to go from Kalendegatan 12 in Malmö to Emporia”
```bash ./search-location.sh "Kalendegatan 12, Malmö" ./search-location.sh "Emporia" ./journey.sh "55.595#13.001" LOCATION "55.563#12.973" LOCATION ```
**响应:** ``` 🏠 **Leave at 10:05**
🚶 Walk 320m to Möllevångstorget (~3 min)
📍 **Möllevångstorget** → 🎯 **Emporia** 🚌 Bus 32 departs 10:10 🏁 Arrives 10:28 at Emporia
🚶 Walk 150m to destination (~2 min)
⏱️ Total: 25 min ```
### 示例 3:在...前到达
用户:“I need to be at Copenhagen central by 18:00 tomorrow”
```bash ./search-location.sh "Malmö C" ./search-location.sh "København H" ./journey.sh 9021012080000000 STOP_AREA 9921000008600626 STOP_AREA "tomorrow 18:00" arrive ```
**响应:** ``` 🎯 **Arrive by 18:00** at København H
📍 **Malmö C** → 🎯 **København H** 🚂 Öresundståg departs **17:21** [🛤️ Spår 1] 🏁 Arrives **17:56** ✅ 4 min buffer
⏱️ Journey: 35 min
💡 Leave Malmö C by 17:21 to arrive on time! ```
### 示例 4:大约时间查询
用户:“I want to travel to Lund around 15:00”
```bash # Query 30 min earlier to show options around 15:00 ./journey.sh 9021012080000000 STOP_AREA 9021012080040000 STOP_AREA "14:30" ```
**响应:** ``` Options around 15:00 for Malmö C → Lund C:
**Option 1 - Depart 14:34** (in 25m) 🚂 Pågatåg → arrives 14:52 ⏱️ 18 min
**Option 2 - Depart 14:49** (in 40m) 🚂 Öresundståg → arrives 15:01 ⏱️ 12 min
**Option 3 - Depart 15:04** (in 55m) ✅ Closest to 15:00 🚂 Pågatåg → arrives 15:22 ⏱️ 18 min
Which works best for you? ```
### 示例 5:相对时间
用户:“I want to leave in about an hour”
```bash # Current time: 13:00, so query for 14:00 ./journey.sh ... "14:00" ```
**响应:** ``` Options departing around 14:00 (in ~1h):
**Leave at 13:55** (in 55m) 🚶 5 min walk → 🚌 Bus 5 at 14:02 → arrives 14:25
**Leave at 14:10** (in 1h 10m) 🚶 5 min walk → 🚂 Train at 14:17 → arrives 14:35
Let me know which one works! ```
### 示例 6:包含晚点的行程
当工具输出显示晚点时: ``` From: 14:30 Malmö C [+8 min late] ```
**响应:** ``` 📍 **Malmö C** → 🎯 **Lund C** 🚂 Öresundståg 1042 ⚠️ **Running 8 min late** 🕐 Scheduled: 14:30 → Expected: ~14:38 🏁 Arrives ~14:50 (normally 14:42) ```
---
## 何时提出澄清问题
**始终在以下情况下提问:**
1. **搜索未返回结果:** - “我找不到 [地点]。您能提供更多详细信息,例如完整地址或附近的地标吗?”
2. **多个合理匹配:** - “我发现了几个与 '[query]' 匹配的地点:[list]。您指的是哪一个?”
3. **结果名称与查询差异很大:** - “您询问了 '[user query]',但我找到的最接近的匹配是 '[result name]'。这正确吗?”
4. **用户请求含糊不清:** - “From Malmö” - “马尔默的哪个地点?中央车站,还是特定地址?”
5. **跨境歧义:** - “Copenhagen” 可能指不同的车站 - 确认他们是否想要 København H(中央车站)、机场或其他车站。
6. **时间不明确:** - “您想什么时候出行?现在,还是在特定时间?”
---
## 日期时间格式
所有时间均为瑞典当地时间 (CET/CEST)。
| 格式 | 示例 | 含义 | |--------|---------|---------| | _(空)_ | | 现在出发 | | `HH:MM` | `"18:30"` | 今天 18:30 | | `tomorrow HH:MM` | `"tomorrow 09:00"` | 明天 09:00 | | `YYYY-MM-DD HH:MM` | `"2026-01-15 09:00"` | 具体日期 |
---
## 输出格式
### 行程选项(原始工具输出)
``` ══════════════════════════════════════════════════════════════ OPTION 1: Malmö C → Lund C ══════════════════════════════════════════════════════════════ Date: 2026-01-14 Depart: 09:04 Arrive: 09:16 Changes: 0
LEGS: → ORESUND Öresundståg 1324 From: 09:04 Malmö C [Spår 2b] To: 09:16 Lund C [Spår 1] Direction: mot Helsingborg C ```
### 交通类型
| 类型 | 表情符号 | 描述 | |------|-------|-------------| | `TRAIN` | 🚂 | Pågatåg(区域火车) | | `ORESUND` | 🚂 | Öresundståg(跨境火车) | | `BUS` | 🚌 | 城市或区域公交 | | `WALK` | 🚶 | 步行路段 | | `TRAM` | 🚋 | 有轨电车/轻轨 | | `METRO` | 🚇 | 哥本哈根地铁 | | `FERRY` | ⛴️ | 轮渡 |
### 状态指示器
| 指示器 | 表情符号 | 含义 | |-----------|-------|---------| | _(无)_ | ✅ | 准点 | | `[+X min late]` | ⚠️ | 晚点 | | `[-X min early]` | ℹ️ | 提前 | | `[PASSED]` | ❌ | 已发出 | | `AVVIKELSE` | 🚨 | 服务中断 |
---
## 错误处理
### "No locations found"
搜索未返回结果。
**策略:** 1. 检查拼写(瑞典语:å, ä, ö) 2. 尝试带“C”(代表 central/中心)的官方车站名称 3. 对于地标,去除城市后缀 4. 对于地址,添加城市名称 5. 请用户进行澄清
### “未找到行程”
没有可用路线。
**策略:** 1. 检查该时段是否有运营服务(深夜/清晨班次有限) 2. 尝试不同的出发时间 3. 建议附近的替代站点
---
## 快速参考
| 位置类型 | 搜索格式 | 行程类型 | |--------------|---------------|--------------| | 火车站 | `"Malmö C"` | STOP_AREA | | 公交车站 | `"Möllevångstorget"` | STOP_AREA | | 地址 | `"Street 12, City"` | 使用坐标 → LOCATION | | 地标/兴趣点 | `"Emporia"`(不要带城市!) | 使用坐标 → LOCATION | | 坐标 | `55.605#13.003` | LOCATION |