'use client'; import { useEffect, useState } from 'react'; import { Card } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Skeleton } from '@/components/ui/skeleton'; import { Heart } from 'lucide-react'; import { API_BASE } from '@/lib/config'; import { useT } from '@/i18n'; interface Prompt { id: number; title: string; description: string; content: string; model: string | null; likeCount: number; tags: string | null } function PromptSkeleton() { return ( ); } export default function PromptsPage() { const t = useT(); const [prompts, setPrompts] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetch(`${API_BASE}/prompts`).then(r => r.json()).then(data => setPrompts(data.items || [])).catch(() => {}).finally(() => setLoading(false)); }, []); return ( {t.nav.prompts} 精选提示词模板,开箱即用 {loading ? ( {[1,2,3,4].map(i => )} ) : ( {prompts.map((prompt) => ( {prompt.tags?.split(',').slice(0, 2).map(tag => {tag.trim()})} {prompt.model && {prompt.model}} {prompt.title} {prompt.description || prompt.content} {prompt.likeCount} ))} )} ); }
精选提示词模板,开箱即用
{prompt.description || prompt.content}