From 91ee71ab6443c774f8f721e826d9fc0811939fb7 Mon Sep 17 00:00:00 2001
From: hongjli <3117313295@qq.com>
Date: 星期三, 16 四月 2025 18:03:56 +0800
Subject: [PATCH] 优化

---
 src/app/ai-scene/chat/page.tsx |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/src/app/ai-scene/chat/page.tsx b/src/app/ai-scene/chat/page.tsx
index faaec54..af3f1fe 100644
--- a/src/app/ai-scene/chat/page.tsx
+++ b/src/app/ai-scene/chat/page.tsx
@@ -4,6 +4,7 @@
 import { motion, AnimatePresence } from 'framer-motion';
 import { useSearchParams } from 'next/navigation';
 import { useRouter } from 'next/navigation';
+import Image from 'next/image';
 import DataPreviewDialog from '@/components/DataPreviewDialog';
 
 // 瀵煎叆鍦烘櫙鏁版嵁
@@ -220,6 +221,13 @@
   const [services] = useState([defaultServices.find(s => s.chatbotId === sceneId) || defaultServices[0]]);
   const [selectedScene, setSelectedScene] = useState(initialScene);
   const [iframeKey, setIframeKey] = useState(0);
+  const [token, setToken] = useState<string | null>(null);
+
+  useEffect(() => {
+    // Get token from localStorage
+    const storedToken = localStorage.getItem('token');
+    setToken(storedToken);
+  }, []);
 
   // 鍒囨崲鍦烘櫙鏃堕噸鏂板姞杞絠frame
   const handleSceneChange = (scene: typeof services[0]) => {
@@ -423,24 +431,14 @@
         </div>
 
         {/* 鑱婂ぉ绐楀彛 */}
-        <div className="flex-1 relative [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-[#E5E6EB] [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-[#C9CDD4]">
-          <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 className="flex-1 relative">
+          <iframe
+            key={iframeKey}
+            className="w-full h-full rounded-lg"
+            src={`http://121.43.139.99:7000/chatbot/${selectedScene.chatbotId}${token ? `?token=${token}` : ''}`}
+            frameBorder="0"
+            allow="microphone"
+          ></iframe>
         </div>
       </div>
     </div>

--
Gitblit v1.9.3