mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-02 17:12:16 +03:00
Support Dynamic Thinking Models (#23281)
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Extra Build (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Extra Build (push) Blocked by required conditions
* Add ability to toggle thinking * Disable thinking for descriptions automatically * mypy * Cleanup
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import type { ConfigFormContext, JsonObject } from "@/types/configForm";
|
||||
import type { GenAIModelsResponse } from "@/types/chat";
|
||||
import { getSizedFieldClassName } from "../utils";
|
||||
|
||||
type ProbeResponse =
|
||||
@@ -73,11 +74,12 @@ export function GenAIModelWidget(props: WidgetProps) {
|
||||
return `${e.provider ?? ""}|${e.base_url ?? ""}`;
|
||||
}, [providerKey, formContext?.fullConfig]);
|
||||
|
||||
const { data: allModels, mutate: mutateModels } = useSWR<
|
||||
Record<string, string[]>
|
||||
>("genai/models", {
|
||||
revalidateOnFocus: false,
|
||||
});
|
||||
const { data: allModels, mutate: mutateModels } = useSWR<GenAIModelsResponse>(
|
||||
"genai/models",
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
},
|
||||
);
|
||||
|
||||
// Revalidate models when the saved config fingerprint changes (e.g. after
|
||||
// switching provider or base_url and saving).
|
||||
@@ -89,9 +91,9 @@ export function GenAIModelWidget(props: WidgetProps) {
|
||||
}
|
||||
}, [configFingerprint, mutateModels]);
|
||||
|
||||
const fetchedModels = useMemo(() => {
|
||||
const fetchedModels = useMemo<string[]>(() => {
|
||||
if (!allModels || !providerKey) return [];
|
||||
return allModels[providerKey] ?? [];
|
||||
return allModels[providerKey]?.models ?? [];
|
||||
}, [allModels, providerKey]);
|
||||
|
||||
const [probeStatus, setProbeStatus] = useState<ProbeStatus>("idle");
|
||||
|
||||
Reference in New Issue
Block a user