feat(web): 移除 Settings 按钮,在 Header 直接显示工作目录

- 移除 ConfigPanel 及其入口按钮
- 在 Chat 页面 Header 左侧显示当前工作目录
- 初始化时并行获取会话列表和工作目录
This commit is contained in:
2025-12-15 23:17:27 +08:00
parent f3995d158c
commit 92619df026
2 changed files with 34 additions and 27 deletions
+18 -19
View File
@@ -3,7 +3,7 @@
*/
import { useEffect, useRef } from 'react';
import { WifiOff, MessageSquare, Settings, FolderOpen, Terminal, Plug, Zap, Bot, History, Server } from 'lucide-react';
import { WifiOff, MessageSquare, FolderOpen, Terminal, Plug, Zap, Bot, History, Server, Folder } from 'lucide-react';
import { motion, AnimatePresence } from 'framer-motion';
import { toast } from 'sonner';
import {
@@ -23,13 +23,14 @@ interface ChatPageProps {
// 工具栏按钮
showFileBrowser?: boolean;
onToggleFileBrowser?: () => void;
onOpenConfig?: () => void;
onOpenCommands?: () => void;
onOpenMCP?: () => void;
onOpenHooks?: () => void;
onOpenAgents?: () => void;
onOpenCheckpoints?: () => void;
onOpenProviders?: () => void;
// Working Directory
workingDirectory?: string;
}
export function ChatPage({
@@ -39,13 +40,13 @@ export function ChatPage({
responsive = false,
showFileBrowser,
onToggleFileBrowser,
onOpenConfig,
onOpenCommands,
onOpenMCP,
onOpenHooks,
onOpenAgents,
onOpenCheckpoints,
onOpenProviders,
workingDirectory,
}: ChatPageProps) {
const {
messages,
@@ -152,8 +153,19 @@ export function ChatPage({
<div className="flex-1 flex flex-col h-screen">
{/* Header */}
<div className="flex items-center justify-between px-4 md:px-6 py-3 border-b border-line bg-surface-subtle">
<h1 className="text-lg font-medium text-fg">Chat</h1>
<div className="flex items-center gap-3">
<div className="flex items-center gap-3 min-w-0">
<h1 className="text-lg font-medium text-fg flex-shrink-0">Chat</h1>
{/* Working Directory */}
{workingDirectory && (
<div className="flex items-center gap-1.5 text-sm text-fg-muted min-w-0">
<Folder size={14} className="flex-shrink-0 text-fg-subtle" />
<span className="truncate font-mono text-xs" title={workingDirectory}>
{workingDirectory}
</span>
</div>
)}
</div>
<div className="flex items-center gap-3 flex-shrink-0">
{/* 上下文使用情况 - 紧凑模式 */}
{sessionId && (
<ContextUsage
@@ -168,7 +180,7 @@ export function ChatPage({
<ConnectionStatus />
{/* 工具栏按钮 */}
{(onOpenConfig || onToggleFileBrowser || onOpenCommands || onOpenMCP || onOpenHooks || onOpenAgents || onOpenCheckpoints || onOpenProviders) && (
{(onToggleFileBrowser || onOpenCommands || onOpenMCP || onOpenHooks || onOpenAgents || onOpenCheckpoints || onOpenProviders) && (
<div className="flex items-center gap-1.5 border-l border-line-muted pl-3">
{/* Checkpoints 按钮 */}
{onOpenCheckpoints && (
@@ -248,19 +260,6 @@ export function ChatPage({
</motion.button>
)}
{/* 配置按钮 */}
{onOpenConfig && (
<motion.button
whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.9 }}
onClick={onOpenConfig}
className="p-1.5 rounded-lg text-fg-muted hover:text-fg-secondary hover:bg-surface-muted transition-colors"
title="Settings"
>
<Settings size={20} />
</motion.button>
)}
{/* 文件浏览器按钮 - 仅桌面端显示 */}
{onToggleFileBrowser && (
<motion.button