"use client"; import { useState } from "react"; import Link from "next/link"; import { api } from "@/lib/api"; import { useI18n } from "@/lib/i18n"; import { useToast } from "@/lib/toast"; import RingNext from "@/components/RingNext"; import { useRingSteps } from "@/lib/rings"; const SUGGESTIONS = [ "预算 6000,想找网速好的东南亚城市", "适合第一次远程办公的城市?", "清迈和巴厘岛怎么选?", ]; export default function AiAssistantClient() { const { t } = useI18n(); const { toast } = useToast(); const rings = useRingSteps(); const [message, setMessage] = useState(""); const [reply, setReply] = useState(""); const [cities, setCities] = useState<{ slug: string; name: string; emoji: string }[]>([]); const [loading, setLoading] = useState(false); const ask = async (text?: string) => { const q = (text ?? message).trim(); if (!q) { toast("先写一个问题", "info"); return; } setMessage(q); setLoading(true); try { const res = await api.askAssistant(q); setReply(res.reply); setCities(res.cities || []); } catch { setReply(t.ai.fail); setCities([]); } finally { setLoading(false); } }; return (
{t.ai.tag}

{t.ai.title}

{t.ai.subtitle}

{SUGGESTIONS.map((s) => ( ))}