| | |
| | | 'use client'; |
| | | |
| | | import { useState, useEffect, useRef, useCallback, useContext, createContext } from 'react'; |
| | | import { useState, useEffect, useRef, useCallback, useContext, createContext, Suspense } from 'react'; |
| | | import Link from 'next/link'; |
| | | import { useRouter, useSearchParams } from 'next/navigation'; |
| | | import Image from 'next/image'; |
| | |
| | | ); |
| | | } |
| | | |
| | | export default function SupplyChainChatPage() { |
| | | // 创建一个独立的组件来处理useSearchParams |
| | | function SupplyChainChatContent() { |
| | | const router = useRouter(); |
| | | const searchParams = useSearchParams(); |
| | | const [apiKey, setApiKey] = useState<string>(''); |
| | |
| | | /> |
| | | </div> |
| | | ); |
| | | } |
| | | |
| | | // 主导出组件,使用Suspense包装原有组件 |
| | | export default function SupplyChainChatPage() { |
| | | return ( |
| | | <Suspense fallback={ |
| | | <div className="min-h-screen bg-gradient-to-b from-gray-50 to-white flex items-center justify-center"> |
| | | <div className="text-center"> |
| | | <div className="w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div> |
| | | <p className="text-gray-600">正在加载...</p> |
| | | </div> |
| | | </div> |
| | | }> |
| | | <SupplyChainChatContent /> |
| | | </Suspense> |
| | | ); |
| | | } |