fix(ai): persist openrouter settings on server and fix 503 error

This commit is contained in:
Michael committed 2026-02-21 14:04:54 +01:00
1 parent 643b26dcf3
commit c41a60b430
3 files changed
+34 -18

No files matched your search

+4 -2
View File
@@ -9,6 +9,8 @@ const CONFIG_FILE = path.join(DATA_DIR, ".db-config.json");
export interface DbConfig {
url: string;
openRouterKey?: string;
openRouterModel?: string;
}
export async function testDatabaseConnection(url: string) {
@@ -32,9 +34,9 @@ export async function testDatabaseConnection(url: string) {
}
}
export async function saveDatabaseSettings(url: string) {
export async function saveDatabaseSettings(url: string, openRouterKey?: string, openRouterModel?: string) {
try {
const config: DbConfig = { url };
const config: DbConfig = { url, openRouterKey, openRouterModel };
// S'assurer que le dossier data existe
await fs.mkdir(DATA_DIR, { recursive: true });