refactor(home): 简化首页对话功能实现

- 移除接口连通性检查逻辑
- 直接使用 window.open 打开百度链接
- 简化按钮点击事件处理
- 更新按钮显示文案为"内容生成"
- 移除数据智能编排功能入口
```
This commit is contained in:
2026-01-20 09:39:33 +08:00
parent ea6765ea0f
commit dd314025bd

View File

@@ -18,50 +18,12 @@ export default function WelcomePage() {
const navigate = useNavigate();
const [isChecking, setIsChecking] = useState(false);
// 检查接口连通性的函数
const checkDeerFlowDeploy = async (): Promise<boolean> => {
try {
const response = await fetch('/deer-flow-backend/config', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
timeout: 5000, // 5秒超时
cache: 'no-store'
});
// 检查 HTTP 状态码在 200-299 范围内
if (response.ok) {
return true;
}
} catch (error) {
console.error('接口检查失败:', error);
}
return false;
};
const handleChatClick = async () => {
if (isChecking) return; // 防止重复点击
setIsChecking(true);
try {
const isDeerFlowDeploy = await checkDeerFlowDeploy();
if (isDeerFlowDeploy) {
// 接口正常,执行原有逻辑
window.location.href = "/chat";
} else {
// 接口异常,使用 navigate 跳转
navigate("/chat");
}
} catch (error) {
// 发生错误时也使用 navigate 跳转
console.error('检查过程中发生错误:', error);
navigate("/chat");
} finally {
setIsChecking(false);
}
window.open('https://baidu.com')
};
return (
@@ -93,14 +55,7 @@ export default function WelcomePage() {
className="cursor-pointer rounded px-4 py-2 inline-flex items-center bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white shadow-lg disabled:opacity-50 disabled:cursor-not-allowed"
>
<MessageSquare className="mr-2 w-4 h-4" />
{isChecking ? '检查中...' : '对话助手'}
</span>
<span
onClick={() => navigate("/orchestration")}
className="cursor-pointer rounded px-4 py-2 inline-flex items-center bg-gradient-to-r from-orange-600 to-amber-600 hover:from-orange-700 hover:to-amber-700 text-white shadow-lg"
>
<ArrowRight className="ml-2 w-4 h-4" />
</span>
</div>
</div>