feat(naming): add Suggest Names button for ideas and tee compositor
This commit is contained in:
1 parent
25d24a53a6
commit
6c6867b49c
6 files changed
+276
-7
No files matched your search
+22
-1
@@ -19,7 +19,8 @@ import {
|
||||
} from "./nano_banana.js";
|
||||
import {
|
||||
DEFAULT_USER_BACKGROUND,
|
||||
generatePersonalizedRandomIdea
|
||||
generatePersonalizedRandomIdea,
|
||||
generateNameSuggestions
|
||||
} from "./idea_generator.js";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
@@ -236,6 +237,26 @@ export function createAppServer({
|
||||
}
|
||||
}
|
||||
|
||||
// 3b. POST /api/ideas/:id/suggest-names (AI Name & Tagline Brainstormer)
|
||||
const suggestNamesMatch = pathname.match(/^\/api\/ideas\/(\d+)\/suggest-names$/);
|
||||
if (method === "POST" && suggestNamesMatch) {
|
||||
const id = Number(suggestNamesMatch[1]);
|
||||
const idea = store.getIdea(id);
|
||||
if (!idea) return sendJson(res, 404, { error: "Idea not found" });
|
||||
|
||||
const userBackground =
|
||||
store.getSetting("user_background", DEFAULT_USER_BACKGROUND) || DEFAULT_USER_BACKGROUND;
|
||||
const savedKey = store.getSetting("gemini_api_key", "") || process.env.GEMINI_API_KEY || "";
|
||||
|
||||
const result = await generateNameSuggestions({
|
||||
idea,
|
||||
userBackground,
|
||||
geminiApiKey: savedKey
|
||||
});
|
||||
|
||||
return sendJson(res, 200, result);
|
||||
}
|
||||
|
||||
// 4. GET /api/whack-cards
|
||||
if (method === "GET" && pathname === "/api/whack-cards") {
|
||||
const allIdeas = store.listIdeas({});
|
||||
|
||||
Reference in new issue
Block a user