¶Ô±ÈÐÂÎļþ |
| | |
| | | "use client"; |
| | | |
| | | import { useState, useEffect } from 'react'; |
| | | import { motion, AnimatePresence } from 'framer-motion'; |
| | | |
| | | // 导å
¥åºæ¯æ°æ® |
| | | const services = [ |
| | | { |
| | | title: 'è¡¥æ', |
| | | description: 'æºè½å¨æåæäº§çº¿ï¼å·¥ä½ç缺ææ
åµï¼éä½å线é£é©', |
| | | imageUrl: '/images/kanban.jpg', |
| | | chatbotId: 'JELkWpPLHQfRNhEH', |
| | | }, |
| | | { |
| | | title: 'æå', |
| | | description: 'æºè½è¯ä¼°éæ±æå对产è½ï¼åææåäº¤ä»æå¡çå½±åï¼æåå®¢æ·æ»¡æåº¦', |
| | | imageUrl: '/images/xuqiu.jpg', |
| | | chatbotId: 'DfH4cIzujVGvn5iR', |
| | | }, |
| | | { |
| | | title: 'ç§æ²æ¯é宿¨èå°å©æ', |
| | | description: 'æºè½åäº§åæ¨èæåå¯¼è´æç', |
| | | imageUrl: '/images/robot.jpg', |
| | | chatbotId: 'sUAviPXvcEIw3oQC', |
| | | }, |
| | | { |
| | | title: 'åºå管çç¥è¯åºé®ç', |
| | | description: 'åºåç¥è¯ï¼æä¾ä¸ä¸çä¾åºé¾åºåç¥è¯é®ç', |
| | | imageUrl: '/images/know.jpg', |
| | | chatbotId: 'pDDfkU9HyBl2gzXx', |
| | | }, |
| | | ]; |
| | | |
| | | export default function AISceneChatPage() { |
| | | const [selectedScene, setSelectedScene] = useState(services[0]); |
| | | const [iframeKey, setIframeKey] = useState(0); // ç¨äºå¼ºå¶å·æ°iframe |
| | | |
| | | // åæ¢åºæ¯æ¶éæ°å è½½iframe |
| | | const handleSceneChange = (scene: typeof services[0]) => { |
| | | setSelectedScene(scene); |
| | | setIframeKey(prev => prev + 1); |
| | | }; |
| | | |
| | | return ( |
| | | <div className="h-screen flex bg-[#0A1033]"> |
| | | {/* å·¦ä¾§åºæ¯éé¡¹å¡ */} |
| | | <div className="w-64 bg-[#131C41] border-r border-[#6ADBFF]/20 flex flex-col"> |
| | | <div className="p-4 flex-1 overflow-y-auto"> |
| | | <h2 className="text-xl font-bold text-white mb-6 flex items-center"> |
| | | <span className="text-transparent bg-clip-text bg-gradient-to-r from-[#6ADBFF] to-[#5E72EB]"> |
| | | AIåºæ¯ |
| | | </span> |
| | | <motion.span |
| | | className="ml-2 inline-block w-2 h-2 rounded-full bg-[#6ADBFF]" |
| | | animate={{ |
| | | scale: [1, 1.5, 1], |
| | | opacity: [0.7, 1, 0.7] |
| | | }} |
| | | transition={{ |
| | | duration: 2, |
| | | repeat: Infinity, |
| | | ease: "easeInOut" |
| | | }} |
| | | /> |
| | | </h2> |
| | | <div className="space-y-3"> |
| | | {services.map((scene) => ( |
| | | <motion.button |
| | | key={scene.chatbotId} |
| | | onClick={() => handleSceneChange(scene)} |
| | | className={`w-full p-4 rounded-lg text-left transition-all duration-500 relative overflow-hidden |
| | | ${selectedScene.chatbotId === scene.chatbotId |
| | | ? 'text-[#6ADBFF]' |
| | | : 'text-gray-300 hover:text-[#6ADBFF]' |
| | | }`} |
| | | whileHover={{ scale: 1.02 }} |
| | | whileTap={{ scale: 0.98 }} |
| | | > |
| | | {selectedScene.chatbotId === scene.chatbotId && ( |
| | | <motion.div |
| | | className="absolute inset-0 bg-gradient-to-r from-[#1A2547] to-[#1E2B63] -z-10" |
| | | layoutId="activeBackground" |
| | | initial={false} |
| | | transition={{ |
| | | type: "spring", |
| | | stiffness: 200, |
| | | damping: 20 |
| | | }} |
| | | /> |
| | | )} |
| | | <div className="flex items-center relative z-10"> |
| | | <div className="w-10 h-10 rounded-lg overflow-hidden mr-3 relative"> |
| | | <img |
| | | src={scene.imageUrl} |
| | | alt={scene.title} |
| | | className="w-full h-full object-cover transform transition-transform duration-700 group-hover:scale-110" |
| | | /> |
| | | <div className="absolute inset-0 bg-gradient-to-br from-black/20 to-transparent"></div> |
| | | </div> |
| | | <div> |
| | | <span className="font-medium block">{scene.title}</span> |
| | | <span className="text-xs text-gray-400 line-clamp-1">{scene.description}</span> |
| | | </div> |
| | | </div> |
| | | {selectedScene.chatbotId === scene.chatbotId && ( |
| | | <motion.div |
| | | className="absolute right-3 top-1/2 -translate-y-1/2 w-1.5 h-6 bg-[#6ADBFF] rounded-full" |
| | | layoutId="activeIndicator" |
| | | initial={{ opacity: 0 }} |
| | | animate={{ opacity: 1 }} |
| | | exit={{ opacity: 0 }} |
| | | /> |
| | | )} |
| | | </motion.button> |
| | | ))} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | {/* ä¸é´è天åºå */} |
| | | <div className="flex-1 flex flex-col bg-gradient-to-br from-[#0A1033] to-[#131C41]"> |
| | | {/* 顶鍿 颿 */} |
| | | <div className="h-16 border-b border-[#6ADBFF]/20 flex items-center px-6 bg-[#131C41]/50 backdrop-blur-sm"> |
| | | <AnimatePresence mode="wait"> |
| | | <motion.div |
| | | key={selectedScene.chatbotId} |
| | | initial={{ opacity: 0, y: -20 }} |
| | | animate={{ opacity: 1, y: 0 }} |
| | | exit={{ opacity: 0, y: 20 }} |
| | | transition={{ duration: 0.3 }} |
| | | className="flex items-center" |
| | | > |
| | | <div className="w-8 h-8 rounded-lg overflow-hidden mr-3 relative"> |
| | | <img |
| | | src={selectedScene.imageUrl} |
| | | alt={selectedScene.title} |
| | | className="w-full h-full object-cover" |
| | | /> |
| | | <div className="absolute inset-0 bg-gradient-to-br from-black/20 to-transparent"></div> |
| | | </div> |
| | | <div> |
| | | <h1 className="text-xl font-bold text-white"> |
| | | {selectedScene.title} |
| | | </h1> |
| | | <p className="text-sm text-gray-400"> |
| | | {selectedScene.description} |
| | | </p> |
| | | </div> |
| | | </motion.div> |
| | | </AnimatePresence> |
| | | </div> |
| | | |
| | | {/* è天çªå£ */} |
| | | <div className="flex-1 relative"> |
| | | <AnimatePresence mode="wait"> |
| | | <motion.div |
| | | key={iframeKey} |
| | | className="absolute inset-0" |
| | | initial={{ opacity: 0, scale: 0.98 }} |
| | | animate={{ opacity: 1, scale: 1 }} |
| | | exit={{ opacity: 0, scale: 1.02 }} |
| | | transition={{ duration: 0.3 }} |
| | | > |
| | | <iframe |
| | | src={`http://121.43.139.99/chatbot/${selectedScene.chatbotId}`} |
| | | className="w-full h-full" |
| | | style={{ border: 'none' }} |
| | | allow="microphone" |
| | | /> |
| | | </motion.div> |
| | | </AnimatePresence> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | ); |
| | | } |