mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-17 20:26:24 +02:00
feat(minimax): add Group ID support to fix rate limit quota
Pass GroupId query param to Minimax T2A v2 API — required for paid plan quota allocation. Without it, Minimax defaults to (0/0 used). - shared/schema.ts: groupId field on minimaxConfig table - server/migrate.ts: ADD COLUMN IF NOT EXISTS group_id - server/routes/reels.ts: fetch and pass groupId alongside apiKey - server/services/ffmpeg.ts: minimax_group_id in request interface/body - ffmpeg-service/main.py: GroupId in URL, threaded through all call sites - client/src/pages/settings.tsx: Group ID input in Minimax settings card
This commit is contained in:
1 parent
cf20b0a264
commit
0209c3eacf
6 files changed
+61
-9
No files matched your search
+10
-2
@@ -354,12 +354,14 @@ reelsRouter.post('/reels/preview', async (req: Request, res: Response) => {
|
||||
const finalWordDuration = wordDuration;
|
||||
|
||||
let minimaxApiKey: string | undefined;
|
||||
let minimaxGroupId: string | undefined;
|
||||
if (ttsEnabled && ttsProvider === 'minimax') {
|
||||
const minimaxCfg = await storage.getMinimaxConfig(user.id);
|
||||
if (!minimaxCfg?.apiKey) {
|
||||
return res.status(400).json({ error: 'Clé API Minimax non configurée. Allez dans les Paramètres.' });
|
||||
}
|
||||
minimaxApiKey = minimaxCfg.apiKey;
|
||||
minimaxGroupId = minimaxCfg.groupId ?? undefined;
|
||||
}
|
||||
|
||||
// Traiter la vidéo via FFmpeg
|
||||
@@ -370,6 +372,7 @@ reelsRouter.post('/reels/preview', async (req: Request, res: Response) => {
|
||||
ttsVoice,
|
||||
ttsProvider,
|
||||
minimaxApiKey,
|
||||
minimaxGroupId,
|
||||
wordDuration: finalWordDuration,
|
||||
fontSize,
|
||||
musicVolume,
|
||||
@@ -409,15 +412,17 @@ reelsRouter.post('/reels/tts-preview', async (req: Request, res: Response) => {
|
||||
}
|
||||
|
||||
let minimaxApiKey: string | undefined;
|
||||
let minimaxGroupId: string | undefined;
|
||||
if (ttsProvider === 'minimax') {
|
||||
const minimaxCfg = await storage.getMinimaxConfig(user.id);
|
||||
if (!minimaxCfg?.apiKey) {
|
||||
return res.status(400).json({ error: 'Clé API Minimax non configurée. Allez dans les Paramètres.' });
|
||||
}
|
||||
minimaxApiKey = minimaxCfg.apiKey;
|
||||
minimaxGroupId = minimaxCfg.groupId ?? undefined;
|
||||
}
|
||||
|
||||
const result = await ffmpegService.previewTTS(text, voice, ttsProvider, minimaxApiKey);
|
||||
const result = await ffmpegService.previewTTS(text, voice, ttsProvider, minimaxApiKey, minimaxGroupId);
|
||||
|
||||
if (!result.success) {
|
||||
return res.status(500).json({ error: result.error || 'Erreur de génération TTS' });
|
||||
@@ -610,16 +615,18 @@ async function processReelBackground(
|
||||
const finalWordDuration = wordDuration ?? 0.6;
|
||||
|
||||
let minimaxApiKeyBg: string | undefined;
|
||||
let minimaxGroupIdBg: string | undefined;
|
||||
if (ttsEnabled && ttsProvider === 'minimax') {
|
||||
const minimaxCfg = await storage.getMinimaxConfig(userId);
|
||||
if (minimaxCfg?.apiKey) {
|
||||
minimaxApiKeyBg = minimaxCfg.apiKey;
|
||||
minimaxGroupIdBg = minimaxCfg.groupId ?? undefined;
|
||||
} else {
|
||||
console.error('❌ [Background] Minimax API key not found in DB for user:', userId);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('🔊 [Background] TTS config:', { ttsEnabled, ttsProvider, ttsVoice, hasMinimaxKey: !!minimaxApiKeyBg });
|
||||
console.log('🔊 [Background] TTS config:', { ttsEnabled, ttsProvider, ttsVoice, hasMinimaxKey: !!minimaxApiKeyBg, hasGroupId: !!minimaxGroupIdBg });
|
||||
|
||||
const ffmpegResult = await ffmpegService.processReelFromUrl(resolveInternalUrl(media.originalUrl), {
|
||||
text: overlayText,
|
||||
@@ -628,6 +635,7 @@ async function processReelBackground(
|
||||
ttsVoice,
|
||||
ttsProvider,
|
||||
minimaxApiKey: minimaxApiKeyBg,
|
||||
minimaxGroupId: minimaxGroupIdBg,
|
||||
wordDuration: finalWordDuration,
|
||||
fontSize,
|
||||
musicVolume,
|
||||
|
||||
Reference in new issue
Block a user