| | |
| | | import { Fragment, useEffect, useState } from 'react'; |
| | | import { motion, AnimatePresence } from 'framer-motion'; |
| | | import DataPreviewDialog from './DataPreviewDialog'; |
| | | import { useRouter } from 'next/navigation'; |
| | | |
| | | interface SceneIntroDialogProps { |
| | | isOpen: boolean; |
| | | onClose: () => void; |
| | | onStartChat: () => void; |
| | | scene: { |
| | | title: string; |
| | | description: string; |
| | |
| | | instructions?: string; |
| | | dataDescription?: string; |
| | | exampleData?: string; |
| | | chatbotId: string; |
| | | }; |
| | | } |
| | | |
| | | export default function SceneIntroDialog({ |
| | | isOpen, |
| | | onClose, |
| | | onStartChat, |
| | | scene |
| | | }: SceneIntroDialogProps) { |
| | | const [showDataPreview, setShowDataPreview] = useState(false); |
| | | const router = useRouter(); |
| | | |
| | | // 确保动画状态在每次打开时都被重置 |
| | | useEffect(() => { |
| | |
| | | }); |
| | | } |
| | | }, [isOpen]); |
| | | |
| | | const handleStartChat = () => { |
| | | onClose(); |
| | | router.push('/ai-scene/chat'); |
| | | }; |
| | | |
| | | return ( |
| | | <AnimatePresence> |
| | |
| | | transition={{ duration: 0.5, delay: 0.3 }} |
| | | > |
| | | <button |
| | | onClick={onStartChat} |
| | | onClick={handleStartChat} |
| | | className="group relative w-64 cursor-pointer" |
| | | > |
| | | <div className="absolute -inset-0.5 rounded-lg bg-gradient-to-r from-[#6ADBFF] to-[#5E72EB] opacity-60 blur group-hover:opacity-100 transition-all duration-300"></div> |