Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,822 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, {
|
||||
useContext,
|
||||
useEffect,
|
||||
useState,
|
||||
useRef,
|
||||
useCallback,
|
||||
} from 'react';
|
||||
import { Button } from '@douyinfe/semi-ui';
|
||||
import { API, showError } from '../../helpers';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { useActualTheme } from '../../context/Theme';
|
||||
import { marked } from 'marked';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Moonshot,
|
||||
OpenAI,
|
||||
Zhipu,
|
||||
Claude,
|
||||
Gemini,
|
||||
Wenxin,
|
||||
Spark,
|
||||
DeepSeek,
|
||||
Qwen,
|
||||
Midjourney,
|
||||
} from '@lobehub/icons';
|
||||
import {
|
||||
Cpu,
|
||||
Server,
|
||||
Code,
|
||||
Box,
|
||||
Users,
|
||||
BarChart3,
|
||||
Key,
|
||||
Network,
|
||||
Rocket,
|
||||
MessageSquare,
|
||||
Palette,
|
||||
Video,
|
||||
} from 'lucide-react';
|
||||
|
||||
const Home = () => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const [statusState] = useContext(StatusContext);
|
||||
// WeyAi 桌面端下载入口(页脚位置):跟随后台「开启桌面端下载页」开关
|
||||
const weyaiDownloadEnabled =
|
||||
statusState?.status?.weyai_download_enabled === true ||
|
||||
statusState?.status?.weyai_download_enabled === 'true';
|
||||
const actualTheme = useActualTheme();
|
||||
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
|
||||
const [homePageContent, setHomePageContent] = useState('');
|
||||
const [iframeError, setIframeError] = useState(false);
|
||||
const [iframeLoading, setIframeLoading] = useState(true);
|
||||
const iframeTimeoutRef = useRef(null);
|
||||
const iframeRef = useRef(null);
|
||||
const isUrl = (str) => {
|
||||
return str.startsWith('https://') || str.startsWith('http://');
|
||||
};
|
||||
|
||||
const displayHomePageContent = async () => {
|
||||
// 只对非URL内容使用localStorage缓存,URL内容总是从API获取最新的
|
||||
const cachedContent = localStorage.getItem('home_page_content') || '';
|
||||
if (cachedContent && !isUrl(cachedContent)) {
|
||||
setHomePageContent(cachedContent);
|
||||
}
|
||||
|
||||
setIframeError(false); // 重置 iframe 错误状态
|
||||
setIframeLoading(true);
|
||||
|
||||
// 清除之前的超时定时器
|
||||
if (iframeTimeoutRef.current) {
|
||||
clearTimeout(iframeTimeoutRef.current);
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await API.get('/api/home_page_content');
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
let content = data;
|
||||
if (!isUrl(data)) {
|
||||
content = marked.parse(data);
|
||||
}
|
||||
setHomePageContent(content);
|
||||
localStorage.setItem('home_page_content', content);
|
||||
|
||||
if (isUrl(data)) {
|
||||
// 设置超时检测 - 如果 5 秒内 iframe 未能正常加载,显示备用界面
|
||||
iframeTimeoutRef.current = setTimeout(() => {
|
||||
// 如果 5 秒后仍在加载状态,且没有收到加载成功的信号,认为加载失败
|
||||
setIframeLoading(false);
|
||||
// 检查 iframe 是否有内容
|
||||
if (iframeRef.current) {
|
||||
try {
|
||||
const doc =
|
||||
iframeRef.current.contentDocument ||
|
||||
iframeRef.current.contentWindow?.document;
|
||||
if (!doc || !doc.body || doc.body.innerHTML === '') {
|
||||
setIframeError(true);
|
||||
}
|
||||
} catch (err) {
|
||||
// 跨域错误说明 iframe 加载成功了,只是无法访问内容
|
||||
// 这种情况不设置错误
|
||||
}
|
||||
}
|
||||
}, 5000);
|
||||
} else {
|
||||
// 非URL内容,立即停止loading状态
|
||||
setIframeLoading(false);
|
||||
}
|
||||
} else {
|
||||
showError(message);
|
||||
setHomePageContent('加载首页内容失败...');
|
||||
setIframeLoading(false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load home page content:', error);
|
||||
showError(t('加载首页内容失败'));
|
||||
setHomePageContent('加载首页内容失败...');
|
||||
setIframeLoading(false);
|
||||
} finally {
|
||||
setHomePageContentLoaded(true);
|
||||
}
|
||||
};
|
||||
|
||||
// iframe 加载成功的回调
|
||||
const handleIframeLoad = useCallback(() => {
|
||||
// 清除超时定时器
|
||||
if (iframeTimeoutRef.current) {
|
||||
clearTimeout(iframeTimeoutRef.current);
|
||||
}
|
||||
setIframeLoading(false);
|
||||
|
||||
// 检测是否真的加载成功
|
||||
try {
|
||||
if (iframeRef.current) {
|
||||
const doc =
|
||||
iframeRef.current.contentDocument ||
|
||||
iframeRef.current.contentWindow?.document;
|
||||
// 如果文档为空或无法访问,可能是被 X-Frame-Options 阻止
|
||||
if (!doc || (doc.body && doc.body.innerHTML === '')) {
|
||||
setIframeError(true);
|
||||
} else {
|
||||
// 发送主题和语言消息
|
||||
iframeRef.current.contentWindow?.postMessage(
|
||||
{ themeMode: actualTheme },
|
||||
'*',
|
||||
);
|
||||
iframeRef.current.contentWindow?.postMessage(
|
||||
{ lang: (i18n.language || '').split('-')[0] },
|
||||
'*',
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// 跨域访问被拒绝,但这并不意味着 iframe 加载失败
|
||||
// 只是无法访问内容而已,不设置错误
|
||||
console.log('iframe loaded with cross-origin content');
|
||||
}
|
||||
}, [actualTheme, i18n.language]);
|
||||
|
||||
// 清理定时器
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (iframeTimeoutRef.current) {
|
||||
clearTimeout(iframeTimeoutRef.current);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 监听来自 iframe 的导航消息
|
||||
// iframe 内的页面可以通过 postMessage 请求父窗口进行导航
|
||||
// 消息格式: { type: 'navigate', path: '/market' } 或 { type: 'navigate', url: 'https://...' }
|
||||
useEffect(() => {
|
||||
const handleIframeMessage = (event) => {
|
||||
// 安全检查:只在 iframe 存在时处理消息
|
||||
if (!iframeRef.current) return;
|
||||
|
||||
// 安全检查:验证消息来源
|
||||
// 只接受来自 iframe src 同源的消息,或者来自本站的消息
|
||||
if (homePageContent && isUrl(homePageContent)) {
|
||||
try {
|
||||
const iframeSrcOrigin = new URL(homePageContent).origin;
|
||||
// 只接受来自 iframe 源或本站的消息
|
||||
if (
|
||||
event.origin !== iframeSrcOrigin &&
|
||||
event.origin !== window.location.origin
|
||||
) {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
// URL 解析失败,拒绝消息
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const data = event.data;
|
||||
|
||||
// 处理导航请求
|
||||
if (data && data.type === 'navigate') {
|
||||
if (data.path) {
|
||||
// 内部路径导航,使用 React Router
|
||||
// 安全检查:路径必须以 / 开头,防止 javascript: 等协议注入
|
||||
if (typeof data.path === 'string' && data.path.startsWith('/')) {
|
||||
navigate(data.path);
|
||||
}
|
||||
} else if (data.url) {
|
||||
// 外部 URL,判断是否是同源
|
||||
try {
|
||||
const url = new URL(data.url);
|
||||
if (url.origin === window.location.origin) {
|
||||
// 同源 URL,提取路径使用 React Router 导航
|
||||
navigate(url.pathname + url.search + url.hash);
|
||||
} else {
|
||||
// 跨域 URL,在新窗口打开
|
||||
window.open(data.url, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
} catch (e) {
|
||||
// URL 解析失败,忽略(不再尝试作为路径处理,防止注入)
|
||||
console.warn('Invalid navigation URL:', data.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', handleIframeMessage);
|
||||
return () => {
|
||||
window.removeEventListener('message', handleIframeMessage);
|
||||
};
|
||||
}, [navigate, homePageContent]);
|
||||
|
||||
useEffect(() => {
|
||||
displayHomePageContent().then();
|
||||
}, []);
|
||||
|
||||
// 核心能力数据 - 全方位 (8 items)
|
||||
const capabilities = [
|
||||
{
|
||||
icon: <Cpu size={28} className='text-cyan-400' />,
|
||||
title: t('多模态模型'),
|
||||
desc: t('支持文本、图像、语音等多种模态接入'),
|
||||
},
|
||||
{
|
||||
icon: <Server size={28} className='text-blue-400' />,
|
||||
title: t('高并发集群'),
|
||||
desc: t('企业级架构设计,轻松应对高并发场景'),
|
||||
},
|
||||
{
|
||||
icon: <Code size={28} className='text-brand-from' />,
|
||||
title: t('极速集成'),
|
||||
desc: t('OpenAI 格式完全兼容,零成本无缝迁移'),
|
||||
},
|
||||
{
|
||||
icon: <Box size={28} className='text-brand-from' />,
|
||||
title: t('按量计费'),
|
||||
desc: t('灵活的计费策略,极具竞争力的价格'),
|
||||
},
|
||||
{
|
||||
icon: <Users size={28} className='text-teal-400' />,
|
||||
title: t('团队协作'),
|
||||
desc: t('支持多用户管理与配额分配,高效协作'),
|
||||
},
|
||||
{
|
||||
icon: <BarChart3 size={28} className='text-emerald-400' />,
|
||||
title: t('数据看板'),
|
||||
desc: t('多维度用量分析与成本监控,一目了然'),
|
||||
},
|
||||
{
|
||||
icon: <Key size={28} className='text-rose-400' />,
|
||||
title: t('令牌管理'),
|
||||
desc: t('精细化的 API Key 权限控制与额度限制'),
|
||||
},
|
||||
{
|
||||
icon: <Network size={28} className='text-sky-400' />,
|
||||
title: t('智能路由'),
|
||||
desc: t('自动选择最优通道,保障请求高可用'),
|
||||
},
|
||||
];
|
||||
|
||||
// 模型列表
|
||||
const modelIcons = [
|
||||
{ Icon: OpenAI, name: 'OpenAI' },
|
||||
{ Icon: Claude.Color, name: 'Claude' },
|
||||
{ Icon: Gemini.Color, name: 'Gemini' },
|
||||
{ Icon: Midjourney, name: 'Midjourney' },
|
||||
{ Icon: Qwen.Color, name: 'Qwen' },
|
||||
{ Icon: DeepSeek.Color, name: 'DeepSeek' },
|
||||
{ Icon: Zhipu.Color, name: 'ChatGLM' },
|
||||
{ Icon: Moonshot, name: 'Moonshot' },
|
||||
{ Icon: Spark.Color, name: 'Spark' },
|
||||
{ Icon: Wenxin.Color, name: 'Wenxin' },
|
||||
];
|
||||
|
||||
// Enterprise Style CSS
|
||||
const enterpriseStyles = `
|
||||
.enterprise-card {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border: 1px solid rgba(226, 232, 240, 1);
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
.dark .enterprise-card {
|
||||
background: rgba(30, 41, 59, 0.6);
|
||||
border: 1px solid rgba(51, 65, 85, 1);
|
||||
}
|
||||
.enterprise-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
|
||||
border-color: rgba(59, 130, 246, 0.5); /* Blue hover */
|
||||
}
|
||||
.dark .enterprise-card:hover {
|
||||
box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
|
||||
border-color: rgba(59, 130, 246, 0.5);
|
||||
background: rgba(30, 41, 59, 0.8);
|
||||
}
|
||||
|
||||
.hero-gradient {
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #dbeafe 100%); /* Light Blue */
|
||||
}
|
||||
.dark .hero-gradient {
|
||||
background: linear-gradient(135deg, #172554 0%, #1e3a8a 100%); /* Dark Blue */
|
||||
}
|
||||
|
||||
.text-3d {
|
||||
text-shadow: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
|
||||
}
|
||||
.dark .text-3d {
|
||||
text-shadow: 0 4px 6px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
@keyframes slideInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(50px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-slide-in {
|
||||
animation: slideInUp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
|
||||
}
|
||||
|
||||
@keyframes flowRight {
|
||||
0% { left: 0; opacity: 0; }
|
||||
20% { opacity: 1; }
|
||||
80% { opacity: 1; }
|
||||
100% { left: 100%; opacity: 0; }
|
||||
}
|
||||
|
||||
.animate-flow-right {
|
||||
animation: flowRight 2s linear infinite;
|
||||
}
|
||||
|
||||
/* Hide scrollbar */
|
||||
.no-scrollbar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.no-scrollbar {
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
`;
|
||||
|
||||
const showIframe =
|
||||
homePageContentLoaded && homePageContent !== '' && isUrl(homePageContent);
|
||||
|
||||
return (
|
||||
<div
|
||||
// 手机端用 snap-proximity 而非 mandatory:单列堆叠后每屏内容普遍超过一屏高,
|
||||
// mandatory 会强制吸附到屏首、不允许停在中间,等于把超出的部分锁死。
|
||||
// 桌面端维持原来的整屏吸附观感。
|
||||
className={`w-full h-screen overflow-y-scroll snap-y snap-proximity md:snap-mandatory scroll-smooth bg-white dark:bg-slate-950 text-slate-900 dark:text-slate-100 font-sans no-scrollbar ${showIframe ? '' : 'pt-[64px]'}`}
|
||||
>
|
||||
{' '}
|
||||
<style>{enterpriseStyles}</style>
|
||||
{homePageContentLoaded && homePageContent === '' ? (
|
||||
<>
|
||||
{/* Page 1: Hero Section - Custom Background & Layout */}
|
||||
<section className="snap-start w-full min-h-full relative flex items-center overflow-hidden py-20 md:py-0 bg-[url('/assets/home-bg-2.jpg')] bg-cover bg-center">
|
||||
<div className='absolute inset-0 bg-white/60 dark:bg-slate-900/80 backdrop-blur-sm'></div>
|
||||
|
||||
<div className='container mx-auto px-6 z-10 relative min-h-full flex flex-col justify-center items-center'>
|
||||
<div className='flex flex-col items-center text-center max-w-5xl mx-auto w-full pt-10'>
|
||||
{/* Center Column: Text */}
|
||||
<div className='mb-12'>
|
||||
<h1 className='text-5xl md:text-7xl font-bold mb-8 tracking-tight leading-tight text-slate-900 dark:text-white animate-slide-in text-3d'>
|
||||
{t('打造全球领先的')}
|
||||
<span className='block mt-2 text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-brand-to dark:from-blue-400 dark:to-brand-to'>
|
||||
{t('大模型体验中心')}
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
<p
|
||||
className='text-xl text-slate-600 dark:text-slate-300 max-w-3xl mx-auto mb-10 font-medium leading-relaxed animate-slide-in'
|
||||
style={{ animationDelay: '0.2s' }}
|
||||
>
|
||||
{t(
|
||||
'集成全球顶尖 AI 算力,为开发者提供一站式、高性能、安全稳定的企业级模型服务网关。',
|
||||
)}
|
||||
</p>
|
||||
|
||||
<div
|
||||
className='flex flex-wrap justify-center gap-4 sm:gap-6 animate-slide-in'
|
||||
style={{ animationDelay: '0.4s' }}
|
||||
>
|
||||
<Link to='/console/analytics'>
|
||||
<Button
|
||||
type='tertiary'
|
||||
size='large'
|
||||
className='!bg-blue-600 hover:!bg-blue-700 !font-bold !px-12 !h-14 !rounded-full !text-lg shadow-lg shadow-blue-500/20 hover:shadow-blue-500/30 transition-all hover:-translate-y-1'
|
||||
style={{ color: '#ffffff' }}
|
||||
>
|
||||
{t('立即探索')}{' '}
|
||||
<Rocket
|
||||
size={20}
|
||||
className='ml-2'
|
||||
style={{ color: '#ffffff' }}
|
||||
/>
|
||||
</Button>
|
||||
</Link>
|
||||
<Link to='/about'>
|
||||
<Button
|
||||
type='tertiary'
|
||||
size='large'
|
||||
className='!bg-white dark:!bg-slate-800 hover:!bg-slate-50 dark:hover:!bg-slate-700 !font-bold !px-12 !h-14 !rounded-full !text-lg border !border-slate-200 dark:!border-slate-700 transition-all hover:-translate-y-1'
|
||||
style={{ color: '#334155' }}
|
||||
>
|
||||
{t('了解更多')}
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom: Animated Workflow Diagram (Centered) */}
|
||||
<div
|
||||
className='hidden lg:flex justify-center items-center animate-slide-in w-full'
|
||||
style={{ animationDelay: '0.6s' }}
|
||||
>
|
||||
<div className='relative w-full max-w-lg aspect-video rounded-2xl bg-white/40 dark:bg-slate-800/40 backdrop-blur-md border border-white/50 dark:border-slate-600/50 p-8 flex items-center justify-between shadow-2xl'>
|
||||
{/* User Node */}
|
||||
<div className='flex flex-col items-center gap-3 z-10'>
|
||||
<div className='w-14 h-14 rounded-full bg-blue-500 flex items-center justify-center shadow-lg shadow-blue-500/30 ring-4 ring-white/30 dark:ring-slate-700/30'>
|
||||
<Users className='text-white' size={26} />
|
||||
</div>
|
||||
<span className='text-sm font-bold text-slate-700 dark:text-slate-200 bg-white/50 dark:bg-black/50 px-3 py-1 rounded-full backdrop-blur-sm'>
|
||||
Client
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Flow Lines Left -> Center */}
|
||||
<div className='flex-1 h-1 bg-slate-200 dark:bg-slate-700 relative mx-4 rounded-full overflow-hidden'>
|
||||
<div className='absolute top-0 bottom-0 left-0 w-8 bg-gradient-to-r from-transparent via-blue-500 to-transparent animate-flow-right'></div>
|
||||
</div>
|
||||
|
||||
{/* Gateway Node */}
|
||||
<div className='flex flex-col items-center gap-3 z-10'>
|
||||
<div className='relative w-20 h-20 rounded-2xl bg-gradient-to-br from-brand-from to-brand-to flex items-center justify-center shadow-xl shadow-brand/40'>
|
||||
<Network className='text-white' size={36} />
|
||||
<div className='absolute -inset-1 rounded-2xl border border-white/40 animate-pulse'></div>
|
||||
</div>
|
||||
<span className='text-sm font-bold text-brand-deep dark:text-brand-from bg-white/50 dark:bg-black/50 px-3 py-1 rounded-full backdrop-blur-sm'>
|
||||
Gateway
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Flow Lines Center -> Right */}
|
||||
<div className='flex-1 h-1 bg-slate-200 dark:bg-slate-700 relative mx-4 rounded-full overflow-hidden'>
|
||||
<div
|
||||
className='absolute top-0 bottom-0 left-0 w-8 bg-gradient-to-r from-transparent via-brand-via to-transparent animate-flow-right'
|
||||
style={{ animationDelay: '0.5s' }}
|
||||
></div>
|
||||
</div>
|
||||
|
||||
{/* Models Nodes (Stacked) */}
|
||||
<div className='flex flex-col gap-4 z-10'>
|
||||
<div className='w-12 h-12 rounded-xl bg-white dark:bg-slate-800 flex items-center justify-center shadow-md border border-slate-200 dark:border-slate-700 hover:scale-110 transition-transform'>
|
||||
<OpenAI size={24} />
|
||||
</div>
|
||||
<div className='w-12 h-12 rounded-xl bg-white dark:bg-slate-800 flex items-center justify-center shadow-md border border-slate-200 dark:border-slate-700 hover:scale-110 transition-transform'>
|
||||
<Claude.Color size={24} />
|
||||
</div>
|
||||
<div className='w-12 h-12 rounded-xl bg-white dark:bg-slate-800 flex items-center justify-center shadow-md border border-slate-200 dark:border-slate-700 hover:scale-110 transition-transform'>
|
||||
<Gemini.Color size={24} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Page 2: Model Capabilities - Bento Grid Style */}
|
||||
<section className='snap-start w-full min-h-full relative flex items-center justify-center overflow-hidden py-20 md:py-0 bg-slate-50 dark:bg-slate-900'>
|
||||
<div className='container mx-auto px-6 z-10 relative min-h-full flex flex-col justify-center'>
|
||||
<div className='text-center mb-12'>
|
||||
<h2 className='text-4xl md:text-5xl font-bold mb-6 text-slate-900 dark:text-white tracking-tight'>
|
||||
{t('多维感知,全能进化')}
|
||||
</h2>
|
||||
<p className='text-xl text-slate-600 dark:text-slate-400 max-w-2xl mx-auto'>
|
||||
{t(
|
||||
'从文本到多模态,覆盖全场景 AI 需求,为您提供最全面的模型支持',
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div // 手机端单列:高度交给内容,行数不写死。原来 h-[500px] + grid-rows-2 只排得下 2 行,
|
||||
// 语音交互/联网与插件两张卡落在未定义行里、被父级 overflow-hidden 裁掉
|
||||
className='grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 md:grid-rows-2 gap-6 max-w-6xl mx-auto w-full h-auto md:h-[500px]'
|
||||
>
|
||||
{/* Large Card: LLM */}
|
||||
<div className='md:col-span-2 md:row-span-2 group enterprise-card rounded-2xl p-8 relative overflow-hidden bg-gradient-to-br from-blue-500/5 to-brand-to/10 border border-blue-200/50 dark:border-blue-900/30 backdrop-blur-sm'>
|
||||
<div className='absolute top-0 right-0 w-64 h-64 bg-blue-500/10 rounded-full blur-3xl -mr-16 -mt-16 transition-opacity group-hover:opacity-70'></div>
|
||||
<div className='relative z-10 h-full flex flex-col'>
|
||||
<div className='mb-6 w-14 h-14 rounded-xl bg-gradient-to-br from-blue-100 to-brand-to/10 dark:from-blue-900/40 dark:to-brand-to/40 flex items-center justify-center text-blue-600 dark:text-blue-400'>
|
||||
<MessageSquare size={32} />
|
||||
</div>
|
||||
<h3 className='text-2xl font-bold mb-4 text-slate-900 dark:text-white'>
|
||||
{t('通用大语言模型')}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400 text-base leading-relaxed mb-6 flex-grow'>
|
||||
{t(
|
||||
'聚合 OpenAI GPT-4、Claude 3.5、Gemini 1.5 等全球最强 LLM。具备卓越的逻辑推理、代码生成、创意写作及多轮对话能力,满足各种复杂任务需求。',
|
||||
)}
|
||||
</p>
|
||||
<div className='flex gap-2'>
|
||||
<span className='px-3 py-1 rounded-full bg-white/60 dark:bg-slate-800/60 border border-blue-100 dark:border-blue-900/30 text-xs text-blue-700 dark:text-blue-300'>
|
||||
Context Window 128k+
|
||||
</span>
|
||||
<span className='px-3 py-1 rounded-full bg-white/60 dark:bg-slate-800/60 border border-blue-100 dark:border-blue-900/30 text-xs text-blue-700 dark:text-blue-300'>
|
||||
Function Calling
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Medium Card: Vision */}
|
||||
<div className='md:col-span-2 group enterprise-card rounded-2xl p-8 relative overflow-hidden bg-gradient-to-br from-brand-from/5 to-pink-500/10 border border-brand/50 dark:border-brand-deep/30 backdrop-blur-sm'>
|
||||
<div className='absolute top-0 right-0 w-48 h-48 bg-brand/10 rounded-full blur-3xl -mr-10 -mt-10 transition-opacity group-hover:opacity-70'></div>
|
||||
<div className='relative z-10 flex items-start justify-between'>
|
||||
<div>
|
||||
<div className='mb-4 w-12 h-12 rounded-xl bg-gradient-to-br from-brand-from/10 to-pink-100 dark:from-brand-from/40 dark:to-pink-900/40 flex items-center justify-center text-brand-deep dark:text-brand-from'>
|
||||
<Palette size={28} />
|
||||
</div>
|
||||
<h3 className='text-xl font-bold mb-2 text-slate-900 dark:text-white'>
|
||||
{t('视觉理解与生成')}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400 text-sm'>
|
||||
{t(
|
||||
'支持 Midjourney、DALL-E 3 绘图,以及 GPT-4o 的视觉分析能力。',
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Small Card: Audio */}
|
||||
<div className='group enterprise-card rounded-2xl p-6 relative overflow-hidden bg-gradient-to-br from-emerald-500/5 to-teal-500/10 border border-emerald-200/50 dark:border-emerald-900/30 backdrop-blur-sm'>
|
||||
<div className='absolute bottom-0 left-0 w-32 h-32 bg-emerald-500/10 rounded-full blur-2xl -ml-8 -mb-8 transition-opacity group-hover:opacity-70'></div>
|
||||
<div className='relative z-10'>
|
||||
<div className='mb-4 w-10 h-10 rounded-lg bg-gradient-to-br from-emerald-100 to-teal-100 dark:from-emerald-900/40 dark:to-teal-900/40 flex items-center justify-center text-emerald-600 dark:text-emerald-400'>
|
||||
<Cpu size={24} />
|
||||
</div>
|
||||
<h3 className='text-lg font-bold mb-2 text-slate-900 dark:text-white'>
|
||||
{t('语音交互')}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400 text-xs leading-relaxed'>
|
||||
{t('TTS 语音合成与 Whisper 语音转写,支持情感音色。')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Small Card: Tools/Net */}
|
||||
<div className='group enterprise-card rounded-2xl p-6 relative overflow-hidden bg-gradient-to-br from-orange-500/5 to-amber-500/10 border border-orange-200/50 dark:border-orange-900/30 backdrop-blur-sm'>
|
||||
<div className='absolute bottom-0 right-0 w-32 h-32 bg-orange-500/10 rounded-full blur-2xl -mr-8 -mb-8 transition-opacity group-hover:opacity-70'></div>
|
||||
<div className='relative z-10'>
|
||||
<div className='mb-4 w-10 h-10 rounded-lg bg-gradient-to-br from-orange-100 to-amber-100 dark:from-orange-900/40 dark:to-amber-900/40 flex items-center justify-center text-orange-600 dark:text-orange-400'>
|
||||
<Network size={24} />
|
||||
</div>
|
||||
<h3 className='text-lg font-bold mb-2 text-slate-900 dark:text-white'>
|
||||
{t('联网与插件')}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400 text-xs leading-relaxed'>
|
||||
{t('实时联网搜索,获取最新资讯,打破模型知识库限制。')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Page 3: Models Section - Clean Grid */}
|
||||
<section className='snap-start w-full min-h-full relative flex items-center justify-center overflow-hidden py-20 md:py-0 bg-white dark:bg-slate-950'>
|
||||
<div className='container mx-auto px-6 z-10 relative min-h-full flex flex-col justify-center'>
|
||||
<div className='text-center mb-16'>
|
||||
<h2 className='text-4xl md:text-5xl font-bold mb-6 text-slate-900 dark:text-white tracking-tight'>
|
||||
{t('支持当前主流的大模型探索')}
|
||||
</h2>
|
||||
<div className='h-1 w-20 bg-orange-600 rounded-full mx-auto'></div>
|
||||
</div>
|
||||
|
||||
<div className='grid grid-cols-2 md:grid-cols-5 gap-6 max-w-6xl mx-auto w-full'>
|
||||
{modelIcons.map((item, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className='group enterprise-card rounded-xl p-6 flex flex-col items-center justify-center gap-4 aspect-square cursor-pointer bg-white dark:bg-slate-800 shadow-sm'
|
||||
>
|
||||
<div className='w-16 h-16 rounded-2xl bg-slate-50 dark:bg-slate-700 flex items-center justify-center group-hover:scale-105 transition-transform duration-300'>
|
||||
<item.Icon
|
||||
size={40}
|
||||
className='text-slate-700 dark:text-slate-200'
|
||||
/>
|
||||
</div>
|
||||
<span className='text-slate-700 dark:text-slate-300 font-semibold group-hover:text-orange-600 dark:group-hover:text-orange-400 transition-colors'>
|
||||
{item.name}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className='mt-16 text-center'>
|
||||
<p className='text-slate-500 dark:text-slate-400 text-sm font-medium tracking-wide'>
|
||||
{t('AND MORE... 持续接入中')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Page 3: Comprehensive Capabilities - Clean Cards */}
|
||||
<section className='snap-start w-full min-h-full relative flex items-center justify-center overflow-hidden py-20 md:py-0 bg-slate-50 dark:bg-slate-900'>
|
||||
<div className='container mx-auto px-6 z-10 relative min-h-full flex flex-col justify-center'>
|
||||
<div className='text-center mb-16'>
|
||||
<h2 className='text-4xl md:text-5xl font-bold mb-6 text-slate-900 dark:text-white'>
|
||||
{t('全方位服务能力')}
|
||||
</h2>
|
||||
<p className='text-slate-600 dark:text-slate-400 text-lg max-w-2xl mx-auto'>
|
||||
{t('不仅仅是 API 转发,更是您 AI 应用的坚实后盾')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-7xl mx-auto w-full'>
|
||||
{capabilities.map((item, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className='enterprise-card p-8 rounded-xl group bg-white dark:bg-slate-800 shadow-sm hover:shadow-xl'
|
||||
>
|
||||
<div className='mb-6 inline-flex p-4 rounded-xl bg-orange-50 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400 group-hover:bg-orange-600 group-hover:text-white transition-colors duration-300'>
|
||||
{item.icon}
|
||||
</div>
|
||||
<h3 className='text-xl font-bold mb-3 text-slate-900 dark:text-white'>
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400 text-sm leading-relaxed'>
|
||||
{item.desc}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Page 4: User Experience Entry */}
|
||||
<section className='snap-start w-full min-h-full relative flex items-center justify-center overflow-hidden py-20 md:py-0 bg-white dark:bg-slate-950'>
|
||||
<div className='container mx-auto px-6 z-10 relative min-h-full flex flex-col justify-center text-center'>
|
||||
<h2 className='text-4xl md:text-5xl font-bold mb-8 text-slate-900 dark:text-white'>
|
||||
{t('深度体验 AI 能力')}
|
||||
</h2>
|
||||
<p className='text-xl text-slate-600 dark:text-slate-400 mb-12 max-w-2xl mx-auto'>
|
||||
{t(
|
||||
'直观感受大模型的强大,从视频生成到艺术创作,即刻开启您的 AI 之旅',
|
||||
)}
|
||||
</p>
|
||||
|
||||
<div className='grid grid-cols-1 md:grid-cols-2 gap-8 max-w-4xl mx-auto w-full'>
|
||||
<Link
|
||||
to='/experience-center/video-generation'
|
||||
className='group enterprise-card p-10 rounded-2xl bg-orange-50 dark:bg-orange-900/10 border-orange-100 dark:border-orange-800 hover:border-orange-500 transition-all'
|
||||
>
|
||||
<div className='mb-6 w-16 h-16 mx-auto bg-orange-100 dark:bg-orange-800 rounded-full flex items-center justify-center group-hover:scale-110 transition-transform'>
|
||||
<Video
|
||||
size={32}
|
||||
className='text-orange-600 dark:text-orange-300'
|
||||
/>
|
||||
</div>
|
||||
<h3 className='text-2xl font-bold mb-4 text-slate-900 dark:text-white'>
|
||||
{t('AI 视频生成')}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400'>
|
||||
{t('上传图片并输入提示词,生成动态视频')}
|
||||
</p>
|
||||
</Link>
|
||||
|
||||
<Link
|
||||
to='/experience-center/image-generation'
|
||||
className='group enterprise-card p-10 rounded-2xl bg-rose-50 dark:bg-rose-900/10 border-rose-100 dark:border-rose-800 hover:border-rose-500 transition-all'
|
||||
>
|
||||
<div className='mb-6 w-16 h-16 mx-auto bg-rose-100 dark:bg-rose-800 rounded-full flex items-center justify-center group-hover:scale-110 transition-transform'>
|
||||
<Palette
|
||||
size={32}
|
||||
className='text-rose-600 dark:text-rose-300'
|
||||
/>
|
||||
</div>
|
||||
<h3 className='text-2xl font-bold mb-4 text-slate-900 dark:text-white'>
|
||||
{t('AI 艺术创作')}
|
||||
</h3>
|
||||
<p className='text-slate-600 dark:text-slate-400'>
|
||||
{t('激发无限创意,一键生成精美图像')}
|
||||
</p>
|
||||
</Link>
|
||||
</div>
|
||||
{weyaiDownloadEnabled && (
|
||||
<div className='mt-12 text-sm text-slate-500 dark:text-slate-400'>
|
||||
<Link
|
||||
to='/weyai/download'
|
||||
className='hover:text-brand-deep dark:hover:text-brand-from underline-offset-4 hover:underline'
|
||||
>
|
||||
{t('下载 WeyAi 桌面端')}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
) : (
|
||||
<div className='overflow-x-hidden w-full h-full'>
|
||||
{isUrl(homePageContent) ? (
|
||||
iframeError ? (
|
||||
// iframe 加载失败时显示备用界面
|
||||
<div className='w-full h-full flex flex-col items-center justify-center bg-gradient-to-br from-gray-50 via-white to-gray-100 dark:from-gray-950 dark:via-gray-900 dark:to-gray-950'>
|
||||
{/* 背景装饰 */}
|
||||
<div className='absolute inset-0 pointer-events-none overflow-hidden'>
|
||||
<div className='absolute -top-40 -right-40 w-96 h-96 bg-gradient-to-br from-brand-from/20 to-brand-to/20 rounded-full blur-3xl' />
|
||||
<div className='absolute -bottom-40 -left-40 w-96 h-96 bg-gradient-to-br from-pink-500/10 to-rose-500/10 rounded-full blur-3xl' />
|
||||
</div>
|
||||
|
||||
<div className='relative z-10 bg-white/80 dark:bg-gray-800/80 backdrop-blur-xl rounded-3xl border border-gray-200/50 dark:border-gray-700/50 shadow-2xl p-12 max-w-lg text-center mx-4'>
|
||||
<div className='w-20 h-20 bg-gradient-to-br from-brand-from to-brand-to rounded-2xl flex items-center justify-center mx-auto mb-6 shadow-lg shadow-brand/25'>
|
||||
<Network size={36} className='text-white' />
|
||||
</div>
|
||||
<h2 className='text-2xl font-bold text-gray-900 dark:text-white mb-3'>
|
||||
{t('访问外部首页')}
|
||||
</h2>
|
||||
<p className='text-gray-500 dark:text-gray-400 mb-6'>
|
||||
{t(
|
||||
'由于浏览器安全策略限制,无法直接嵌入显示。请点击下方按钮访问。',
|
||||
)}
|
||||
</p>
|
||||
<a
|
||||
href={homePageContent}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
className='inline-flex items-center gap-2 px-8 py-4 bg-gradient-to-r from-brand-from to-brand-to hover:from-brand-from hover:to-brand-to text-white font-semibold rounded-2xl shadow-lg shadow-brand/25 hover:shadow-xl hover:-translate-y-0.5 transition-all duration-200'
|
||||
>
|
||||
<Rocket size={20} />
|
||||
{t('立即访问')}
|
||||
</a>
|
||||
<p className='mt-4 text-xs text-gray-400 dark:text-gray-500'>
|
||||
{homePageContent}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{iframeLoading && (
|
||||
<div className='absolute inset-0 flex items-center justify-center bg-white dark:bg-gray-900 z-10'>
|
||||
<div className='flex flex-col items-center gap-4'>
|
||||
<div className='w-12 h-12 border-4 border-brand/30 border-t-brand rounded-full animate-spin' />
|
||||
<p className='text-gray-500 dark:text-gray-400'>
|
||||
{t('正在加载...')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<iframe
|
||||
ref={iframeRef}
|
||||
src={homePageContent}
|
||||
className='w-full h-full border-none'
|
||||
title='Custom Home'
|
||||
onError={() => {
|
||||
if (iframeTimeoutRef.current) {
|
||||
clearTimeout(iframeTimeoutRef.current);
|
||||
}
|
||||
setIframeLoading(false);
|
||||
setIframeError(true);
|
||||
}}
|
||||
onLoad={handleIframeLoad}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<div
|
||||
className='mt-[60px] container mx-auto px-4'
|
||||
dangerouslySetInnerHTML={{ __html: homePageContent }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
Reference in New Issue
Block a user