From c8edcd3dadb880d87dbe45cfbec5449b0d55f423 Mon Sep 17 00:00:00 2001 From: Creative-Geek Date: Thu, 30 Jan 2025 08:49:22 +0200 Subject: [PATCH] Allow usage of openai compatible apis Changed front-end fields verification to allow the user to enter any openai compatible endpoint and api key. to do: make a verify connection button and edit paragraphs to reflect the change --- apps/client/src/pages/dashboard/settings/_sections/openai.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/client/src/pages/dashboard/settings/_sections/openai.tsx b/apps/client/src/pages/dashboard/settings/_sections/openai.tsx index ce3aa578..82b46a87 100644 --- a/apps/client/src/pages/dashboard/settings/_sections/openai.tsx +++ b/apps/client/src/pages/dashboard/settings/_sections/openai.tsx @@ -22,12 +22,12 @@ const formSchema = z.object({ apiKey: z .string() // eslint-disable-next-line lingui/no-unlocalized-strings - .regex(/^sk-.+$/, "That doesn't look like a valid OpenAI API key.") + .min(1, "API key cannot be empty.") //allow api keys like hf-.. and gsk_.. .default(""), baseURL: z .string() // eslint-disable-next-line lingui/no-unlocalized-strings - .regex(/^https?:\/\/[^/]+\/?$/, "That doesn't look like a valid URL") + .regex(/^https?:\/\/[^\s]+$/, "That doesn't look like a valid URL") //allow different openai compatible endpoints like https://api.groq.com/openai/v1 and https://api-inference.huggingface.co/v1/ .or(z.literal("")) .default(""), model: z.string().default(DEFAULT_MODEL),