diff --git a/docs/docs/configuration/genai.md b/docs/docs/configuration/genai.md index 6427cfd4c..51d2e2117 100644 --- a/docs/docs/configuration/genai.md +++ b/docs/docs/configuration/genai.md @@ -117,7 +117,7 @@ To start using Azure OpenAI, you must first [create a resource](https://learn.mi ```yaml genai: enabled: True - provider: openai + provider: azure_openai base_url: https://example-endpoint.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2023-03-15-preview api_key: "{FRIGATE_OPENAI_API_KEY}" ``` diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index ac4b80e46..4fac46421 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -51,7 +51,7 @@ import { import { ReviewSegment } from "@/types/review"; import { useNavigate } from "react-router-dom"; import Chip from "@/components/indicators/Chip"; -import { capitalizeFirstLetter } from "@/utils/stringUtil"; +import { capitalizeAll } from "@/utils/stringUtil"; import useGlobalMutation from "@/hooks/use-global-mutate"; import { DropdownMenu, @@ -332,7 +332,7 @@ function ObjectDetailsTab({ .then((resp) => { if (resp.status == 200) { toast.success( - `A new description has been requested from ${capitalizeFirstLetter(config?.genai.provider ?? "Generative AI")}. Depending on the speed of your provider, the new description may take some time to regenerate.`, + `A new description has been requested from ${capitalizeAll(config?.genai.provider.replaceAll("_", " ") ?? "Generative AI")}. Depending on the speed of your provider, the new description may take some time to regenerate.`, { position: "top-center", duration: 7000, @@ -342,7 +342,7 @@ function ObjectDetailsTab({ }) .catch(() => { toast.error( - `Failed to call ${capitalizeFirstLetter(config?.genai.provider ?? "Generative AI")} for a new description`, + `Failed to call ${capitalizeAll(config?.genai.provider.replaceAll("_", " ") ?? "Generative AI")} for a new description`, { position: "top-center", }, diff --git a/web/src/utils/stringUtil.ts b/web/src/utils/stringUtil.ts index 34556ddb3..0fbd7cde7 100644 --- a/web/src/utils/stringUtil.ts +++ b/web/src/utils/stringUtil.ts @@ -1,3 +1,10 @@ export const capitalizeFirstLetter = (text: string): string => { return text.charAt(0).toUpperCase() + text.slice(1); }; + +export const capitalizeAll = (text: string): string => { + return text + .split(" ") + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join(" "); +};