Prevent duplicate sessions when starting a new project

This commit is contained in:
Alex Gleason committed 2025-09-24 15:10:09 -05:00
1 parent 568ea5dc04
commit 2e38591943
2 files changed
+5

No files matched your search

+4
View File
@@ -129,6 +129,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
});
// State to control model selector dropdown
const [isModelSelectorOpen, setIsModelSelectorOpen] = useState(false);
const autostartedRef = useRef(false);
useEffect(() => {
if (!providerModel && settings.recentlyUsedModels?.length) {
@@ -282,6 +283,8 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
// Check for autostart parameter and trigger AI generation
useEffect(() => {
if (autostartedRef.current) return;
const autostart = searchParams.get('autostart');
const urlModel = searchParams.get('model');
@@ -304,6 +307,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
// Start AI generation
addRecentlyUsedModel(modelToUse);
startGeneration(modelToUse);
autostartedRef.current = true;
}
}
}, [addRecentlyUsedModel, isConfigured, providerModel, searchParams, setSearchParams, startGeneration]);
+1
View File
@@ -178,6 +178,7 @@ export class SessionManager {
* Start AI generation for a session
*/
async startGeneration(projectId: string, providerModel: string): Promise<void> {
console.log('Starting AI generation for project:', projectId, 'with model:', providerModel);
let session = this.sessions.get(projectId);
if (!session) {