Back to skills
extension
Category: Productivity & OfficeNo API key required

旅游规划助手

Travel Planner 是一个全方位的 AI 旅行规划技能,支持在 Trae Work 等 AI 工具中全自动调用,也可通过本地 Python 脚本独立运行。只需提供出发地和目的地,即可自动生成包含逐日行程时间轴、景点门票与预约信息、真实餐馆推荐(含备选店)、住宿详情、百度地图导航链接及预算总览的精美 HTML 攻略。支持自驾游路线规划,含里程、驾驶时间、油费过路费估算及沿途城市停留建议。每个景点自动生成实景图片,每段行程附带导航链接,让旅行说走就走、照着走就行。

personAuthor: PBitWenhubModelScope

Travel Planner

Plan a complete, day-by-day travel itinerary from a departure location to a destination, covering attractions, accommodation, dining, transportation, navigation, and generated visual imagery. Output a polished, self-contained HTML travel guide.

Modes of Operation

This skill supports two execution modes:

Mode A: AI Tool Invocation (e.g. Trae Work)

When invoked inside an AI coding assistant (Trae Work, Cursor, etc.), the assistant uses its built-in tools (WebSearch, WebFetch, GenerateImage, Write, Edit) to execute the full workflow automatically. The SKILL.md instructions below guide the AI agent step-by-step.

Mode B: Local CLI Execution

When run locally without an AI agent, use the provided travel-planner.py script. It generates an HTML template pre-filled with placeholder data. The user then manually fills in research data (or feeds the template back to an AI agent for completion). See README.md for details.

Inputs

Collect the following from the user. If any are missing, ask before proceeding:

| Parameter | Required | Description | |-----------|----------|-------------| | origin | Yes | Departure city/location | | destination | Yes | Target city/location | | days | No | Trip length in days. Default: 3 days | | budget | No | Budget level: budget / moderate / luxury. Default: moderate | | dining_budget | Yes | Total acceptable spending per meal for the WHOLE group (e.g. "2人每餐100元" = ¥100 total per meal for 2 people, i.e. ¥50/person). CRITICAL for restaurant selection — must ask the user if not provided. Example values: "2人每餐80元" (budget), "2人每餐150元" (moderate), "2人每餐300元" (high-end) | | preferences | No | Interests: nature, culture, food, shopping, adventure, relaxation, family-friendly, etc. | | travel_dates | No | Specific dates or season. Helps with weather/seasonal advice | | travel_mode | No | Transport mode: self-driving / public / mixed. Default: public. When self-driving, plan driving routes, distances, drive times, rest stops, parking, and fuel costs | | daily_drive_limit | No | For self-driving: max driving hours per day. Default: 4 hours | | travelers | No | Number of travelers and relationship (e.g. "2 people, couple"). Affects restaurant/hotel recommendations |

Workflow

Step 1: Confirm Parameters

Summarize the confirmed trip parameters back to the user in a short table. If the user already provided all info, proceed directly without asking.

MUST ask the following if not already provided by the user:

  • dining_budget: "您每餐(全体成员合计)可以接受的餐饮预算是多少?例如:2人每餐100元(即人均50元)" — this directly determines which restaurants to recommend. Do NOT proceed to research without this answer.
  • travelers: "出行人数和关系?例如2人情侣、3口之家" — affects restaurant table sizing and hotel room type
  • preferences: "您更感兴趣哪些体验?自然风光/美食/人文历史/休闲放松/赶海等"

Step 2: Research the Destination

Use WebSearch to gather current, accurate information. Run multiple searches in parallel:

  1. Attractions: "{destination} top attractions must visit {year}" and "{destination} hidden gems off the beaten path"
  2. Food & Restaurants: "{destination} best local food restaurants must try" and "{destination} must-try local dishes cuisine specialty" and "{destination} 人均{per_person_price}元 美食餐厅推荐" (use the dining_budget to search for restaurants in the right price tier)
  3. Accommodation: "{destination} best areas to stay hotels" and "{destination} {budget} accommodation recommendations"
  4. Transportation: "how to get from {origin} to {destination}" and "{destination} local transportation guide"
  5. Practical info: "{destination} travel tips weather {season}" and "{destination} travel advisory safety"

