mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-08 18:45:33 +08:00
Allow configuring OpenAI base URL
This commit is contained in:
@@ -4,11 +4,14 @@ import fs from "node:fs";
|
||||
import { normalizeRadioPhrase } from "../../shared/utils/radioSpeech";
|
||||
import { getServerRuntimeConfig } from "./runtimeConfig";
|
||||
|
||||
const { openaiKey, openaiProject, llmModel, ttsModel } = getServerRuntimeConfig();
|
||||
const { openaiKey, openaiProject, openaiBaseUrl, llmModel, ttsModel } = getServerRuntimeConfig();
|
||||
const normalizeClientOptions: ConstructorParameters<typeof OpenAI>[0] = { apiKey: openaiKey };
|
||||
if (openaiProject) {
|
||||
normalizeClientOptions.project = openaiProject;
|
||||
}
|
||||
if (openaiBaseUrl) {
|
||||
normalizeClientOptions.baseURL = openaiBaseUrl;
|
||||
}
|
||||
|
||||
export const normalize = new OpenAI(normalizeClientOptions);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user