Skip to content

Commit 80f3eb9

Browse files
committed
feat: add full stack mode to chat mode selector and update system prompts
1 parent 3766d69 commit 80f3eb9

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/components/ChatModeSelector.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,41 @@ export function ChatModeSelector({ appId }: { appId?: number }) {
5252
}
5353
}
5454

55+
// If switching to fullstack mode and we have an app ID, check if frontend and backend folders exist
56+
if (newMode === "fullstack" && appId) {
57+
try {
58+
setIsCreatingFolder(true);
59+
// Get the app to check its structure
60+
const app = await IpcClient.getInstance().getApp(appId);
61+
const frontendFiles = app.files.filter((file: string) => file.startsWith("frontend/"));
62+
const backendFiles = app.files.filter((file: string) => file.startsWith("backend/"));
63+
64+
// If no frontend files exist, create the frontend folder
65+
if (frontendFiles.length === 0) {
66+
await IpcClient.getInstance().createMissingFolder({
67+
appId,
68+
folderType: "frontend",
69+
templateId: settings?.selectedTemplateId,
70+
});
71+
}
72+
73+
// If no backend files exist, create the backend folder
74+
if (backendFiles.length === 0) {
75+
await IpcClient.getInstance().createMissingFolder({
76+
appId,
77+
folderType: "backend",
78+
backendFramework: settings?.selectedBackendFramework,
79+
});
80+
}
81+
} catch (error) {
82+
console.error("Error creating fullstack folders:", error);
83+
showError(error);
84+
return; // Don't change the mode if folder creation failed
85+
} finally {
86+
setIsCreatingFolder(false);
87+
}
88+
}
89+
5590
// Update the chat mode
5691
updateSettings({ selectedChatMode: newMode });
5792
};
@@ -64,6 +99,8 @@ export function ChatModeSelector({ appId }: { appId?: number }) {
6499
return "Ask";
65100
case "backend":
66101
return "Backend";
102+
case "fullstack":
103+
return "Full Stack";
67104
default:
68105
return "Build";
69106
}
@@ -122,6 +159,14 @@ export function ChatModeSelector({ appId }: { appId?: number }) {
122159
</span>
123160
</div>
124161
</SelectItem>
162+
<SelectItem value="fullstack">
163+
<div className="flex flex-col items-start">
164+
<span className="font-medium">Full Stack</span>
165+
<span className="text-xs text-muted-foreground">
166+
Full stack development (frontend + backend)
167+
</span>
168+
</div>
169+
</SelectItem>
125170
</SelectContent>
126171
</Select>
127172
);

src/prompts/system_prompt.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export const constructSystemPrompt = ({
258258
chatMode = "build",
259259
}: {
260260
aiRules: string | undefined;
261-
chatMode?: "build" | "ask" | "backend";
261+
chatMode?: "build" | "ask" | "backend" | "fullstack";
262262
}) => {
263263
let systemPrompt;
264264
let rules = aiRules ?? DEFAULT_AI_RULES;
@@ -268,6 +268,10 @@ export const constructSystemPrompt = ({
268268
} else if (chatMode === "backend") {
269269
systemPrompt = BACKEND_BUILD_SYSTEM_PROMPT;
270270
rules = aiRules ?? BACKEND_AI_RULES; // Use backend rules for backend mode
271+
} else if (chatMode === "fullstack") {
272+
systemPrompt = BUILD_SYSTEM_PROMPT; // Use build mode for fullstack, but could customize later
273+
// For fullstack, we might want to combine both frontend and backend rules
274+
rules = aiRules ?? DEFAULT_AI_RULES;
271275
} else {
272276
systemPrompt = BUILD_SYSTEM_PROMPT;
273277
}

0 commit comments

Comments
 (0)