Skip to content

Commit 66a0f7b

Browse files
cynfriawesbillmanPinky
authored
feat(desktop): polish onboarding harness (#2039)
Signed-off-by: Wes <[email protected]> Co-authored-by: Wes <[email protected]> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
1 parent 3ad180a commit 66a0f7b

21 files changed

Lines changed: 2624 additions & 683 deletions

‎desktop/src/features/agents/ui/GlobalAgentConfigFields.tsx‎

Lines changed: 387 additions & 99 deletions
Large diffs are not rendered by default.

‎desktop/src/features/agents/ui/buzzAgentModelTuningFields.tsx‎

Lines changed: 89 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
*/
88
import * as React from "react";
99
import { Input } from "@/shared/ui/input";
10+
import { cn } from "@/shared/lib/cn";
1011
import type { EnvVarsValue } from "./EnvVarsEditor";
12+
import {
13+
AgentDropdownSelect,
14+
type AgentDropdownOption,
15+
} from "./personaProviderModelFields";
1116
import {
1217
BUZZ_AGENT_MAX_CONTEXT_TOKENS,
1318
BUZZ_AGENT_MAX_OUTPUT_TOKENS,
@@ -32,21 +37,35 @@ import {
3237
*/
3338
export function EffortSelectField({
3439
currentEffort,
40+
disabled = false,
41+
emptyOptionLabel,
3542
effortDefault,
3643
effortValid,
44+
fieldClassName,
3745
htmlFor,
3846
inheritedEffort,
3947
inheritFallbackLabel,
4048
label,
49+
labelClassName,
4150
onChange,
51+
placeholderClassName,
52+
selectClassName,
53+
showUnavailableOptions = true,
4254
testId,
55+
useCustomSelect = false,
4356
}: {
4457
/** Current effort value from env vars ("" = inherit). */
4558
currentEffort: string;
59+
/** Disable the dropdown. */
60+
disabled?: boolean;
61+
/** Optional replacement label for the empty/inherit option. */
62+
emptyOptionLabel?: string;
4663
/** Semantic default for this provider/model combination, or null for manual-budget. */
4764
effortDefault: string | null;
4865
/** Valid effort values for this provider/model. */
4966
effortValid: ReadonlyArray<string>;
67+
/** Optional class override for the field wrapper. */
68+
fieldClassName?: string;
5069
/** `htmlFor` attribute for the label element. */
5170
htmlFor: string;
5271
/** Inherited effort from a higher-precedence layer (shown in the Inherit option label). */
@@ -67,40 +86,85 @@ export function EffortSelectField({
6786
inheritFallbackLabel?: string;
6887
/** Label text for the dropdown. */
6988
label: string;
89+
/** Optional class override for the label. */
90+
labelClassName?: string;
7091
/** Called when the user selects a new value. */
7192
onChange: (value: string) => void;
93+
/** Optional class override for placeholder text. */
94+
placeholderClassName?: string;
95+
/** Optional class override for the select/trigger. */
96+
selectClassName?: string;
97+
/** When false, hide effort values that are not valid for the provider/model. */
98+
showUnavailableOptions?: boolean;
7299
/** data-testid attribute for the select element. */
73100
testId: string;
101+
/** Render the polished app dropdown instead of the native select. */
102+
useCustomSelect?: boolean;
74103
}) {
104+
const inheritLabel = inheritedEffort
105+
? `Inherit (${inheritedEffort})`
106+
: effortDefault === null
107+
? "Inherit (default)"
108+
: (inheritFallbackLabel ?? "Inherit");
109+
const effortOptions: AgentDropdownOption[] = [
110+
{ label: emptyOptionLabel ?? inheritLabel, value: "" },
111+
...BUZZ_AGENT_THINKING_EFFORT_VALUES.flatMap((v) => {
112+
const isValid = (effortValid as readonly string[]).includes(v);
113+
if (!showUnavailableOptions && !isValid) return [];
114+
const isDefault = v === effortDefault;
115+
return [
116+
{
117+
disabled: !isValid,
118+
label: isDefault ? `${v} (default)` : v,
119+
value: v,
120+
},
121+
];
122+
}),
123+
];
124+
75125
return (
76-
<div className="space-y-1.5">
77-
<label className="text-sm font-medium" htmlFor={htmlFor}>
126+
<div className={cn("space-y-1.5", fieldClassName)}>
127+
<label
128+
className={cn("text-sm font-medium", labelClassName)}
129+
htmlFor={htmlFor}
130+
>
78131
{label}
79132
</label>
80-
<select
81-
className="flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs"
82-
data-testid={testId}
83-
id={htmlFor}
84-
onChange={(event) => onChange(event.target.value)}
85-
value={currentEffort}
86-
>
87-
<option value="">
88-
{inheritedEffort
89-
? `Inherit (${inheritedEffort})`
90-
: effortDefault === null
91-
? "Inherit (default)"
92-
: (inheritFallbackLabel ?? "Inherit")}
93-
</option>
94-
{BUZZ_AGENT_THINKING_EFFORT_VALUES.map((v) => {
95-
const isValid = (effortValid as readonly string[]).includes(v);
96-
const isDefault = v === effortDefault;
97-
return (
98-
<option disabled={!isValid} key={v} value={v}>
99-
{isDefault ? `${v} (default)` : v}
133+
{useCustomSelect ? (
134+
<AgentDropdownSelect
135+
className={selectClassName}
136+
disabled={disabled}
137+
id={htmlFor}
138+
onValueChange={onChange}
139+
options={effortOptions}
140+
placeholderClassName={placeholderClassName}
141+
placeholderValue={emptyOptionLabel ? "" : undefined}
142+
testId={testId}
143+
value={currentEffort}
144+
/>
145+
) : (
146+
<select
147+
className={cn(
148+
"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs disabled:cursor-not-allowed disabled:opacity-60",
149+
selectClassName,
150+
)}
151+
data-testid={testId}
152+
disabled={disabled}
153+
id={htmlFor}
154+
onChange={(event) => onChange(event.target.value)}
155+
value={currentEffort}
156+
>
157+
{effortOptions.map((option) => (
158+
<option
159+
disabled={option.disabled}
160+
key={option.value}
161+
value={option.value}
162+
>
163+
{option.label}
100164
</option>
101-
);
102-
})}
103-
</select>
165+
))}
166+
</select>
167+
)}
104168
</div>
105169
);
106170
}

‎desktop/src/features/agents/ui/personaDialogPickers.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const DEFAULT_MODEL_OPTION: PersonaModelOption = {
112112
label: "Default model",
113113
};
114114

115-
const PERSONA_LLM_PROVIDER_OPTIONS: readonly PersonaModelOption[] = [
115+
export const PERSONA_LLM_PROVIDER_OPTIONS: readonly PersonaModelOption[] = [
116116
{ id: "anthropic", label: "Anthropic" },
117117
{ id: "openai", label: "OpenAI" },
118118
{ id: "openai-compat", label: "OpenAI-compatible" },

0 commit comments

Comments
 (0)