-
-
- {name}
-
- {loading ? (
-
- Loading model settings…
-
- ) : error ? (
-
{tx`Could not refresh models: ${error}`}
- ) : !settings?.some((o) => o.values.length) ? (
-
- No settings reported for this model.
-
- ) : (
- settings
- .filter((o) => o.values.length > 0)
- .map((o) => {
- const label = tx(settingName(o));
- const segmented =
- isContextOption(o.id) || (o.category === "thought_level" && o.values.length <= SEGMENTED_EFFORT_MAX);
- return (
-
-
- {label}
-
- {segmented ? (
- ({
- value: v.value,
- label: v.name,
- description: v.description ?? undefined,
- }))}
- value={settingValue(o)!.value}
- onChange={(v) => onChange(o.id, v)}
- />
- ) : (
-
- )}
-
- );
- })
- )}
+ {settings.map((o) => {
+ const label = tx(settingName(o));
+ const control = switchValues(o) ? (
+
+ ) : o.values.length <= SEGMENTED_MAX ? (
+
({ value: v.value, label: v.name, description: v.description ?? undefined }))}
+ value={settingValue(o)!.value}
+ onChange={(v) => {
+ onChange(o.id, v);
+ if (only) onDone();
+ }}
+ />
+ ) : (
+ ({ value: v.value, label: v.name, detail: v.description ?? undefined }))}
+ onChoose={(v) => {
+ onChange(o.id, v);
+ if (only) onDone();
+ }}
+ />
+ );
+ return (
+
+
+ {label}
+
+ {control}
+
+ );
+ })}
);
}
+/** Where the model's settings chip appears once they arrive. */
+function LoadingSettingsChip() {
+ const tx = useTx();
+ return (
+