feat: DevTools 数据库监看面板 + 隧道控制 + 多项 Bug 修复

**DevTools 新增功能 (Tasks 13-14):**
- 首页仪表盘添加数据库实时监看卡片 (5端口状态 + 记忆数)
- 侧边栏新增数据库面板,支持自动 5 秒刷新
- 数据库面板显示 PostgreSQL/Redis/Qdrant/MinIO/NATS 端口状态
- 隧道控制按钮 (启动/停止/重启/查看状态)
- 新增 API 端点: GET /api/database/status, POST /api/tunnel/:action
- 更新 docs/api-reference/ API 文档

**Bug 修复 (Task 15):**
- 修复 pgrep -f 自匹配导致隧道状态误判 (添加 ^ssh 锚点)
  - devtools/src/index.js (dashboard + database/status)
  - scripts/tunnel.sh (is_tunnel_running + show_status)
- 修复数据库面板缺少自动刷新定时器
- 修复侧边栏数据库徽章永远 display:none
- 修复僵尸进程场景下按钮死锁问题

**其他改进:**
- .gitignore 添加 backend/cmd, backend/iot-debug-service/main
- 前端多项改进 (登录/注册/会话/流式动画等)
This commit is contained in:
2026-05-17 11:42:42 +08:00
parent 0757ad26b5
commit 5d0bb96abe
28 changed files with 1723 additions and 218 deletions
@@ -1,8 +1,53 @@
import { useChat } from '@/hooks/useChat';
import { useChatStore } from '@/store/chatStore';
import { MessageList } from './MessageList';
import { IoTStatusBar } from './IoTStatusBar';
export function ChatContainer() {
const { messages, isTyping } = useChat();
const continuousMode = useChatStore((s) => s.continuousMode);
const backgroundThinkingStatus = useChatStore((s) => s.backgroundThinkingStatus);
return <MessageList messages={messages} isTyping={isTyping} />;
const thinkingLabel = backgroundThinkingStatus === 'thinking' ? '昔涟正在回忆中...' : '';
const statusLabel = continuousMode ? '主对话 · 进行中' : '';
return (
<div className="flex flex-col h-full">
{/* 状态指示器栏 */}
<div className="flex items-center justify-between px-4 py-1.5 border-b border-pink-100 dark:border-pink-900 bg-pink-50/50 dark:bg-pink-950/20">
<div className="flex items-center gap-2">
{statusLabel && (
<span className="text-xs font-medium text-pink-500 dark:text-pink-400 bg-pink-100 dark:bg-pink-900/50 px-2 py-0.5 rounded-full">
{statusLabel}
</span>
)}
{thinkingLabel && (
<span className="text-xs text-pink-400 dark:text-pink-500 animate-pulse flex items-center gap-1">
<span className="inline-block w-1.5 h-1.5 bg-pink-400 rounded-full animate-bounce" />
<span className="inline-block w-1.5 h-1.5 bg-pink-400 rounded-full animate-bounce" style={{ animationDelay: '0.15s' }} />
<span className="inline-block w-1.5 h-1.5 bg-pink-400 rounded-full animate-bounce" style={{ animationDelay: '0.3s' }} />
{thinkingLabel}
</span>
)}
</div>
{continuousMode && (
<button
onClick={() => useChatStore.getState().setContinuousMode(!continuousMode)}
className="text-[10px] text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"
title="切换连续对话模式"
>
{continuousMode ? '🔗 连续对话' : '⏸️ 暂停中'}
</button>
)}
</div>
{/* 消息列表 */}
<div className="flex-1 overflow-hidden">
<MessageList messages={messages} isTyping={isTyping} />
</div>
{/* IoT 状态栏(底部) */}
<IoTStatusBar />
</div>
);
}