Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix(openai): update Azure API version and improve error handling

Gianluigi Conti35c01777294f
diff --git a/apps/client/src/constants/llm.ts b/apps/client/src/constants/llm.ts
index e33b3948b..cdf23ff49 100644
--- a/apps/client/src/constants/llm.ts
+++ b/apps/client/src/constants/llm.ts
@@ -1,3 +1,3 @@
export const DEFAULT_MODEL = "gpt-3.5-turbo";
export const DEFAULT_MAX_TOKENS = 1024;
-export const DEFAULT_AZURE_API_VERSION = "2025-01-01-preview";
+export const DEFAULT_AZURE_API_VERSION = "2024-10-21";
diff --git a/apps/client/src/pages/dashboard/settings/_sections/openai.tsx b/apps/client/src/pages/dashboard/settings/_sections/openai.tsx
index cb866871e..230789ad3 100644
--- a/apps/client/src/pages/dashboard/settings/_sections/openai.tsx
+++ b/apps/client/src/pages/dashboard/settings/_sections/openai.tsx
@@ -127,7 +127,7 @@ export const OpenAISettings = () => {
<Trans>
You can also integrate with Azure OpenAI by enabling the "Use Azure OpenAI" checkbox
and setting the Resource URL to your Azure OpenAI resource (e.g.,
- `https://your-resource.openai.azure.com`). Set the deployment name in the Model field
+ <code>https://your-resource.openai.azure.com</code>). Set the deployment name in the Model field
and specify the appropriate API version for your Azure deployment.
</Trans>
</p>
@@ -135,8 +135,8 @@ export const OpenAISettings = () => {
<p>
<Trans>
You can also integrate with Ollama simply by setting the API key to
- `sk-1234567890abcdef` and the Base URL to your Ollama URL, i.e.
- `http://localhost:11434/v1`. You can also pick and choose models and set the max tokens
+ <code>sk-1234567890abcdef</code> and the Base URL to your Ollama URL, i.e.
+ <code>http://localhost:11434/v1</code>. You can also pick and choose models and set the max tokens
as per your preference.
</Trans>
</p>
@@ -228,8 +228,10 @@ export const OpenAISettings = () => {
<FormItem className="flex flex-row items-center space-x-3 space-y-0">
<FormControl>
<Checkbox
- checked={field.value}
- onCheckedChange={field.onChange}
+ checked={!!field.value}
+ onCheckedChange={(value) => {
+ field.onChange(Boolean(value));
+ }}
/>
</FormControl>
<div className="space-y-1 leading-none">
diff --git a/apps/client/src/services/openai/client.ts b/apps/client/src/services/openai/client.ts
index 343106128..5bbb6ef51 100644
--- a/apps/client/src/services/openai/client.ts
+++ b/apps/client/src/services/openai/client.ts
@@ -14,21 +14,15 @@ export const openai = () => {
if (isAzure) {
if (!baseURL) {
- throw new Error(
- t`Azure OpenAI Base URL is required when using Azure OpenAI.`,
- );
+ throw new Error(t`Azure OpenAI Base URL is required when using Azure OpenAI.`);
}
if (!model) {
- throw new Error(
- t`Azure OpenAI deployment name (model) is required when using Azure OpenAI.`,
- );
-
- if (!azureApiVersion) {
- throw new Error(
- t`Azure OpenAI API version is required when using Azure OpenAI.`,
- );
- }
+ throw new Error(t`Azure OpenAI deployment name (model) is required when using Azure OpenAI.`);
+ }
+
+ if (!azureApiVersion) {
+ throw new Error(t`Azure OpenAI API version is required when using Azure OpenAI.`);
}
// Construct Azure OpenAI URL: https://your-resource.openai.azure.com/openai/deployments/your-deployment