mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Prevent duplicate sessions when starting a new project
This commit is contained in:
2 files changed
+5
No files matched your search
@@ -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]);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user