@oxy.so/bloom 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/adoption-matrix.mdx +2 -2
- package/docs/ai-chat.mdx +31 -3
- package/docs/composer-panel.mdx +23 -6
- package/lib/commonjs/ai-chat/AiChatContainer.js +122 -14
- package/lib/commonjs/ai-chat/AiChatContainer.js.map +1 -1
- package/lib/commonjs/ai-chat/AiChatShell.js +46 -6
- package/lib/commonjs/ai-chat/AiChatShell.js.map +1 -1
- package/lib/commonjs/ai-chat/context.js +5 -1
- package/lib/commonjs/ai-chat/context.js.map +1 -1
- package/lib/commonjs/ai-chat/index.js +7 -0
- package/lib/commonjs/ai-chat/index.js.map +1 -1
- package/lib/commonjs/ai-chat/index.web.js +7 -0
- package/lib/commonjs/ai-chat/index.web.js.map +1 -1
- package/lib/commonjs/composer-panel/ComposerControls.js +61 -0
- package/lib/commonjs/composer-panel/ComposerControls.js.map +1 -1
- package/lib/commonjs/composer-panel/ComposerPanelBase.js +12 -4
- package/lib/commonjs/composer-panel/ComposerPanelBase.js.map +1 -1
- package/lib/commonjs/composer-panel/ComposerPillBase.js +114 -79
- package/lib/commonjs/composer-panel/ComposerPillBase.js.map +1 -1
- package/lib/commonjs/composer-panel/EffortSlider.js +24 -15
- package/lib/commonjs/composer-panel/EffortSlider.js.map +1 -1
- package/lib/commonjs/composer-panel/ModelPickerBase.js +15 -4
- package/lib/commonjs/composer-panel/ModelPickerBase.js.map +1 -1
- package/lib/module/ai-chat/AiChatContainer.js +122 -14
- package/lib/module/ai-chat/AiChatContainer.js.map +1 -1
- package/lib/module/ai-chat/AiChatShell.js +46 -6
- package/lib/module/ai-chat/AiChatShell.js.map +1 -1
- package/lib/module/ai-chat/context.js +5 -1
- package/lib/module/ai-chat/context.js.map +1 -1
- package/lib/module/ai-chat/index.js +1 -0
- package/lib/module/ai-chat/index.js.map +1 -1
- package/lib/module/ai-chat/index.web.js +1 -0
- package/lib/module/ai-chat/index.web.js.map +1 -1
- package/lib/module/composer-panel/ComposerControls.js +60 -0
- package/lib/module/composer-panel/ComposerControls.js.map +1 -1
- package/lib/module/composer-panel/ComposerPanelBase.js +13 -5
- package/lib/module/composer-panel/ComposerPanelBase.js.map +1 -1
- package/lib/module/composer-panel/ComposerPillBase.js +115 -80
- package/lib/module/composer-panel/ComposerPillBase.js.map +1 -1
- package/lib/module/composer-panel/EffortSlider.js +24 -15
- package/lib/module/composer-panel/EffortSlider.js.map +1 -1
- package/lib/module/composer-panel/ModelPickerBase.js +15 -4
- package/lib/module/composer-panel/ModelPickerBase.js.map +1 -1
- package/lib/typescript/commonjs/ai-chat/AiChatContainer.d.ts +28 -5
- package/lib/typescript/commonjs/ai-chat/AiChatContainer.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/AiChatShell.d.ts +11 -2
- package/lib/typescript/commonjs/ai-chat/AiChatShell.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/context.d.ts +19 -1
- package/lib/typescript/commonjs/ai-chat/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/index.d.ts +3 -1
- package/lib/typescript/commonjs/ai-chat/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/index.web.d.ts +3 -1
- package/lib/typescript/commonjs/ai-chat/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/types.d.ts +101 -3
- package/lib/typescript/commonjs/ai-chat/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/composer-panel/ComposerControls.d.ts +14 -0
- package/lib/typescript/commonjs/composer-panel/ComposerControls.d.ts.map +1 -1
- package/lib/typescript/commonjs/composer-panel/ComposerPanelBase.d.ts +3 -2
- package/lib/typescript/commonjs/composer-panel/ComposerPanelBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/composer-panel/ComposerPillBase.d.ts +3 -2
- package/lib/typescript/commonjs/composer-panel/ComposerPillBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/composer-panel/EffortSlider.d.ts +10 -2
- package/lib/typescript/commonjs/composer-panel/EffortSlider.d.ts.map +1 -1
- package/lib/typescript/commonjs/composer-panel/ModelPickerBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/composer-panel/types.d.ts +61 -20
- package/lib/typescript/commonjs/composer-panel/types.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/AiChatContainer.d.ts +28 -5
- package/lib/typescript/module/ai-chat/AiChatContainer.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/AiChatShell.d.ts +11 -2
- package/lib/typescript/module/ai-chat/AiChatShell.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/context.d.ts +19 -1
- package/lib/typescript/module/ai-chat/context.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/index.d.ts +3 -1
- package/lib/typescript/module/ai-chat/index.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/index.web.d.ts +3 -1
- package/lib/typescript/module/ai-chat/index.web.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/types.d.ts +101 -3
- package/lib/typescript/module/ai-chat/types.d.ts.map +1 -1
- package/lib/typescript/module/composer-panel/ComposerControls.d.ts +14 -0
- package/lib/typescript/module/composer-panel/ComposerControls.d.ts.map +1 -1
- package/lib/typescript/module/composer-panel/ComposerPanelBase.d.ts +3 -2
- package/lib/typescript/module/composer-panel/ComposerPanelBase.d.ts.map +1 -1
- package/lib/typescript/module/composer-panel/ComposerPillBase.d.ts +3 -2
- package/lib/typescript/module/composer-panel/ComposerPillBase.d.ts.map +1 -1
- package/lib/typescript/module/composer-panel/EffortSlider.d.ts +10 -2
- package/lib/typescript/module/composer-panel/EffortSlider.d.ts.map +1 -1
- package/lib/typescript/module/composer-panel/ModelPickerBase.d.ts.map +1 -1
- package/lib/typescript/module/composer-panel/types.d.ts +61 -20
- package/lib/typescript/module/composer-panel/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/support/adoption-matrix.ts +664 -0
- package/src/__tests__/support/collision-fixture-barrel.ts +20 -0
- package/src/__tests__/support/composite.ts +68 -0
- package/src/__tests__/support/constructed-style-sheets.ts +68 -0
- package/src/__tests__/support/press-host.ts +30 -0
- package/src/__tests__/support/rendered-style.ts +99 -0
- package/src/__tests__/support/unread-hook-fixture.ts +33 -0
- package/src/ai-chat/AiChatContainer.tsx +137 -16
- package/src/ai-chat/AiChatShell.tsx +59 -5
- package/src/ai-chat/context.ts +19 -1
- package/src/ai-chat/index.ts +3 -0
- package/src/ai-chat/index.web.ts +3 -0
- package/src/ai-chat/types.ts +104 -3
- package/src/composer-panel/ComposerControls.tsx +54 -0
- package/src/composer-panel/ComposerPanelBase.tsx +13 -5
- package/src/composer-panel/ComposerPillBase.tsx +101 -59
- package/src/composer-panel/EffortSlider.tsx +38 -18
- package/src/composer-panel/ModelPickerBase.tsx +23 -7
- package/src/composer-panel/types.ts +61 -20
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +7682 -0
- package/src/theme/__tests__/fixtures/color-engine-golden.json +1 -0
|
@@ -9,10 +9,13 @@ const TRACK_HEIGHT = 27;
|
|
|
9
9
|
const THUMB_WIDTH = 21;
|
|
10
10
|
|
|
11
11
|
interface EffortSliderProps {
|
|
12
|
-
|
|
12
|
+
/** The chosen stop, or `null` for no choice yet. */
|
|
13
|
+
value: number | null;
|
|
13
14
|
onChange: (value: number) => void;
|
|
14
15
|
levels: ReadonlyArray<string>;
|
|
15
16
|
label: string;
|
|
17
|
+
/** What `aria-valuetext` reads with no stop chosen (the "Auto" label). */
|
|
18
|
+
unsetLabel: string;
|
|
16
19
|
palette: ComposerPalette;
|
|
17
20
|
testID?: string;
|
|
18
21
|
}
|
|
@@ -25,6 +28,11 @@ interface EffortSliderProps {
|
|
|
25
28
|
* past the value fade their tick to 30% over 300ms; the fill follows the thumb
|
|
26
29
|
* over 150ms.
|
|
27
30
|
*
|
|
31
|
+
* With `value` `null` nothing is committed: the fill is empty, every tick is
|
|
32
|
+
* faded and the thumb is hollow and dashed, so "no stop chosen" cannot be read
|
|
33
|
+
* as "the first stop". The first press or key commits a stop, and there is no
|
|
34
|
+
* way back — the caller owns the `null`.
|
|
35
|
+
*
|
|
28
36
|
* Drag or press anywhere on the track (PanResponder on both platforms); on web
|
|
29
37
|
* the thumb is focusable and answers the arrow keys, Home and End.
|
|
30
38
|
*
|
|
@@ -32,20 +40,25 @@ interface EffortSliderProps {
|
|
|
32
40
|
* starfield, with the ticks blown off the track) has no native counterpart,
|
|
33
41
|
* so at Max the slider simply rests at its last stop.
|
|
34
42
|
*/
|
|
35
|
-
export function EffortSlider({ value, onChange, levels, label, palette, testID }: EffortSliderProps) {
|
|
43
|
+
export function EffortSlider({ value, onChange, levels, label, unsetLabel, palette, testID }: EffortSliderProps) {
|
|
36
44
|
const [width, setWidth] = useState(0);
|
|
37
45
|
const max = Math.max(0, levels.length - 1);
|
|
38
|
-
const
|
|
39
|
-
const fraction = max > 0 ?
|
|
46
|
+
const chosen = value === null ? null : Math.min(Math.max(value, 0), max);
|
|
47
|
+
const fraction = chosen !== null && max > 0 ? chosen / max : 0;
|
|
40
48
|
const rail = Math.max(0, width - THUMB_WIDTH);
|
|
41
49
|
|
|
42
|
-
const stateRef = useRef
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
const stateRef = useRef<{ value: number | null; rail: number; max: number; onChange: (next: number) => void }>({
|
|
51
|
+
value: chosen,
|
|
52
|
+
rail,
|
|
53
|
+
max,
|
|
54
|
+
onChange,
|
|
55
|
+
});
|
|
56
|
+
stateRef.current = { value: chosen, rail, max, onChange };
|
|
57
|
+
const startRef = useRef(chosen ?? 0);
|
|
45
58
|
|
|
46
59
|
const valueAt = useCallback((x: number) => {
|
|
47
60
|
const s = stateRef.current;
|
|
48
|
-
if (s.rail <= 0 || s.max <= 0) return s.value;
|
|
61
|
+
if (s.rail <= 0 || s.max <= 0) return s.value ?? 0;
|
|
49
62
|
const f = Math.min(Math.max((x - THUMB_WIDTH / 2) / s.rail, 0), 1);
|
|
50
63
|
return Math.round(f * s.max);
|
|
51
64
|
}, []);
|
|
@@ -83,11 +96,17 @@ export function EffortSlider({ value, onChange, levels, label, palette, testID }
|
|
|
83
96
|
tabIndex: 0,
|
|
84
97
|
onKeyDown: (event: { key: string; preventDefault: () => void }) => {
|
|
85
98
|
const s = stateRef.current;
|
|
99
|
+
// With nothing chosen, either arrow commits the first stop.
|
|
100
|
+
const current = s.value;
|
|
86
101
|
const next =
|
|
87
102
|
event.key === 'ArrowRight' || event.key === 'ArrowUp'
|
|
88
|
-
?
|
|
103
|
+
? current === null
|
|
104
|
+
? 0
|
|
105
|
+
: Math.min(s.max, current + 1)
|
|
89
106
|
: event.key === 'ArrowLeft' || event.key === 'ArrowDown'
|
|
90
|
-
?
|
|
107
|
+
? current === null
|
|
108
|
+
? 0
|
|
109
|
+
: Math.max(0, current - 1)
|
|
91
110
|
: event.key === 'Home'
|
|
92
111
|
? 0
|
|
93
112
|
: event.key === 'End'
|
|
@@ -108,9 +127,10 @@ export function EffortSlider({ value, onChange, levels, label, palette, testID }
|
|
|
108
127
|
height: TRACK_HEIGHT,
|
|
109
128
|
borderRadius: 7,
|
|
110
129
|
borderWidth: 1,
|
|
130
|
+
borderStyle: chosen === null ? 'dashed' : 'solid',
|
|
111
131
|
borderColor: palette.thumbBorder,
|
|
112
|
-
backgroundColor: palette.surface,
|
|
113
|
-
boxShadow: palette.shadowXs,
|
|
132
|
+
backgroundColor: chosen === null ? 'transparent' : palette.surface,
|
|
133
|
+
boxShadow: chosen === null ? undefined : palette.shadowXs,
|
|
114
134
|
'--bloom-composer-ring': palette.focusRing,
|
|
115
135
|
};
|
|
116
136
|
|
|
@@ -121,12 +141,12 @@ export function EffortSlider({ value, onChange, levels, label, palette, testID }
|
|
|
121
141
|
accessibilityLabel={label}
|
|
122
142
|
aria-valuemin={0}
|
|
123
143
|
aria-valuemax={max}
|
|
124
|
-
aria-valuenow={
|
|
125
|
-
aria-valuetext={levels[
|
|
144
|
+
aria-valuenow={chosen ?? undefined}
|
|
145
|
+
aria-valuetext={chosen === null ? unsetLabel : levels[chosen]}
|
|
126
146
|
accessibilityActions={[{ name: 'increment' }, { name: 'decrement' }]}
|
|
127
147
|
onAccessibilityAction={(event) => {
|
|
128
|
-
if (event.nativeEvent.actionName === 'increment') commit(Math.min(max,
|
|
129
|
-
if (event.nativeEvent.actionName === 'decrement') commit(Math.max(0,
|
|
148
|
+
if (event.nativeEvent.actionName === 'increment') commit(chosen === null ? 0 : Math.min(max, chosen + 1));
|
|
149
|
+
if (event.nativeEvent.actionName === 'decrement') commit(chosen === null ? 0 : Math.max(0, chosen - 1));
|
|
130
150
|
}}
|
|
131
151
|
style={{ width: '100%' }}>
|
|
132
152
|
<View
|
|
@@ -149,7 +169,7 @@ export function EffortSlider({ value, onChange, levels, label, palette, testID }
|
|
|
149
169
|
top: 0,
|
|
150
170
|
bottom: 0,
|
|
151
171
|
left: 0,
|
|
152
|
-
width: fraction * rail + THUMB_WIDTH,
|
|
172
|
+
width: chosen === null ? 0 : fraction * rail + THUMB_WIDTH,
|
|
153
173
|
borderRadius: 8,
|
|
154
174
|
backgroundColor: palette.tertiaryHover,
|
|
155
175
|
}}
|
|
@@ -175,7 +195,7 @@ export function EffortSlider({ value, onChange, levels, label, palette, testID }
|
|
|
175
195
|
height: 13,
|
|
176
196
|
borderRadius: 2,
|
|
177
197
|
backgroundColor: palette.iconTertiary,
|
|
178
|
-
opacity: index >
|
|
198
|
+
opacity: chosen === null || index > chosen ? 0.3 : 1,
|
|
179
199
|
}}
|
|
180
200
|
/>
|
|
181
201
|
))}
|
|
@@ -57,6 +57,7 @@ const DEFAULT_LABELS: Required<ModelPickerLabels> = {
|
|
|
57
57
|
noMatches: 'No models match',
|
|
58
58
|
providers: 'Providers',
|
|
59
59
|
effort: 'Effort',
|
|
60
|
+
effortAuto: 'Auto',
|
|
60
61
|
faster: 'Faster',
|
|
61
62
|
smarter: 'Smarter',
|
|
62
63
|
};
|
|
@@ -218,6 +219,11 @@ function BlurInLevel({ level, palette }: { level: string; palette: ComposerPalet
|
|
|
218
219
|
);
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
/**
|
|
223
|
+
* The effort chip on the checked row. Drawn only where there are stops to
|
|
224
|
+
* choose from — a model with no effort axis gets no chip, rather than an empty
|
|
225
|
+
* one over a slider that cannot commit.
|
|
226
|
+
*/
|
|
221
227
|
function EffortMenu({
|
|
222
228
|
value,
|
|
223
229
|
onChange,
|
|
@@ -225,7 +231,7 @@ function EffortMenu({
|
|
|
225
231
|
labels,
|
|
226
232
|
palette,
|
|
227
233
|
}: {
|
|
228
|
-
value: number;
|
|
234
|
+
value: number | null;
|
|
229
235
|
onChange: (next: number) => void;
|
|
230
236
|
levels: ReadonlyArray<string>;
|
|
231
237
|
labels: Required<ModelPickerLabels>;
|
|
@@ -235,7 +241,7 @@ function EffortMenu({
|
|
|
235
241
|
const triggerRef = useRef<View>(null);
|
|
236
242
|
const [open, setOpen] = useState(false);
|
|
237
243
|
const [hovered, setHovered] = useState(false);
|
|
238
|
-
const level =
|
|
244
|
+
const level = value === null ? labels.effortAuto : (levels[value] ?? labels.effortAuto);
|
|
239
245
|
|
|
240
246
|
const chipStyle: WebCssStyle = {
|
|
241
247
|
flexShrink: 0,
|
|
@@ -314,7 +320,14 @@ function EffortMenu({
|
|
|
314
320
|
</Text>
|
|
315
321
|
</View>
|
|
316
322
|
<View style={{ paddingLeft: 8, paddingRight: 8, paddingBottom: 8 }}>
|
|
317
|
-
<EffortSlider
|
|
323
|
+
<EffortSlider
|
|
324
|
+
value={value}
|
|
325
|
+
onChange={onChange}
|
|
326
|
+
levels={levels}
|
|
327
|
+
label={labels.effort}
|
|
328
|
+
unsetLabel={labels.effortAuto}
|
|
329
|
+
palette={palette}
|
|
330
|
+
/>
|
|
318
331
|
</View>
|
|
319
332
|
</View>
|
|
320
333
|
</View>
|
|
@@ -388,7 +401,7 @@ function ModelRow({
|
|
|
388
401
|
{searching ? <InlineAside color={palette.textTertiary}>{provider.name}</InlineAside> : null}
|
|
389
402
|
</Text>
|
|
390
403
|
</View>
|
|
391
|
-
{
|
|
404
|
+
{effort ? <View style={{ flexShrink: 0, flexDirection: 'row' }}>{effort}</View> : null}
|
|
392
405
|
</View>
|
|
393
406
|
<View pointerEvents="none">
|
|
394
407
|
<RadioIndicator selected={checked} size={14} />
|
|
@@ -447,10 +460,13 @@ export function ModelPickerBase({
|
|
|
447
460
|
defaultValue: defaultValue ?? providers[0]?.models[0]?.id ?? '',
|
|
448
461
|
onChange: onValueChange,
|
|
449
462
|
});
|
|
450
|
-
const [effortValue, setEffort] = useControllableState<number>({
|
|
463
|
+
const [effortValue, setEffort] = useControllableState<number | null>({
|
|
451
464
|
value: effort,
|
|
452
465
|
defaultValue: defaultEffort,
|
|
453
|
-
|
|
466
|
+
// The picker can only ever land on a stop; `null` is the caller's to hold.
|
|
467
|
+
onChange: (next) => {
|
|
468
|
+
if (next !== null) onEffortChange?.(next);
|
|
469
|
+
},
|
|
454
470
|
});
|
|
455
471
|
|
|
456
472
|
const selected: Match | null =
|
|
@@ -724,7 +740,7 @@ export function ModelPickerBase({
|
|
|
724
740
|
}
|
|
725
741
|
}}
|
|
726
742
|
effort={
|
|
727
|
-
checked ? (
|
|
743
|
+
checked && effortLevels.length > 0 ? (
|
|
728
744
|
<EffortMenu
|
|
729
745
|
value={effortValue}
|
|
730
746
|
onChange={setEffort}
|
|
@@ -121,6 +121,8 @@ export interface ModelPickerLabels {
|
|
|
121
121
|
providers?: string;
|
|
122
122
|
/** Default `'Effort'`. */
|
|
123
123
|
effort?: string;
|
|
124
|
+
/** Default `'Auto'` — the effort chip with no stop chosen. */
|
|
125
|
+
effortAuto?: string;
|
|
124
126
|
/** Default `'Faster'`. */
|
|
125
127
|
faster?: string;
|
|
126
128
|
/** Default `'Smarter'`. */
|
|
@@ -135,12 +137,17 @@ export interface ModelPickerProps {
|
|
|
135
137
|
/** Initial model id when uncontrolled. Defaults to the first provider's first model. */
|
|
136
138
|
defaultValue?: string;
|
|
137
139
|
onValueChange?: (modelId: string) => void;
|
|
138
|
-
/**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Controlled effort stop, an index into `effortLevels`. `null` is "no stop
|
|
142
|
+
* chosen" — the chip reads `labels.effortAuto`, the slider commits nothing and
|
|
143
|
+
* the thumb is drawn hollow, so the absence of a choice never looks like one.
|
|
144
|
+
*/
|
|
145
|
+
effort?: number | null;
|
|
146
|
+
/** Initial stop when uncontrolled. Default `1` ("Medium"); `null` for no choice. */
|
|
147
|
+
defaultEffort?: number | null;
|
|
148
|
+
/** A stop the reader chose. The picker has no way back to `null`, so it never reports one. */
|
|
142
149
|
onEffortChange?: (effort: number) => void;
|
|
143
|
-
/** The effort stops, "Faster" → "Smarter". Defaults to six stops. */
|
|
150
|
+
/** The effort stops, "Faster" → "Smarter". Defaults to six stops; `[]` drops the effort axis entirely. */
|
|
144
151
|
effortLevels?: ReadonlyArray<string>;
|
|
145
152
|
labels?: ModelPickerLabels;
|
|
146
153
|
style?: StyleProp<ViewStyle>;
|
|
@@ -169,6 +176,8 @@ export interface ComposerPanelLabels {
|
|
|
169
176
|
voice?: string;
|
|
170
177
|
/** Default `'Send message'`. */
|
|
171
178
|
send?: string;
|
|
179
|
+
/** Default `'Stop generating'` — send's stop state while `busy`. */
|
|
180
|
+
stop?: string;
|
|
172
181
|
/** Default `'Remove'` — prefixed to the file name on a tile's dismiss. */
|
|
173
182
|
remove?: string;
|
|
174
183
|
}
|
|
@@ -181,7 +190,15 @@ export interface ComposerPanelProps {
|
|
|
181
190
|
onValueChange?: (value: string) => void;
|
|
182
191
|
/** Fires on the send button and on Enter (web; Shift+Enter breaks the line). */
|
|
183
192
|
onSubmit?: (value: string) => void;
|
|
184
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Stop the turn in flight. With `busy`, send becomes a stop control that
|
|
195
|
+
* ignores `disabled` — cancelling has to stay possible while typing is not.
|
|
196
|
+
* Without a handler `busy` draws no stop, so the control is never inert.
|
|
197
|
+
*/
|
|
198
|
+
onStop?: () => void;
|
|
199
|
+
/** A turn is running: send becomes stop (given `onStop`) and Enter no longer submits. */
|
|
200
|
+
busy?: boolean;
|
|
201
|
+
/** Greys out send while a turn is in flight. Never reaches the stop control. */
|
|
185
202
|
disabled?: boolean;
|
|
186
203
|
/** Default `'Hi, what do you need today?'`. */
|
|
187
204
|
placeholder?: string;
|
|
@@ -207,10 +224,11 @@ export interface ComposerPanelProps {
|
|
|
207
224
|
model?: string;
|
|
208
225
|
defaultModel?: string;
|
|
209
226
|
onModelChange?: (modelId: string) => void;
|
|
210
|
-
/** Controlled effort stop. */
|
|
211
|
-
effort?: number;
|
|
212
|
-
defaultEffort?: number;
|
|
227
|
+
/** Controlled effort stop; `null` is "no stop chosen". See `ModelPicker`. */
|
|
228
|
+
effort?: number | null;
|
|
229
|
+
defaultEffort?: number | null;
|
|
213
230
|
onEffortChange?: (effort: number) => void;
|
|
231
|
+
/** `[]` drops the effort axis from the picker. */
|
|
214
232
|
effortLevels?: ReadonlyArray<string>;
|
|
215
233
|
modelPickerLabels?: ModelPickerLabels;
|
|
216
234
|
|
|
@@ -293,6 +311,8 @@ export interface ComposerPillLabels {
|
|
|
293
311
|
modelGroup?: string;
|
|
294
312
|
/** Default `'Effort'`. */
|
|
295
313
|
effort?: string;
|
|
314
|
+
/** Default `'Auto'` — the effort value with no stop chosen. */
|
|
315
|
+
effortAuto?: string;
|
|
296
316
|
/** Default `'Faster'`. */
|
|
297
317
|
faster?: string;
|
|
298
318
|
/** Default `'Smarter'`. */
|
|
@@ -301,6 +321,8 @@ export interface ComposerPillLabels {
|
|
|
301
321
|
voice?: string;
|
|
302
322
|
/** Default `'Send message'`. */
|
|
303
323
|
send?: string;
|
|
324
|
+
/** Default `'Stop generating'` — send's stop state while `busy`. */
|
|
325
|
+
stop?: string;
|
|
304
326
|
}
|
|
305
327
|
|
|
306
328
|
export interface ComposerPillProps {
|
|
@@ -311,7 +333,15 @@ export interface ComposerPillProps {
|
|
|
311
333
|
onValueChange?: (value: string) => void;
|
|
312
334
|
/** Fires on the send button and on Enter. */
|
|
313
335
|
onSubmit?: (value: string) => void;
|
|
314
|
-
/**
|
|
336
|
+
/**
|
|
337
|
+
* Stop the turn in flight. With `busy`, send becomes a stop control that
|
|
338
|
+
* ignores `disabled` — cancelling has to stay possible while typing is not.
|
|
339
|
+
* Without a handler `busy` draws no stop, so the control is never inert.
|
|
340
|
+
*/
|
|
341
|
+
onStop?: () => void;
|
|
342
|
+
/** A turn is running: send becomes stop (given `onStop`) and Enter no longer submits. */
|
|
343
|
+
busy?: boolean;
|
|
344
|
+
/** Greys out send (40%) while a turn is in flight. Never reaches the stop control. */
|
|
315
345
|
disabled?: boolean;
|
|
316
346
|
/** Default `'Ask me anything'`. */
|
|
317
347
|
placeholder?: string;
|
|
@@ -322,19 +352,30 @@ export interface ComposerPillProps {
|
|
|
322
352
|
addMenu?: ReadonlyArray<ComposerPanelAddMenuGroup>;
|
|
323
353
|
onAddMenuSelect?: (rowId: string) => void;
|
|
324
354
|
|
|
325
|
-
/**
|
|
326
|
-
|
|
327
|
-
|
|
355
|
+
/**
|
|
356
|
+
* The model menu's lineup. Omit to hide the model button.
|
|
357
|
+
*
|
|
358
|
+
* `{ id, name }` entries are the identity contract `ModelPicker` uses: the
|
|
359
|
+
* menu keys, matches and reports the **id**, and draws the `name`. A bare
|
|
360
|
+
* string is shorthand for `{ id: name, name }` — kept so the display-name form
|
|
361
|
+
* still works, and the only form in which a routing id is a display string.
|
|
362
|
+
*/
|
|
363
|
+
models?: ReadonlyArray<string | ModelPickerModel>;
|
|
364
|
+
/** Controlled model **id** (a string entry's id is its name). */
|
|
328
365
|
model?: string;
|
|
329
|
-
/** Initial model when uncontrolled. Default the first. */
|
|
366
|
+
/** Initial model id when uncontrolled. Default the first entry's. */
|
|
330
367
|
defaultModel?: string;
|
|
331
|
-
onModelChange?: (
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
368
|
+
onModelChange?: (modelId: string) => void;
|
|
369
|
+
/**
|
|
370
|
+
* Controlled effort stop, an index into `effortLevels`. `null` is "no stop
|
|
371
|
+
* chosen" — the value reads `labels.effortAuto` and the thumb is drawn hollow.
|
|
372
|
+
*/
|
|
373
|
+
effort?: number | null;
|
|
374
|
+
/** Default `1` ("Medium"); `null` for no choice. */
|
|
375
|
+
defaultEffort?: number | null;
|
|
376
|
+
/** A stop the reader chose. The menu has no way back to `null`, so it never reports one. */
|
|
336
377
|
onEffortChange?: (effort: number) => void;
|
|
337
|
-
/** Default `MODEL_PICKER_EFFORT_LEVELS
|
|
378
|
+
/** Default `MODEL_PICKER_EFFORT_LEVELS`; `[]` drops the effort half of the menu. */
|
|
338
379
|
effortLevels?: ReadonlyArray<string>;
|
|
339
380
|
|
|
340
381
|
/** Controlled voice-input state (the mic swaps to equalizer bars). */
|