If travel_mode is self-driving, add these searches: 6. Driving route: "{origin} to {destination} driving route distance highway" and "{origin} to {destination} self-driving travel guide" 7. Road trip stops: "cities attractions along {origin} to {destination} highway road trip" — identify worthwhile stopover cities and midway attractions to break up long drives 8. Driving practical: "{destination} self-driving parking tips gas stations" and "{destination} road conditions toll fees {year}"

For each stopover city on a road trip, also search: 9. City-specific restaurants: "{city} best restaurants local specialty must eat" — find 2-3 real, named restaurants with addresses 10. City-specific attractions: "{city} top attractions things to do" — find real attractions with ticket info

For each search, evaluate snippets first. If truncated or insufficient, use WebFetch on the most authoritative source to get full content.

Record key facts before chaining the next search. Do not run searches blindly — digest results, extract names/addresses/prices/tips, then decide if a follow-up is needed.

Step 3: Research Ticket & Booking Info for Every Attraction

For every attraction in the itinerary, search for its current ticket/booking information:

  • "景点名 门票 预约 购票方式 {year}" — determine: price, whether advance reservation is required, how to book (WeChat official account / Meituan / Ctrip / on-site), and whether same-day purchase is possible
  • Compile into a concise ticket info line for each attraction, format:
    • 🎟️ 购票:{price} · {reservation required?} · {booking method} · {same-day OK?}

This is critical — users need to know in advance whether they can buy tickets on arrival or must reserve days ahead.

Step 4: Plan the Itinerary

Build a day-by-day plan following these principles:

  • Day 1: Arrival, check-in, nearby light exploration, welcome dinner
  • Middle days: Full sightseeing — 2-3 major attractions per day grouped by geographic proximity to minimize transit
  • Last day: Morning activity, souvenir shopping, departure

For self-driving trips, apply these additional rules:

  • Plan the driving route with realistic daily segments — never exceed daily_drive_limit hours of driving per day
  • If the one-way distance exceeds ~500 km or ~6 hours, insert stopover days at midway cities with their own mini-itinerary
  • For each driving segment, specify: distance (km), estimated drive time, highway name (or national road), toll estimate, and recommended rest stops / service areas
  • Note parking availability and approximate cost for every attraction and restaurant
  • Include fuel cost estimates based on distance and average fuel consumption (assume ~8L/100km at local fuel price)
  • On driving-heavy days, schedule lighter sightseeing; on full sightseeing days, minimize driving
  • Consider return route — it can mirror the outbound route or take a different path for variety
  • If highway toll-free policy applies (e.g. Chinese National Day holidays Oct 1-7), note it and plan return trip on highways to save toll fees

Time allocation for every attraction (required for all modes, especially self-driving):

  • Assign a recommended duration (e.g., 1.5h, 2h, half-day) for each attraction based on its scale and content
  • Structure each day as a concrete timeline with start/end times, e.g.:
    • 08:30–09:30 Drive to Location A (60 km, ~1h)
    • 09:30–11:30 Visit Location A (2h)
    • 11:30–12:00 Drive to Restaurant (15 min)
    • 12:00–13:30 Lunch (1.5h)
    • 13:30–14:00 Drive to Location B (20 min)
    • 14:00–16:00 Visit Location B (2h)
  • This timeline makes the plan directly actionable — the user can follow it hour by hour
  • Factor in: driving time between spots, parking time, meal duration, rest breaks, and buffer time for crowds/photos

