2025-11-23 10:55:04 +08:00
|
|
|
"use client";
|
|
|
|
|
|
2026-01-10 23:08:56 +08:00
|
|
|
import { MessageCircle, Sparkles } from "lucide-react";
|
2025-11-23 10:55:04 +08:00
|
|
|
import { useBackendHealth } from "@/hooks/use-backend-health";
|
|
|
|
|
import { cn } from "@/lib/utils";
|
2026-01-10 23:08:56 +08:00
|
|
|
import { useAiAgentUiStore } from "@/store/ai-agent-ui";
|
2025-11-23 10:55:04 +08:00
|
|
|
|
|
|
|
|
export function BottomToolbar() {
|
|
|
|
|
const status = useBackendHealth();
|
2026-01-10 23:08:56 +08:00
|
|
|
const documentAgentAvailable = useAiAgentUiStore((s) => s.documentAgentAvailable);
|
|
|
|
|
const toggleDocumentAgentOpen = useAiAgentUiStore((s) => s.toggleDocumentAgentOpen);
|
2025-11-23 10:55:04 +08:00
|
|
|
const indicatorColor =
|
2026-01-10 23:08:56 +08:00
|
|
|
status === "ok"
|
|
|
|
|
? "bg-green-500"
|
|
|
|
|
: status === "error"
|
|
|
|
|
? "bg-red-500"
|
|
|
|
|
: "bg-gray-300";
|
2025-11-23 10:55:04 +08:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<footer className="flex h-12 items-center justify-between border-t border-[#eeeeee] px-6 text-sm">
|
|
|
|
|
<div className="flex items-center gap-2 text-xs text-gray-500">
|
|
|
|
|
<span className={cn("h-2 w-2 rounded-full", indicatorColor)} />
|
2026-01-10 23:08:56 +08:00
|
|
|
后端连接:
|
|
|
|
|
{status === "ok"
|
|
|
|
|
? "正常"
|
|
|
|
|
: status === "disabled"
|
|
|
|
|
? "未配置"
|
|
|
|
|
: status === "error"
|
|
|
|
|
? "异常"
|
|
|
|
|
: "检测中"}
|
2025-11-23 10:55:04 +08:00
|
|
|
</div>
|
2026-01-10 23:08:56 +08:00
|
|
|
{/* 右侧预留空间,避免被 TanStack Devtools 悬浮按钮遮挡 */}
|
|
|
|
|
<div className="flex items-center gap-3 pr-16 text-gray-600">
|
2025-11-23 10:55:04 +08:00
|
|
|
<button type="button" className="wolai-hover rounded-full px-3 py-1">
|
|
|
|
|
<MessageCircle className="mr-1 inline h-4 w-4" />
|
|
|
|
|
发送
|
|
|
|
|
</button>
|
2026-01-10 23:08:56 +08:00
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className={cn(
|
|
|
|
|
"wolai-hover rounded-full px-3 py-1",
|
|
|
|
|
!documentAgentAvailable && "cursor-not-allowed opacity-50",
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => toggleDocumentAgentOpen()}
|
|
|
|
|
disabled={!documentAgentAvailable}
|
|
|
|
|
title={documentAgentAvailable ? "打开页面 AI" : "仅在页面编辑区可用"}
|
|
|
|
|
>
|
|
|
|
|
<Sparkles className="mr-1 inline h-4 w-4" />
|
|
|
|
|
AI
|
2025-11-23 10:55:04 +08:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2026-01-10 23:08:56 +08:00
|
|
|
className={cn(
|
|
|
|
|
"flex h-8 w-8 items-center justify-center rounded-full bg-[#2563eb] text-white shadow-sm",
|
|
|
|
|
!documentAgentAvailable && "cursor-not-allowed opacity-50",
|
|
|
|
|
)}
|
|
|
|
|
onClick={() => toggleDocumentAgentOpen()}
|
|
|
|
|
disabled={!documentAgentAvailable}
|
|
|
|
|
aria-label="打开页面 AI"
|
|
|
|
|
title={documentAgentAvailable ? "打开页面 AI" : "仅在页面编辑区可用"}
|
2025-11-23 10:55:04 +08:00
|
|
|
>
|
|
|
|
|
<Sparkles className="h-4 w-4" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</footer>
|
|
|
|
|
);
|
|
|
|
|
}
|