mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
Add Google Gemini TTS as alternative to Edge TTS
- Store Gemini API key globally in appConfig (single key for all users)
- Add /api/settings/gemini GET/POST/DELETE routes for API key management
- Backend: add tts_engine parameter ("edge" or "gemini") to FFmpeg service
- Backend: add generate_tts_gemini() using Google Cloud TTS REST API
- Frontend: Settings page shows Google Gemini API key input card
- Frontend: new-reel, mobile/new-reel, remotion-video, mobile/remotion-video
pages now have Edge/Gemini engine toggle and French voice selector
- Fix tts-preview route to extract ttsVoice from req.body instead of
undefined voice variable
This commit is contained in:
1 parent
59bc56aedc
commit
72b13b3e42
12 files changed
+605
-29
No files matched your search
@@ -420,6 +420,41 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
});
|
||||
|
||||
// Google Gemini API Key (TTS)
|
||||
app.get("/api/settings/gemini", requireAdmin, async (req, res) => {
|
||||
try {
|
||||
const config = await storage.getAppConfig();
|
||||
res.json({ configured: !!(config?.geminiApiKey) });
|
||||
} catch (error) {
|
||||
console.error("Error fetching Gemini config:", error);
|
||||
res.status(500).json({ error: "Erreur lors de la récupération de la configuration" });
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/api/settings/gemini", requireAdmin, async (req, res) => {
|
||||
try {
|
||||
const { apiKey } = req.body;
|
||||
if (!apiKey || typeof apiKey !== "string" || apiKey.trim() === "") {
|
||||
return res.status(400).json({ error: "La clé API est requise" });
|
||||
}
|
||||
await storage.upsertAppConfig({ geminiApiKey: apiKey.trim() });
|
||||
res.json({ success: true, configured: true });
|
||||
} catch (error) {
|
||||
console.error("Error saving Gemini config:", error);
|
||||
res.status(500).json({ error: "Erreur lors de la sauvegarde de la configuration" });
|
||||
}
|
||||
});
|
||||
|
||||
app.delete("/api/settings/gemini", requireAdmin, async (req, res) => {
|
||||
try {
|
||||
await storage.upsertAppConfig({ geminiApiKey: null });
|
||||
res.json({ success: true, configured: false });
|
||||
} catch (error) {
|
||||
console.error("Error deleting Gemini config:", error);
|
||||
res.status(500).json({ error: "Erreur lors de la suppression de la clé" });
|
||||
}
|
||||
});
|
||||
|
||||
// Analytics Routes
|
||||
app.use("/api/analytics", requireAuth, analyticsRouter);
|
||||
|
||||
|
||||
Reference in new issue
Block a user