Update AI planner integration, docs, and config

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
+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>