修复快速开始新对话以及点击项目无法跳转

This commit is contained in:
2025-10-13 21:47:52 +08:00
parent 7d3941780f
commit 72a51fac24
6 changed files with 130 additions and 66 deletions

View File

@@ -277,8 +277,17 @@ export const Terminal: React.FC<TerminalProps> = ({
resizeTerminal();
}, 150);
// 如果没有有效的 projectPath,跳过创建终端会话
if (!projectPath || projectPath.trim() === '') {
console.log('[Terminal] Skipping session creation - no project path');
if (xtermRef.current) {
xtermRef.current.write('\r\n\x1b[33mNo project directory selected. Please select a project to use the terminal.\x1b[0m\r\n');
}
return;
}
// 创建终端会话
const newSessionId = await api.createTerminalSession(projectPath || process.cwd());
const newSessionId = await api.createTerminalSession(projectPath);
if (!isMounted) {
await api.closeTerminalSession(newSessionId);