Fix: Replace empty API keys with temporary placeholder

The previous code used an empty string for the `apiKey` when no key was provided, which could lead to unexpected behavior. This commit replaces those with a temporary placeholder ("temp") to avoid potential errors and make the code more robust.
This commit is contained in:
n4ze3m 2024-09-30 10:28:35 +05:30
parent d7510333a7
commit efec675b9a

View File

@ -44,11 +44,11 @@ export const pageAssistModel = async ({
return new ChatOpenAI({
modelName: modelInfo.model_id,
openAIApiKey: providerInfo.apiKey || "",
openAIApiKey: providerInfo.apiKey || "temp",
temperature,
topP,
configuration: {
apiKey: providerInfo.apiKey || "",
apiKey: providerInfo.apiKey || "temp",
baseURL: providerInfo.baseUrl || "",
}
}) as any