For each day, include:

  • Detailed timeline with specific start/end times for every activity and transit segment
  • Per-attraction duration clearly marked (e.g., "建议游玩 2 小时")
  • Ticket info for each attraction (price, reservation method, same-day availability) — placed directly after the attraction description
  • Lunch & Dinner restaurant recommendations with specific restaurant name, address, cuisine type, price range, and why it's recommended
  • Breakfast info: if hotel doesn't include breakfast, recommend a nearby breakfast spot with distance from hotel
  • Distance & navigation (MANDATORY for every transition): Between EVERY pair of consecutive locations in the daily timeline, you MUST include a distance line. This is not optional. For every A→B transition (hotel→attraction, attraction→restaurant, restaurant→attraction, attraction→hotel, attraction→attraction), include:
    • Distance in km (or "步行Xm" for very short walks)
    • Travel method: 🚶 walking / 🚗 taxi / 🚇 metro+bus
    • Estimated time (e.g., "步行15min" / "打车约20min" / "地铁3号线约25min")
    • Baidu Maps navigation link: https://api.map.baidu.com/direction?origin={A}&destination={B}&mode={driving|walking|transit}&output=html&src=webapp
    • Format: 🚶 A → B: 约1.5km · 步行20min · [导航](link) or 🚗 A → B: 约8km · 打车20min·约¥18 · [导航](link)
    • For metro: 🚇 A → B: 地铁X号线 · 约25min · [导航](link)
    • If you cannot find the exact distance, use Baidu Maps to estimate — NEVER skip this line
  • Transportation notes between spots — for self-driving: distance, drive time, route, parking; for public: metro/bus lines
  • Estimated costs for each activity (tickets, parking, fuel for that day)
  • Attraction photo for EVERY attraction — no exceptions (see Step 4b below)

Step 4b: Generate Attraction Photos (MANDATORY — Pre-generate Local Files)

For every attraction in the itinerary, generate a visual photo and display it directly in the HTML. No expandable panels, no external review links — just a clean image so the user can quickly see what the attraction looks like.

