save whisper / tts / image gen api

This commit is contained in:
2023-11-11 13:16:55 +08:00
parent a72e98ad25
commit f3953693fd
7 changed files with 280 additions and 77 deletions

View File

@@ -152,10 +152,7 @@ class Chat {
frequency_penalty = 0,
} = {}
) {
if (OPENAI_API_KEY === undefined) {
throw "OPENAI_API_KEY is undefined";
}
this.OPENAI_API_KEY = OPENAI_API_KEY;
this.OPENAI_API_KEY = OPENAI_API_KEY ?? "";
this.messages = [];
this.total_tokens = calculate_token_length(systemMessage);
this.max_tokens = max_tokens;