@chai-ui/vue 0.11.2 → 0.11.4
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/dist/Composer.vue.d.ts +3 -3
- package/dist/Composer.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -30
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Composer.vue +20 -23
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chai-ui/vue",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "Chai UI Vue components — smart, drop-in UI for AI apps: Composer, Media Analyzer, Result Card, Edit Card, and the useComposer composable.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kazarazat",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@fontsource/roboto": "^5.3.0",
|
|
49
49
|
"@material/web": "^2.5.0",
|
|
50
|
-
"@chai-ui/core": "0.11.
|
|
51
|
-
"@chai-ui/tokens": "0.11.
|
|
50
|
+
"@chai-ui/core": "0.11.4",
|
|
51
|
+
"@chai-ui/tokens": "0.11.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@vitejs/plugin-vue": "^6.0.9",
|
package/src/Composer.vue
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type GenerationUseCase,
|
|
28
28
|
type ComposerSubmitPayload,
|
|
29
29
|
type ComposerUseCase,
|
|
30
|
+
type ComposerView,
|
|
30
31
|
type EditRegion,
|
|
31
32
|
type MediaKind,
|
|
32
33
|
type MenuPlacement,
|
|
@@ -58,13 +59,13 @@ const props = withDefaults(
|
|
|
58
59
|
onClearUseCase?: () => void;
|
|
59
60
|
/** What a submit means with no use case picked. Defaults to `TEXT_USE_CASE`. Never shown as a chip. */
|
|
60
61
|
defaultUseCase?: ComposerUseCase;
|
|
61
|
-
/**
|
|
62
|
+
/** Image and Video from one prompt, with `useCases`, `modelsByKind` and `modelIds`: a Model menu each, and a model picked by hand in each (no auto-select). Other use cases run alone (`nextUseCases`). */
|
|
62
63
|
multiSelectUseCases?: boolean;
|
|
63
64
|
useCases?: ComposerUseCase[];
|
|
64
65
|
"onUpdate:useCases"?: (next: ComposerUseCase[]) => void;
|
|
65
66
|
/** Models per use-case kind, for `multiSelectUseCases`. A kind left out gets Chai's suggested models. */
|
|
66
67
|
modelsByKind?: Partial<Record<OutputKind, ModelOption[]>>;
|
|
67
|
-
/** The end user can pick several models, each producing its own result, with `modelIds`. */
|
|
68
|
+
/** The end user can pick several models, each producing its own result, with `modelIds`. With `multiSelectUseCases`, several per use case. */
|
|
68
69
|
multiSelectModels?: boolean;
|
|
69
70
|
modelIds?: string[];
|
|
70
71
|
"onUpdate:modelIds"?: (ids: string[]) => void;
|
|
@@ -72,7 +73,7 @@ const props = withDefaults(
|
|
|
72
73
|
models?: ModelOption[];
|
|
73
74
|
modelId?: string | null;
|
|
74
75
|
"onUpdate:modelId"?: (id: string | null) => void;
|
|
75
|
-
/** The model is chosen at submit: `useComposer` asks the reasoning model. Turning it on clears the pick. */
|
|
76
|
+
/** The model is chosen at submit: `useComposer` asks the reasoning model. Turning it on clears the pick. Ignored with `multiSelectUseCases`. */
|
|
76
77
|
autoSelectModel?: boolean;
|
|
77
78
|
/** An "Auto-select model" switch at the top of the Model menu, for the end user. */
|
|
78
79
|
showAutoSelectToggle?: boolean;
|
|
@@ -166,11 +167,6 @@ const menuItems = computed(() =>
|
|
|
166
167
|
canSelect: Boolean(props.onAttachMenuSelect),
|
|
167
168
|
})
|
|
168
169
|
);
|
|
169
|
-
const modelMenuOptions = computed(() =>
|
|
170
|
-
props.multiSelectUseCases
|
|
171
|
-
? { sections: view.value.modelSections.map((s) => ({ label: s.label, options: s.options })) }
|
|
172
|
-
: { options: view.value.modelSections[0]?.options }
|
|
173
|
-
);
|
|
174
170
|
const toMenuOption = (o: { value: string; label: string }) => ({ id: o.value, label: o.label });
|
|
175
171
|
const voiceMenuOptions = computed(() =>
|
|
176
172
|
view.value.voiceSections
|
|
@@ -181,7 +177,7 @@ const voiceMenuOptions = computed(() =>
|
|
|
181
177
|
// Auto-select chooses at submit, so turning it on clears the current pick
|
|
182
178
|
// and the trigger reads "Auto-select" until routing fills in the model.
|
|
183
179
|
watch(
|
|
184
|
-
() =>
|
|
180
|
+
() => view.value.autoSelectModel,
|
|
185
181
|
(on, was) => {
|
|
186
182
|
if (!on || was) return;
|
|
187
183
|
if (view.value.multiModel) props["onUpdate:modelIds"]?.([]);
|
|
@@ -199,8 +195,8 @@ watch(
|
|
|
199
195
|
}
|
|
200
196
|
);
|
|
201
197
|
|
|
202
|
-
function
|
|
203
|
-
if (view.value.multiModel) props["onUpdate:modelIds"]?.(
|
|
198
|
+
function pickModel(menu: ComposerView["modelMenus"][number], id: string) {
|
|
199
|
+
if (view.value.multiModel) props["onUpdate:modelIds"]?.(menu.next(id));
|
|
204
200
|
else props["onUpdate:modelId"]?.(id);
|
|
205
201
|
}
|
|
206
202
|
|
|
@@ -338,25 +334,26 @@ function onSubmitClick() {
|
|
|
338
334
|
@remove="removeUseCase(u)"
|
|
339
335
|
/>
|
|
340
336
|
|
|
341
|
-
<!-- The auto-select switch lives inside
|
|
337
|
+
<!-- One Model menu, or one per use case with multi-use-case select. The auto-select switch lives inside each, so with it shown the trigger stays enabled: it's the only way back to the switch. -->
|
|
342
338
|
<SearchMenu
|
|
339
|
+
v-for="menu in view.canPickModel ? view.modelMenus : []"
|
|
340
|
+
:key="menu.key"
|
|
343
341
|
:placement="menuPlacement"
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
:
|
|
347
|
-
:multiple="view.multiModel"
|
|
342
|
+
:options="menu.options"
|
|
343
|
+
:value="menu.value"
|
|
344
|
+
:multiple="menu.multiple"
|
|
348
345
|
:toggle-header="
|
|
349
|
-
showAutoSelectToggle
|
|
350
|
-
? { label: 'Auto-select model', value: autoSelectModel, onChange: (v: boolean) => props['onUpdate:autoSelectModel']?.(v) }
|
|
346
|
+
showAutoSelectToggle && view.offersAutoSelect
|
|
347
|
+
? { label: 'Auto-select model', value: view.autoSelectModel, onChange: (v: boolean) => props['onUpdate:autoSelectModel']?.(v) }
|
|
351
348
|
: undefined
|
|
352
349
|
"
|
|
353
|
-
:trigger-label="
|
|
354
|
-
:menu-label="
|
|
350
|
+
:trigger-label="menu.triggerLabel"
|
|
351
|
+
:menu-label="menu.menuLabel"
|
|
355
352
|
:searchable="false"
|
|
356
353
|
trigger-variant="text"
|
|
357
|
-
:disabled="disabled || (autoSelectModel && !showAutoSelectToggle)"
|
|
358
|
-
:panel-width="showAutoSelectToggle ? 320 : undefined"
|
|
359
|
-
@select="
|
|
354
|
+
:disabled="disabled || (view.autoSelectModel && !(showAutoSelectToggle && view.offersAutoSelect))"
|
|
355
|
+
:panel-width="showAutoSelectToggle && view.offersAutoSelect ? 320 : undefined"
|
|
356
|
+
@select="pickModel(menu, $event.id)"
|
|
360
357
|
/>
|
|
361
358
|
|
|
362
359
|
<SearchMenu
|