CRITICAL — Stability requirement: You MUST pre-generate all images as local files using the GenerateImage tool BEFORE assembling the HTML. Do NOT use inline API URLs in <img src> — they cause unstable loading (rate limits, timeouts, encoding issues) when many images load simultaneously.

  1. Plan the image list — before generating, compile a complete list of ALL images needed. This is a mandatory planning step — do NOT skip any attraction:

    • 1 cover image (landscape_16_9)
    • N day banner images — one per day (landscape_16_9)
    • M attraction photos — one per EVERY attraction in the itinerary, NO EXCEPTIONS (landscape_4_3)
    • Write out the full list as a checklist. Example for a 3-day trip:
      [ ] cover.jpg — 青岛海岸线全景
      [ ] day1_banner.jpg — Day 1 主题图
      [ ] day2_banner.jpg — Day 2 主题图
      [ ] day3_banner.jpg — Day 3 主题图
      [ ] zhanqiao.jpg — 栈桥
      [ ] xiaoyushan.jpg — 小鱼山公园
      [ ] xinhao_mountain.jpg — 信号山公园
      [ ] beer_museum.jpg — 青岛啤酒博物馆
      [ ] badaguan.jpg — 八大关
      [ ] yanerdao.jpg — 燕儿岛山公园
      [ ] xiaomaidao.jpg — 小麦岛
      [ ] wusi_square.jpg — 五四广场
      [ ] olympic_center.jpg — 奥帆中心
      [ ] laoshan.jpg — 崂山风景区
      [ ] shilaoren.jpg — 石老人海水浴场
      [ ] golden_beach.jpg — 金沙滩
      
    • Count: every attraction named in the timeline must appear in this list
    • Total typically 20-35 images for a 10-day trip
  2. Generate each image using GenerateImage (sequential — the tool does not support parallel calls):

    • Prompt format: "{attraction_name} {city} realistic travel photograph, natural lighting, {season}, iconic view"
    • Save path: {working_dir}/travel-images/{slug}do NOT include file extension (tool determines format automatically)
    • Image size: landscape_4_3 for attractions, landscape_16_9 for cover/day banners
    • Track every return value: the tool returns the actual saved path (e.g. travel-images/zhanqiao.png). Record these exact paths for use in HTML.
  3. Verify generated files: After all GenerateImage calls complete, use LS on the travel-images/ directory to confirm all files exist and record their actual filenames (extensions may vary).

  4. Display in HTML — reference the verified local file paths. Add onerror fallback for maximum stability:

    <div class="attraction-photo">
      <img src="travel-images/{actual_filename}" alt="{attraction_name}" loading="lazy"
           onerror="this.style.display='none';this.parentElement.classList.add('photo-fallback')">
      <div class="photo-caption">📷 {attraction_name} 实景</div>
    </div>
    
  5. CSS for the photo block (includes fallback gradient placeholder):

    .attraction-photo{margin-top:10px;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.1);min-height:120px}
    .attraction-photo img{width:100%;display:block;aspect-ratio:4/3;object-fit:cover;transition:transform .3s}
    .attraction-photo img:hover{transform:scale(1.02)}
    .photo-caption{padding:6px 12px;background:#f0f7ff;font-size:.75rem;color:var(--text-light);text-align:center}
    .photo-fallback{background:linear-gradient(135deg,var(--primary),var(--primary-light));display:flex;align-items:center;justify-content:center;min-height:150px}
    .photo-fallback::before{content:'📷 图片加载中...';color:#fff;font-size:.85rem;opacity:.8}
    

Step 5: Restaurant Research — Specific Names, Addresses, and Alternates

For every meal (breakfast, lunch, dinner) in the itinerary, research and provide:

CRITICAL — Dining budget filter: Use the user's dining_budget to filter ALL restaurant recommendations. If the user said "2人每餐100元", then every recommended restaurant must have per-person price ≤ ¥50. Search for restaurants in the appropriate price tier:

  • dining_budget ≤ ¥80/2人 (budget): street food, local snacks, quick-service (人均≤¥40)
  • dining_budget ¥80-150/2人 (moderate): mid-range local restaurants (人均¥40-75)
  • dining_budget ¥150-300/2人 (high-end): upscale restaurants (人均¥75-150)
  • dining_budget > ¥300/2人 (luxury): fine dining (人均>¥150)
  • Convert group total to per-person: per_person = dining_budget / travelers
  1. Primary recommendation: A real, named restaurant with:

    • Specific restaurant name (e.g. "老家地锅", not "地锅鸡店")
    • Detailed address (street name and number, district)
    • Per-person price range — MUST be within the dining_budget per-person limit
    • Signature dishes
    • Why it's recommended (history, reputation, local favorite, awards, etc.)
  2. Alternate recommendation: A different restaurant (not the same as any other meal's recommendation) with:

    • Different restaurant name
    • Address
    • Per-person price
    • Brief description
    • Distance from the primary recommendation (they should be nearby)
    • Navigation link from primary to alternate
  3. Distance from previous location: How far from the previous activity/hotel to this restaurant, with navigation link

Important:

  • Search for real, well-reviewed restaurants via WebSearch before assigning names
  • Each meal's alternate must be a different restaurant — never reuse the same alternate across multiple meals
  • Include the restaurant's actual address in the guide text
  • Do NOT use generic search terms like "快捷酒店" or "海鲜大排档" — use actual establishment names like "沃德酒店(威海国际海水浴场店)" or "巧克力渔家(韩乐坊店)"

Step 6: Generate Cover & Day Banner Images (MANDATORY — Pre-generate Local Files)

This step generates the cover image and per-day banner images. This is mandatory — do not skip or use inline API URLs.

All images (from Step 4b attraction photos + this step's cover/day banners) must be generated BEFORE assembling the HTML (Step 7).

  1. Cover image: A scenic wide shot of the destination's most iconic landmark (landscape_16_9)
  2. Per-day images: A representative scene from that day's key attraction or dining experience (landscape_16_9)

Image prompt guidelines:

  • Start each prompt with a purpose tag: Travel itinerary illustration:
  • Describe a concrete, realistic, photorealistic scene
  • Include the specific landmark/restaurant name in the prompt
  • Specify: subject, lighting, time of day, camera style
  • Example: Travel itinerary illustration: Photorealistic wide shot of Kyoto Fushimi Inari Shrine thousands of vermilion torii gates at golden hour, warm sunlight filtering through, a few visitors walking, professional travel photography style, high detail

Save images to the working directory (no file extension in path): {working_dir}/travel-images/cover, {working_dir}/travel-images/day1_{attraction}, etc.

Track every return value from GenerateImage — the tool returns the actual saved path with extension. Record these for HTML assembly.

Do not generate more than one image per call. Run GenerateImage calls sequentially (the tool does not support parallel calls).

After all images are generated, use LS on {working_dir}/travel-images/ to verify all files exist before proceeding to Step 7.

Step 6.5: Pre-Assembly Verification Checklist (MANDATORY)

Before writing any HTML, you MUST run through this checklist. If ANY item fails, fix it before proceeding to Step 7. This prevents the two most common problems: missing attraction photos and missing distance navigation.

Photo Coverage Check:

  • [ ] Count the total number of attractions in your itinerary (every timeline item that is a place/attraction, NOT meals or transit)
  • [ ] Count the number of attraction photos generated in travel-images/
  • [ ] These two numbers MUST be equal. If not, generate the missing photos now.
  • [ ] Verify: every attraction name in the timeline has a corresponding image file

Distance Navigation Check:

  • [ ] For each day, list every consecutive location pair (A→B) in order
  • [ ] Verify each pair has: distance (km/m), travel method, time, Baidu Maps link
  • [ ] Count transitions (e.g., Day with hotel→A→lunch→B→C→hotel = 5 transitions)
  • [ ] Count distance lines in your plan. These MUST be equal.
  • [ ] If any transition is missing a distance line, add it now using Baidu Maps estimates

Ticket Info Check:

  • [ ] Every attraction has a 🎟️ ticket line (price, reservation method, same-day availability)
  • [ ] Free attractions explicitly say "免费"

Restaurant Check:

  • [ ] Every meal (breakfast/lunch/dinner) has a primary restaurant with name + address + price
  • [ ] Every meal has a DIFFERENT alternate restaurant (no repeats across the entire trip)
  • [ ] Dining budget check: Every recommended restaurant's per-person price is within the user's dining_budget / travelers limit. If any restaurant exceeds the limit, replace it with a cheaper alternative.

Example distance chain for one day:

Day 2 timeline locations in order:
  Hotel → 栈桥 → 小鱼山 → 信号山 → 春和楼(午餐) → 啤酒博物馆 → 双合园(晚餐) → Hotel

Required distance lines (7 transitions):
  1. 🚶 酒店→栈桥: 约1.5km · 步行20min · [导航](link)
  2. 🚶 栈桥→小鱼山: 约1km · 步行15min · [导航](link)
  3. 🚶 小鱼山→信号山: 约1.5km · 步行20min · [导航](link)
  4. 🚶 信号山→春和楼: 约1km · 步行15min · [导航](link)
  5. 🚇 春和楼→啤酒博物馆: 地铁2号线 · 约15min · [导航](link)
  6. 🚇 啤酒博物馆→双合园: 地铁2号线 · 约10min · [导航](link)
  7. 🚇 双合园→酒店: 地铁1号线 · 约15min · [导航](link)

Step 7: Assemble the HTML Deliverable

Produce a polished self-contained HTML travel guide with inline CSS and JS. The HTML should reference generated images via relative paths (from Step 4b & 6 verified filenames) and load Leaflet.js from CDN for the route map.

Image stability rules for HTML assembly:

  • All <img> tags MUST include loading="lazy" and an onerror fallback handler
  • Cover image onerror: replace with gradient overlay, keep text visible
  • Day banner onerror: replace with gradient, keep day info text visible
  • Attraction photo onerror: show gradient placeholder with attraction name
  • Add a global JS image error handler as a safety net:
<script>
// Global image error handler — converts broken images to gradient placeholders
document.addEventListener('error', function(e){
  if(e.target.tagName==='IMG'){
    e.target.style.display='none';
    var p=e.target.parentElement;
    if(p&&!p.classList.contains('img-fallback')){
      p.classList.add('img-fallback');
    }
  }
},true);
</script>

Add this CSS for all fallback states:

.img-fallback{background:linear-gradient(135deg,var(--primary),var(--primary-light));display:flex;align-items:center;justify-content:center;min-height:150px}
.day-banner .img-fallback{min-height:200px}
.cover .img-fallback{min-height:380px}

HTML Structure (in this order):

1. Cover section — destination name, trip dates, cover image, trip badges
2. Trip overview table — origin, destination, days, budget, travel mode, total estimated cost
3. Route map overview (self-driving) — Leaflet map with real geographic coordinates, outbound and return routes as polylines with via-points along actual roads (not straight lines through water/mountains), city markers with popups, layer switcher, plus a route summary table below
4. Day-by-day itinerary — for each day:
   a. Day banner with generated image, day number, date, theme
   b. Driving summary bar (self-driving): road name, distance, drive time, fuel cost, toll, navigation buttons
   c. Hourly timeline with:
      - Time slots for every activity
      - Attraction descriptions with duration badges
      - 📸 Attraction photo (local image file, one per EVERY attraction — no exceptions)
      - 🎟️ Ticket info line (price, reservation method, same-day OK?)
      - 🍴 Restaurant recommendation (name, address, per-person price)
      - 📝 Why recommended (signature dishes, history, reputation)
      - 🍴 Alternate restaurant (different name, address, price, distance from primary, navigation link)
      - 🚗/🚶 Distance navigation between EVERY consecutive location — MANDATORY, no transitions skipped:
        * Format: `<div class="distance-info">🚶 A → B: 约1.5km · 步行20min · <a class="nav-link" href="baidu_url">📍 导航</a></div>`
        * Place AFTER each timeline item, BEFORE the next item
        * Every hotel→attraction, attraction→restaurant, restaurant→attraction, attraction→hotel transition MUST have this line
      - 🏨 Hotel details (price/night, parking, breakfast, distance to attractions)
   d. Meal cards: breakfast, lunch & dinner with restaurant name, address, price
   e. Daily cost breakdown
5. Budget summary — total estimated cost breakdown table (fuel, tolls, parking, tickets, food, accommodation, misc) with per-person total
6. Accommodation summary table — date, city, hotel name, price/night, parking, breakfast, map search link
7. Driving tips (self-driving only) — road conditions, speed limits, service areas, safety reminders
8. Practical info — weather, ticket booking reminders, essential items, driving notes
9. Sources — web links used for research

CSS Design Guidelines:

The HTML should use a clean, modern travel-magazine aesthetic with the following CSS variable palette:

:root{
  --primary:#1a6b8e;       /* Deep ocean blue */
  --primary-light:#3a9bc4;  /* Lighter blue */
  --accent:#f4a261;         /* Warm amber */
  --accent-light:#f7c896;   /* Light amber */
  --bg:#f0f4f8;             /* Light gray-blue background */
  --card-bg:#fff;
  --text:#2d3748;
  --text-light:#718096;
  --border:#e2e8f0;
  --success:#38a169;        /* Green for free/badges */
  --danger:#e53e3e;         /* Red for costs */
  --baidu:#2932e1;          /* Baidu Maps blue */
  --shadow:0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:0 8px 24px rgba(0,0,0,.12);
}

Key UI components:

  • Cover: Full-width image with gradient overlay, title, badges
  • Day cards: Rounded white cards with shadow, banner image, timeline body
  • Timeline: Vertical line with dots, each item has time/activity/detail/nav rows
  • Distance info (MANDATORY between every transition): Light blue background pill, displayed after every timeline item before the next. CSS:
    .distance-info{display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:5px 12px;margin:6px 0 6px 28px;border-radius:8px;background:#e8f4fd;font-size:.76rem;color:var(--primary-light)}
    .distance-info .nav-link{margin-left:auto;color:var(--baidu);text-decoration:underline dashed;text-underline-offset:2px}
    
  • Drive summary bar: Light blue background, inline items for road/distance/time/fuel/toll + navigation buttons
  • Nav buttons: Baidu blue background, white text, map icon
  • Search links: Baidu blue text with 📍 icon, dashed underline
  • Attraction photos: One per EVERY attraction, local image file, rounded corners with shadow, onerror fallback to gradient placeholder
  • Meal cards: 2-column grid, amber border, restaurant name + info + price
  • Budget table: Blue header, right-aligned amounts, highlighted total row
  • Info cards: Grid layout for practical info
  • Responsive: Media query at 768px for mobile

Baidu Maps Navigation Integration (for China destinations):

  1. Visual route map (Leaflet + real tile layer):

    • Use Leaflet.js with Gaode (高德) map tiles for China (faster CDN than OSM, no gray tiles):
      https://webrd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}
      
    • Add OSM as alternate layer with layer switcher
    • Plot city markers using real latitude/longitude coordinates
    • Draw polylines for outbound (red dashed) and return (green dashed) routes
    • Add via-points along the route so the line follows actual roads, NOT straight lines through water/mountains (e.g. if the route crosses a peninsula, add coastal via-points)
    • Each marker has a popup with city name and day info
    • Below the map, add a route summary table: day, route, distance, drive time, road name
    • Add a "Open in Baidu Maps" button below the map for full navigation
  2. Daily driving navigation buttons: For each driving segment, generate navigation links:

    https://api.map.baidu.com/direction?origin={from}&destination={to}&mode=driving&output=html&src=webapp
    
    • Include a "full route" button and individual segment buttons
    • Style as blue buttons with 🗺️ icon
    • For walking segments, use mode=walking
  3. Specific restaurant & hotel search links: For each venue:

    https://map.baidu.com/search?query={specific_restaurant_name}&city={city}
    
  4. Distance navigation between locations: For every A→B transition in the daily timeline:

    https://api.map.baidu.com/direction?origin={location_a}&destination={location_b}&mode={driving|walking}&output=html&src=webapp
    
    • Display as: 🚗 A → B: 约Xkm · 开车Ymin · [导航链接]
    • Use 🚶 for walking, 🚗 for driving
  5. Attraction search links: For each attraction:

    https://map.baidu.com/search?query={attraction_name}&city={city}
    

Important: Always research specific, real restaurant and hotel names via WebSearch. Include their addresses in the guide text.

Save the HTML to: {working_dir}/travel-itinerary-{destination}.html

Step 8: Output

After completing all steps (including the Step 6.5 verification checklist), provide the user:

  1. A brief summary of the itinerary (2-3 sentences)
  2. Confirmation that all attraction photos and distance navigation links have been verified
  3. Links to the generated HTML guide and images using computer:// links
  4. Total estimated cost
  5. A note offering to adjust any part of the itinerary

Important Notes

  • All research must use real, current data from web searches — do not fabricate attraction names, restaurant names, or prices
  • If WebSearch returns limited results for a destination, use WebFetch on travel guide sites (e.g., TripAdvisor, Lonely Planet, local tourism boards)
  • Image stability (CRITICAL): All images MUST be pre-generated as local files using GenerateImage BEFORE assembling the HTML. NEVER use inline API URLs (https://trae-api-cn.mchost.guru/...) in <img src> — they cause unstable loading when 15+ images hit the API simultaneously. Local files are 100% reliable.
  • Image coverage (CRITICAL): EVERY attraction in the itinerary MUST have a photo. Not "major" attractions — EVERY attraction. Use the Step 6.5 checklist to verify: count attractions in timeline = count photos generated. If any attraction lacks a photo, generate it before proceeding.
  • Image workflow order: Step 4b (attraction photos) + Step 6 (cover/day banners) → Step 6.5 verification checklist → THEN Step 7 (assemble HTML). Never reverse this order.
  • Image error handling: Every <img> tag must include loading="lazy" and onerror fallback to a gradient placeholder. Add the global JS error listener as a safety net.
  • Distance navigation (CRITICAL): EVERY consecutive location transition in the daily timeline MUST have a distance line with: distance (km), travel method, time, and Baidu Maps navigation link. No transitions may be skipped. Use the Step 6.5 checklist to verify coverage. If you cannot find exact distance, estimate via Baidu Maps — but NEVER omit the line.
  • Image prompts should reflect the actual researched attractions, not generic scenes
  • Always cite web sources in the HTML guide using the $TRAE_REF citation format
  • Respect the user's budget level when recommending accommodation and dining
  • Dining budget (CRITICAL): The user's dining_budget (total per meal for the whole group) is a HARD constraint on restaurant selection. Convert to per-person: per_person = dining_budget / travelers. Every recommended restaurant's per-person price MUST be within this limit. If a destination's restaurants are generally more expensive, note this to the user and suggest the closest alternatives.
  • If the destination is remote or unusual, note accessibility and travel warnings
  • Keep the itinerary realistic — don't overpack a single day
  • For China destinations, all map links should use Baidu Maps API (not Google Maps)
  • Restaurant alternates must each be different across all meals — never repeat
  • Ticket info is mandatory for every attraction — users must know if advance booking is required