perf: modal

This commit is contained in:
archer
2023-07-27 14:36:21 +08:00
parent 1c4d2e92cf
commit aebe789e9f
7 changed files with 40 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
import { Configuration, OpenAIApi } from 'openai';
const baseUrl = process.env.ONEAPI_URL || process.env.OPENAI_BASE_URL || 'api.openai.com';
const baseUrl =
process.env.ONEAPI_URL || process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1';
export const getSystemOpenAiKey = () => {
return process.env.ONEAPI_KEY || process.env.OPENAIKEY || '';

View File

@@ -50,7 +50,7 @@ export async function connectToDatabase(): Promise<void> {
minPoolSize: 2
});
initRootUser();
await initRootUser();
initPg();
console.log('mongo connected');
} catch (error) {
@@ -84,7 +84,6 @@ async function initRootUser() {
});
} catch (error) {
console.log('init root user error', error);
initRootUser();
}
}
async function initPg() {
@@ -108,7 +107,6 @@ async function initPg() {
console.log('init pg successful');
} catch (error) {
console.log('init pg error', error);
initPg();
}
}