Infrastructure: - MinIO déployé en local pour le stockage S3 (docker-compose) - Storage proxy réécrit: sert les fichiers depuis MinIO en streaming (plus de 307 redirect vers CDN externe) - Legacy /manus-storage/ redirige vers /storage/ LLM & Image Generation: - LLM: Gemini uniquement (suppression du fallback Forge) - Image generation: Gemini Imagen direct (suppression Forge GenerateImage) - llmConfig simplifié, un seul provider Nettoyage Manus: - Modules Forge stubbés (dataApi, heartbeat, map, notification, voiceTranscription) - ENV simplifié (suppression forgeApiUrl, forgeApiKey) - Analytics Manus supprimées du HTML - systemRouter simplifié Migration données: - 750 fichiers migrés de Forge S3 vers MinIO (69.8 MB) - URLs DB mises à jour: /manus-storage/ -> /storage/ - Script de migration inclus (scripts/migrate-to-minio.mjs) Performance: - Frame load: 500ms -> 62ms (8x plus rapide) - Plus aucune dépendance réseau transatlantique pour le stockage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { invokeLLM, type InvokeParams, type InvokeResult } from "./_core/llm";
|
|
|
|
export interface LlmConfig {
|
|
model: string;
|
|
behavior: string;
|
|
}
|
|
|
|
let cachedConfig: LlmConfig | null = null;
|
|
let cacheTimestamp = 0;
|
|
const CACHE_TTL = 30_000;
|
|
|
|
export async function getLlmConfig(): Promise<LlmConfig> {
|
|
const now = Date.now();
|
|
if (cachedConfig && (now - cacheTimestamp) < CACHE_TTL) {
|
|
return cachedConfig;
|
|
}
|
|
|
|
try {
|
|
const { getDb } = await import("./db");
|
|
const db = await getDb();
|
|
if (db) {
|
|
const { appConfig } = await import("../drizzle/schema");
|
|
const { eq } = await import("drizzle-orm");
|
|
const result = await db.select().from(appConfig).where(eq(appConfig.key, "llm_config")).limit(1);
|
|
if (result[0]?.value) {
|
|
const parsed = JSON.parse(result[0].value);
|
|
cachedConfig = {
|
|
model: parsed.model || "gemini-flash",
|
|
behavior: parsed.behavior || "guided",
|
|
};
|
|
cacheTimestamp = now;
|
|
return cachedConfig;
|
|
}
|
|
}
|
|
} catch (err) {
|
|
console.warn("[LLM Config] Failed to load config:", err);
|
|
}
|
|
|
|
cachedConfig = { model: "gemini-flash", behavior: "guided" };
|
|
cacheTimestamp = now;
|
|
return cachedConfig;
|
|
}
|
|
|
|
export function invalidateLlmConfigCache(): void {
|
|
cachedConfig = null;
|
|
cacheTimestamp = 0;
|
|
}
|
|
|
|
export async function invokeConfiguredLLM(params: InvokeParams): Promise<InvokeResult> {
|
|
return invokeLLM(params);
|
|
}
|