Update AI planner integration, docs, and config
AI Code Review / review (pull_request) Successful in 11m45s

This commit is contained in:
周瑞哲
2026-07-30 16:33:39 +08:00
parent 33c14eec86
commit ac4179086c
13 changed files with 192 additions and 29 deletions
+8 -1
View File
@@ -110,6 +110,13 @@ const routeTags = computed(() => {
})
const planningModeLabel = computed(() => plan.value?.itinerary.planningMode === 'custom' ? '自选规划' : '快速规划')
const planningSourceLabel = computed(() => {
if (plan.value?.source === 'remote_ai')
return '真实 AI 推荐'
if (plan.value?.source === 'remote_mock')
return '远端演示规划'
return '本地智能规划'
})
const durationFitNotice = computed(() => plan.value ? getDurationFitNotice(plan.value.itinerary.durationFitStatus) : null)
function loadStoredPlan() {
@@ -294,7 +301,7 @@ onReady(initializeMap)
<view class="route-hero__top">
<view class="route-hero__label">
<text class="route-hero__spark"></text>
{{ planningModeLabel }}
{{ planningModeLabel }} · {{ planningSourceLabel }}
</view>
<button @click="openPlanner">重新规划</button>
</view>
+16 -11
View File
@@ -2,7 +2,7 @@
import type { PoiSummary } from '@/domain/poi'
import type { BudgetLevel, Interest, Pace, PlanningRequest, Theme, Transport, TravelPreferences } from '@/domain/travel'
import { getPoiRepository } from '@/data/poi'
import { createPlan, isRemoteTravelAssistantEnabled, loadPreferences, savePlan, savePreferences } from '@/services/travel-assistant'
import { createPlan, isRemoteTravelAssistantEnabled, loadPlanningRequest, loadPreferences, savePlan, savePreferences } from '@/services/travel-assistant'
import { useLocationStore } from '@/stores'
interface PlannerPreset {
@@ -74,8 +74,8 @@ const durationText = computed(() => {
})
const usesCurrentLocation = computed(() => locationAvailable.value
&& (planningMode.value === 'quick' || customStartsFromCurrentLocation.value))
const planningEngineLabel = computed(() => remoteEnabled.value && planningMode.value === 'quick'
? '在线 AI 服务'
const planningEngineLabel = computed(() => remoteEnabled.value
? '在线智能服务'
: '本地智能规划')
const locationActionText = computed(() => {
if (locationStore.status === 'locating')
@@ -151,9 +151,6 @@ function toggleInterest(interest: Interest) {
function setPlanningMode(mode: PlanningRequest['mode']) {
planningMode.value = mode
if (mode === 'custom' && remoteEnabled.value) {
uni.showToast({ title: '自选点位将使用本地智能规划', icon: 'none' })
}
}
function togglePoi(poiId: string) {
@@ -333,10 +330,18 @@ async function submit() {
}
onShow(() => {
const stored = loadPreferences()
if (stored) {
assignPreferences(stored)
durationMinutes.value = stored.duration === 'half_day' ? 4 * 60 : 8 * 60
const storedRequest = loadPlanningRequest()
const storedPreferences = storedRequest?.preferences ?? loadPreferences()
if (storedPreferences)
assignPreferences(storedPreferences)
if (storedRequest) {
planningMode.value = storedRequest.mode
durationMinutes.value = storedRequest.durationMinutes
selectedPoiIds.value = [...storedRequest.selectedPoiIds]
customStartsFromCurrentLocation.value = false
}
else if (storedPreferences) {
durationMinutes.value = storedPreferences.duration === 'half_day' ? 4 * 60 : 8 * 60
}
applyPreset()
})
@@ -390,7 +395,7 @@ onShow(() => {
</button>
</view>
<text v-if="remoteEnabled && planningMode === 'custom'" class="planning-mode-tip">
自选点位不依赖在线服务将使用本地智能规划
在线 AI 将在你选择的点位内建议顺序本机负责定位交通与时长核算
</text>
</view>