diff --git a/packages/vscode-ide-companion/src/agents/qwenAgentManager.ts b/packages/vscode-ide-companion/src/agents/qwenAgentManager.ts index 8b767c8f..9c6b9cf1 100644 --- a/packages/vscode-ide-companion/src/agents/qwenAgentManager.ts +++ b/packages/vscode-ide-companion/src/agents/qwenAgentManager.ts @@ -23,7 +23,6 @@ import type { import { QwenConnectionHandler } from './qwenConnectionHandler.js'; import { QwenSessionUpdateHandler } from './qwenSessionUpdateHandler.js'; -// 重新导出类型以保持向后兼容 export type { ChatMessage, PlanEntry, ToolCallUpdateData }; /** diff --git a/packages/vscode-ide-companion/src/webview/App.scss b/packages/vscode-ide-companion/src/webview/App.scss index c40b2821..64abceed 100644 --- a/packages/vscode-ide-companion/src/webview/App.scss +++ b/packages/vscode-ide-companion/src/webview/App.scss @@ -787,30 +787,17 @@ button { min-width: 0; } -/* Active file indicator - shows current file selection (.vo in Claude Code) */ +/* Active file indicator - shows current file selection */ .active-file-indicator { - font-size: 0.85em; - font-family: inherit; - color: var(--app-primary-foreground); - opacity: 0.6; - background: none; - border: none; - padding: 2px 4px; - cursor: default; - text-align: right; - max-width: 50%; + // Inherits all styles from .action-button + // Only add specific overrides here if needed + max-width: 200px; overflow: hidden; text-overflow: ellipsis; - white-space: nowrap; - border-radius: 2px; flex-shrink: 1; min-width: 0; } -.active-file-indicator:hover { - opacity: 1; -} - /* Hide file indicator on very small screens */ @media screen and (max-width: 330px) { .active-file-indicator { diff --git a/packages/vscode-ide-companion/src/webview/App.tsx b/packages/vscode-ide-companion/src/webview/App.tsx index cb8b9a38..d102c665 100644 --- a/packages/vscode-ide-companion/src/webview/App.tsx +++ b/packages/vscode-ide-companion/src/webview/App.tsx @@ -220,6 +220,7 @@ export const App: React.FC = () => { const [editMode, setEditMode] = useState('ask'); const [thinkingEnabled, setThinkingEnabled] = useState(false); const [activeFileName, setActiveFileName] = useState(null); + const [isComposing, setIsComposing] = useState(false); const handlePermissionRequest = React.useCallback( (request: { @@ -401,20 +402,8 @@ export const App: React.FC = () => { case 'qwenSessionList': { const sessions = message.data.sessions || []; setQwenSessions(sessions); - // If no current session is selected and there are sessions, select the first one - if (!currentSessionId && sessions.length > 0) { - const firstSession = sessions[0]; - const firstSessionId = - (firstSession.id as string) || (firstSession.sessionId as string); - const firstSessionTitle = - (firstSession.title as string) || - (firstSession.name as string) || - 'Past Conversations'; - if (firstSessionId) { - setCurrentSessionId(firstSessionId); - setCurrentSessionTitle(firstSessionTitle); - } - } else if (currentSessionId && sessions.length > 0) { + // Only update title if we have a current session selected + if (currentSessionId && sessions.length > 0) { // Update title for the current session if it exists in the list const currentSession = sessions.find( (s: Record) => @@ -443,13 +432,15 @@ export const App: React.FC = () => { message.data.sessionId, ); } - // Update current session title - if (message.data.title || message.data.name) { + // Update current session title from session object + if (message.data.session) { + const session = message.data.session as Record; const title = - (message.data.title as string) || - (message.data.name as string) || + (session.title as string) || + (session.name as string) || 'Past Conversations'; setCurrentSessionTitle(title); + console.log('[App] Session title updated to:', title); } // Load messages from the session if (message.data.messages) { @@ -471,6 +462,9 @@ export const App: React.FC = () => { setMessages([]); setCurrentStreamContent(''); setToolCalls(new Map()); + // Reset session ID and title when conversation is cleared (new session created) + setCurrentSessionId(null); + setCurrentSessionTitle('Past Conversations'); break; case 'activeEditorChanged': { @@ -1028,8 +1022,15 @@ export const App: React.FC = () => { const target = e.target as HTMLDivElement; setInputText(target.textContent || ''); }} + onCompositionStart={() => { + setIsComposing(true); + }} + onCompositionEnd={() => { + setIsComposing(false); + }} onKeyDown={(e) => { - if (e.key === 'Enter' && !e.shiftKey) { + // 如果正在进行中文输入法输入(拼音输入),不处理回车键 + if (e.key === 'Enter' && !e.shiftKey && !isComposing) { e.preventDefault(); handleSubmit(e); }