Fix: Add project parameter parsing to enable chat in project context
When accessing the IDE with ?project= URL parameter, the project context was not being initialized, causing auto-session creation to fail and chat to show "Please start or attach to a session first" error. Changes: - Added currentProjectName global variable - Parse project parameter from URL on page load - Set window.currentProjectDir for chat-functions.js auto-session logic - Extract project name from path for display Fixes chat not responding when navigating from landing page or projects view. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Claude Code IDE JavaScript
|
||||
let currentSession = null;
|
||||
let currentProjectName = null;
|
||||
let ws = null;
|
||||
|
||||
// Make ws globally accessible for other scripts
|
||||
@@ -15,10 +16,18 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
initNavigation();
|
||||
connectWebSocket();
|
||||
|
||||
// Check URL params for session and prompt
|
||||
// Check URL params for session, prompt, and project
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const sessionId = urlParams.get('session');
|
||||
const prompt = urlParams.get('prompt');
|
||||
const project = urlParams.get('project');
|
||||
|
||||
// Parse project parameter if present
|
||||
if (project) {
|
||||
window.currentProjectDir = decodeURIComponent(project);
|
||||
currentProjectName = project.split('/').filter(Boolean).pop() || 'Project';
|
||||
console.log('[Init] Project context loaded:', currentProjectName, window.currentProjectDir);
|
||||
}
|
||||
|
||||
if (sessionId || prompt) {
|
||||
// Switch to chat view first
|
||||
|
||||
Reference in New Issue
Block a user