Compare commits

...

3 Commits

Author SHA1 Message Date
ZhaiSoul
cf8ee499f9 fix: fix classification modelSize i18n error 2025-04-15 15:45:14 +00:00
ZhaiSoul
f16f6f95b8 feat: add openai base_url setting 2025-04-15 15:38:11 +00:00
ZhaiSoul
e373b8adc7 revert: revert wrong label fix 2025-04-15 15:36:35 +00:00
11 changed files with 24 additions and 22 deletions

View File

@ -21,6 +21,10 @@ class OpenAIClient(GenAIClient):
def _init_provider(self):
"""Initialize the client."""
if self.genai_config.base_url:
return OpenAI(
api_key=self.genai_config.api_key, base_url=self.genai_config.base_url
)
return OpenAI(api_key=self.genai_config.api_key)
def _send(self, prompt: str, images: list[bytes]) -> Optional[str]:

View File

@ -127,9 +127,7 @@ export default function SearchThumbnail({
.filter(
(item) => item !== undefined && !item.includes("-verified"),
)
.map((text) =>
t(text.replace(" ", "_").toLowerCase(), { ns: "objects" }),
)
.map((text) => t(text, { ns: "objects" }))
.sort()
.join(", ")
.replaceAll("-verified", "")}

View File

@ -248,7 +248,7 @@ function GeneralFilterButton({
}
if (selectedLabels.length == 1) {
return t(selectedLabels[0].replace(" ", "_").toLowerCase(), {
return t(selectedLabels[0], {
ns: "objects",
});
}
@ -357,7 +357,7 @@ export function GeneralFilterContent({
{allLabels.map((item) => (
<FilterSwitch
key={item}
label={t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })}
label={t(item, { ns: "objects" })}
isChecked={currentLabels?.includes(item) ?? false}
onCheckedChange={(isChecked) => {
if (isChecked) {

View File

@ -419,7 +419,7 @@ export default function InputWithTags({
? t("button.yes", { ns: "common" })
: t("button.no", { ns: "common" });
} else if (filterType === "labels") {
return t((filterValues as string).replace(" ", "_").toLowerCase(), {
return t(filterValues as string, {
ns: "objects",
});
} else if (filterType === "search_type") {
@ -809,7 +809,7 @@ export default function InputWithTags({
>
{t("filter.label." + filterType)}:{" "}
{filterType === "labels"
? t(value.replace(" ", "_").toLowerCase(), {
? t(value, {
ns: "objects",
})
: value.replaceAll("_", " ")}

View File

@ -325,7 +325,7 @@ export default function ReviewDetailDialog({
values={{
objects: missingObjects
.map((x) =>
t(x.replace(" ", "_").toLowerCase(), {
t(x, {
ns: "objects",
}),
)

View File

@ -690,7 +690,7 @@ function ObjectDetailsTab({
<div className="text-sm text-primary/40">{t("details.label")}</div>
<div className="flex flex-row items-center gap-2 text-sm capitalize">
{getIconForLabel(search.label, "size-4 text-primary")}
{t(search.label.replace(" ", "_").toLowerCase(), {
{t(search.label, {
ns: "objects",
})}
{search.sub_label && ` (${search.sub_label})`}
@ -953,7 +953,7 @@ function ObjectDetailsTab({
description={
search.label
? t("details.editSubLabel.desc", {
label: t(search.label.replace(" ", "_").toLowerCase(), {
label: t(search.label, {
ns: "objects",
}),
})
@ -970,7 +970,7 @@ function ObjectDetailsTab({
description={
search.label
? t("details.editLPR.desc", {
label: t(search.label.replace(" ", "_").toLowerCase(), {
label: t(search.label, {
ns: "objects",
}),
})

View File

@ -448,7 +448,7 @@ export function ZoneObjectSelector({ camera }: ZoneObjectSelectorProps) {
<SelectSeparator className="bg-secondary" />
{allLabels.map((item) => (
<SelectItem key={item} value={item}>
{t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })}
{t(item, { ns: "objects" })}
</SelectItem>
))}
</SelectGroup>

View File

@ -936,7 +936,7 @@ export function ZoneObjectSelector({
className="w-full cursor-pointer capitalize text-primary"
htmlFor={item}
>
{t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })}
{t(item, { ns: "objects" })}
</Label>
<Switch
key={item}

View File

@ -152,7 +152,7 @@ function ThumbnailRow({
return (
<div className="rounded-lg bg-background_alt p-2 md:px-4">
<div className="flex flex-row items-center text-lg capitalize">
{t(objectType.replace(" ", "_").toLowerCase(), { ns: "objects" })}
{t(objectType, { ns: "objects" })}
{searchResults && (
<span className="ml-3 text-sm text-secondary-foreground">
{t("trackedObjectsCount", {

View File

@ -79,9 +79,7 @@ export default function CameraSettingsView({
const alertsLabels = useMemo(() => {
return cameraConfig?.review.alerts.labels
? cameraConfig.review.alerts.labels
.map((label) =>
t(label.replace(" ", "_").toLowerCase(), { ns: "objects" }),
)
.map((label) => t(label, { ns: "objects" }))
.join(", ")
: "";
}, [cameraConfig, t]);
@ -89,9 +87,7 @@ export default function CameraSettingsView({
const detectionsLabels = useMemo(() => {
return cameraConfig?.review.detections.labels
? cameraConfig.review.detections.labels
.map((label) =>
t(label.replace(" ", "_").toLowerCase(), { ns: "objects" }),
)
.map((label) => t(label, { ns: "objects" }))
.join(", ")
: "";
}, [cameraConfig, t]);

View File

@ -326,7 +326,9 @@ export default function ClassificationSettingsView({
}
>
<SelectTrigger className="w-20">
{classificationSettings.search.model_size}
{t(
`classification.semanticSearch.modelSize.${classificationSettings.search.model_size}.title`,
)}
</SelectTrigger>
<SelectContent>
<SelectGroup>
@ -456,7 +458,9 @@ export default function ClassificationSettingsView({
}
>
<SelectTrigger className="w-20">
{classificationSettings.face.model_size}
{t(
`classification.faceRecognition.modelSize.${classificationSettings.face.model_size}.title`,
)}
</SelectTrigger>
<SelectContent>
<SelectGroup>