@chai-ui/vue 0.13.0 → 0.14.1
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/DESIGN.md +3 -1
- package/README.md +3 -0
- package/dist/Composer.vue.d.ts +3 -1
- package/dist/Composer.vue.d.ts.map +1 -1
- package/dist/ResultCard.vue.d.ts +3 -1
- package/dist/ResultCard.vue.d.ts.map +1 -1
- package/dist/composer/PromptField.vue.d.ts +2 -0
- package/dist/composer/PromptField.vue.d.ts.map +1 -1
- package/dist/composer/VoiceButton.vue.d.ts +1 -0
- package/dist/composer/VoiceButton.vue.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -25
- package/dist/index.js.map +1 -1
- package/dist/style.css +16 -0
- package/package.json +3 -3
- package/src/Composer.vue +58 -9
- package/src/ResultCard.vue +40 -5
- package/src/composer/PromptField.vue +3 -0
- package/src/composer/VoiceButton.vue +2 -1
- package/src/index.ts +4 -0
package/DESIGN.md
CHANGED
|
@@ -36,7 +36,8 @@ use these names: `Results`, `Compare`, `ModelPicker`,
|
|
|
36
36
|
your app.
|
|
37
37
|
3. **Advanced selection is the builder's opt-in.** `multiSelectModels`
|
|
38
38
|
and `multiSelectUseCases` are off by default. Turn them on only where
|
|
39
|
-
comparing models or making
|
|
39
|
+
comparing models, or making an image and a video from one prompt, is the
|
|
40
|
+
point. With both use cases, show each run in its own `ResultCard`.
|
|
40
41
|
4. **A callback's presence is the opt-in.** Omit `onEnhance` and there's
|
|
41
42
|
no optimize button. Omit `onAbort` and there's no stop button. Omit
|
|
42
43
|
`moreActions` and there's no ⋯ menu. Don't pass no-op handlers just to
|
|
@@ -171,6 +172,7 @@ Rules:
|
|
|
171
172
|
| Feedback | Like/dislike fire `onAction`, and the displayed vote comes from `getVote` | Store votes yourself |
|
|
172
173
|
| Details | The flip side shows prompt, model, tokens, cost and duration | Supply `models` so ids resolve to labels |
|
|
173
174
|
| Quality checks | Each result's `evaluations` render on the flip side: green with a check if it passed, red with a cross if it failed | Run your checks in your backend proxy and add a top-level `evaluations: [{ id, label, passed }]` field to the JSON it returns (for a stream, send it as its own `data:` chunk). The built-in Fal and OpenRouter engines read that field, a custom engine returns it from `generate`, and `useComposer` puts it on the matching `Result`. Or turn on the opt-in judge: `useComposer({ judgeModel, judgeChecks })` has a model you name check each text or image result against your criteria, one tag per check, after your backend's. It's off by default, with no default model, and there are no confidence scores. |
|
|
175
|
+
| Analytics | Nothing visible: `Composer` and `ResultCard` report interactions through `onEvent` (`@event` in Vue), one `ChaiEvent` each | Pass one function to each component, e.g. `(e) => posthog.capture(e.name, e.properties)`. Events are front end only (what the person did and saw), with no prompt text, file names, URLs or outputs. Track model calls, latency and cost on your server. |
|
|
174
176
|
|
|
175
177
|
`ResultCard` is where a run ends. Don't add a "use as input" action that
|
|
176
178
|
feeds a result back into a `Composer`. Chaining steps like that is
|
package/README.md
CHANGED
|
@@ -105,6 +105,9 @@ into the page. Left out, it's `"auto"`: each menu goes where it fits.
|
|
|
105
105
|
- **`ResultCard`**: one prompt's results, paged, with votes, retry,
|
|
106
106
|
download, share, details, streaming text and quality-check tags (from
|
|
107
107
|
your backend, or the opt-in judge: `useComposer({ judgeModel, judgeChecks })`).
|
|
108
|
+
- **Analytics:** `@event` on `Composer` and `ResultCard` reports what the
|
|
109
|
+
person does and sees, one `ChaiEvent` each, for any analytics tool:
|
|
110
|
+
`@event="(e) => posthog.capture(e.name, e.properties)"`.
|
|
108
111
|
- **`EditCard`**: marked regions with their own instructions, and each
|
|
109
112
|
edit as a new version.
|
|
110
113
|
- **`useComposer`**, **`ChaiProvider`**, and the `Toggle`, `SearchMenu`
|
package/dist/Composer.vue.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* while submitting) and `@attach-menu-select` (the + menu's use cases).
|
|
15
15
|
*/
|
|
16
16
|
import "@material/web/fab/fab.js";
|
|
17
|
-
import { type ComposerAttachment, type ComposerAttachMenuAction, type ComposerPromptField, type GenerationUseCase, type ComposerSubmitPayload, type ComposerUseCase, type EditRegion, type MenuPlacement, type ModelOption, type OutputKind, type ParameterOption, type VoiceInputConfig } from "@chai-ui/core";
|
|
17
|
+
import { type ComposerAttachment, type ComposerAttachMenuAction, type ComposerPromptField, type GenerationUseCase, type ComposerSubmitPayload, type ComposerUseCase, type ChaiEvent, type EditRegion, type MenuPlacement, type ModelOption, type OutputKind, type ParameterOption, type VoiceInputConfig } from "@chai-ui/core";
|
|
18
18
|
type __VLS_Props = {
|
|
19
19
|
/** The prompt text. Controlled: use `v-model`. */
|
|
20
20
|
modelValue: string;
|
|
@@ -83,6 +83,8 @@ type __VLS_Props = {
|
|
|
83
83
|
submitting?: boolean;
|
|
84
84
|
onAbort?: () => void;
|
|
85
85
|
onAttachMenuSelect?: (action: ComposerAttachMenuAction) => void;
|
|
86
|
+
/** Front-end analytics (`@event`): what the person does in the bar, one `ChaiEvent` each, for any analytics tool. No prompt text or file contents, only lengths and counts. */
|
|
87
|
+
onEvent?: (event: ChaiEvent) => void;
|
|
86
88
|
/** Which + menu items to show. Each still shows only when it can work. */
|
|
87
89
|
attachMenuActions?: ComposerAttachMenuAction[];
|
|
88
90
|
/** An edit's regions (from `useComposer`'s `edit`), shown as colored chips while editing. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Composer.vue.d.ts","sourceRoot":"","sources":["../src/Composer.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Composer.vue.d.ts","sourceRoot":"","sources":["../src/Composer.vue"],"names":[],"mappings":"AAueA;;;;;;;;;;;;;;GAcG;AACH,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAML,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,KAAK,UAAU,EAEf,KAAK,aAAa,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CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAChE,+KAA+K;IAC/K,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC/C,6FAA6F;IAC7F,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAClD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAq0BJ,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/ResultCard.vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ModelOption, type Result } from "@chai-ui/core";
|
|
1
|
+
import { type ChaiEvent, type ModelOption, type Result } from "@chai-ui/core";
|
|
2
2
|
import type { ResultCardMoreAction, ResultCardVote } from "./result-card/types.js";
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
/** The results from one prompt: `results[0]` if there's only one, paged internally if more. */
|
|
@@ -18,6 +18,8 @@ type __VLS_Props = {
|
|
|
18
18
|
/** Extra items in the ⋯ menu. Omit to hide the menu. */
|
|
19
19
|
moreActions?: ResultCardMoreAction[];
|
|
20
20
|
disabled?: boolean;
|
|
21
|
+
/** Front-end analytics (`@event`): a result appearing, result actions, paging and opening the details side, one `ChaiEvent` each. */
|
|
22
|
+
onEvent?: (event: ChaiEvent) => void;
|
|
21
23
|
};
|
|
22
24
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
25
|
action: (action: string, result: Result) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultCard.vue.d.ts","sourceRoot":"","sources":["../src/ResultCard.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResultCard.vue.d.ts","sourceRoot":"","sources":["../src/ResultCard.vue"],"names":[],"mappings":"AAsVA,OAAO,EAUL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AASvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnF,KAAK,WAAW,GAAG;IACjB,+FAA+F;IAC/F,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,uFAAuF;IACvF,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,kFAAkF;IAClF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,cAAc,CAAC;IAC7C,wDAAwD;IACxD,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qIAAqI;IACrI,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC,CAAC;AA4vBF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -8,6 +8,8 @@ type __VLS_Props = {
|
|
|
8
8
|
/** Shown under a headed field, e.g. why submit can't go yet. */
|
|
9
9
|
hint?: string | null;
|
|
10
10
|
onEnhance?: (value: string) => void;
|
|
11
|
+
/** After an Enhance, the button's "Revert to original" click. */
|
|
12
|
+
onRevert?: () => void;
|
|
11
13
|
enhancing: boolean;
|
|
12
14
|
disabled: boolean;
|
|
13
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptField.vue.d.ts","sourceRoot":"","sources":["../../src/composer/PromptField.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PromptField.vue.d.ts","sourceRoot":"","sources":["../../src/composer/PromptField.vue"],"names":[],"mappings":"AA6KA,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AA4QF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
voice: VoiceInput;
|
|
4
4
|
state: VoiceInputState;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
onStart?: () => void;
|
|
6
7
|
};
|
|
7
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
9
|
declare const _default: typeof __VLS_export;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceButton.vue.d.ts","sourceRoot":"","sources":["../../src/composer/VoiceButton.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VoiceButton.vue.d.ts","sourceRoot":"","sources":["../../src/composer/VoiceButton.vue"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGjE,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AA6F3G,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ export type { ResultCardMoreAction, ResultCardVote } from "./result-card/types.j
|
|
|
11
11
|
export * from "./reasoning.js";
|
|
12
12
|
export * from "./useComposer.js";
|
|
13
13
|
export * from "./useMediaAnalyzer.js";
|
|
14
|
-
export { createFalEngine, createFalTranscriber, createOpenRouterEngine, createMockEngine, mockEngine, buildRegionEditPrompt, DEFAULT_MAX_ATTACHMENTS_BY_KIND, DEFAULT_MAX_REGIONS, DEFAULT_MODEL_ID, DEFAULT_REASONING_MODEL, DEFAULT_REASONING_MODEL_BY_KIND, CREATE_MUSIC_USE_CASE, CREATE_SPEECH_USE_CASE, EDIT_IMAGE_USE_CASE, TEXT_USE_CASE, PRECISE_EDIT_MODELS, ROUTING_MODEL_ID, GenerationError, isMediaAnalyzerAtCap, nextMediaAnalyzerAttachments, DEFAULT_MEDIA_ANALYSIS_PROMPT_LENGTH, MEDIA_ANALYSIS_PROMPTS, MEDIA_ANALYSIS_PROMPT_LENGTHS, SUGGESTED_IMAGE_MODELS, SUGGESTED_TEXT_TO_VIDEO_MODELS, SUGGESTED_IMAGE_TO_VIDEO_MODELS, SUGGESTED_EDIT_MODELS, SUGGESTED_ANALYSIS_MODELS, reasoningModelFor, suggestedModels, promptWithGenres, checkSuggestedModels, nextUseCases, combinesWithOthers, buildJudgePrompt, DEFAULT_EVALUATION_CHECKS, } from "@chai-ui/core";
|
|
15
|
-
export type { AudioUseCase, ComposerAttachMenuAction, ComposerPromptField, ComposerAttachment, ComposerSelection, ComposerSubmitPayload, ComposerUseCase, DroppedMedia, EditRegion, EditVersion, Evaluation, EvaluationCheck, JudgePromptInput, GenerationEngine, GenerationUseCase, MediaAnalysisKind, MediaAnalysisPromptLength, MediaAnalyzerAttachment, MediaAnalyzerSubmitPayload, MediaKind, MenuPlacement, ModelOption, OutputKind, Transcribe, VoiceClip, VoiceInputConfig, VoiceOption, ParameterOption, Reasoning, RegionBox, RegionFormat, Request, Result, ResultStatus, Run, SuggestedModelProblem, SuggestedModelsCheck, FalInputFormat, Usage, } from "@chai-ui/core";
|
|
14
|
+
export { createFalEngine, createFalTranscriber, createOpenRouterEngine, createMockEngine, mockEngine, buildRegionEditPrompt, DEFAULT_MAX_ATTACHMENTS_BY_KIND, DEFAULT_MAX_REGIONS, DEFAULT_MODEL_ID, DEFAULT_REASONING_MODEL, DEFAULT_REASONING_MODEL_BY_KIND, CREATE_MUSIC_USE_CASE, CREATE_SPEECH_USE_CASE, EDIT_IMAGE_USE_CASE, TEXT_USE_CASE, PRECISE_EDIT_MODELS, ROUTING_MODEL_ID, GenerationError, isMediaAnalyzerAtCap, nextMediaAnalyzerAttachments, DEFAULT_MEDIA_ANALYSIS_PROMPT_LENGTH, MEDIA_ANALYSIS_PROMPTS, MEDIA_ANALYSIS_PROMPT_LENGTHS, SUGGESTED_IMAGE_MODELS, SUGGESTED_TEXT_TO_VIDEO_MODELS, SUGGESTED_IMAGE_TO_VIDEO_MODELS, SUGGESTED_EDIT_MODELS, SUGGESTED_ANALYSIS_MODELS, reasoningModelFor, suggestedModels, promptWithGenres, checkSuggestedModels, nextUseCases, combinesWithOthers, buildJudgePrompt, DEFAULT_EVALUATION_CHECKS, composerEvents, resultCardEvents, } from "@chai-ui/core";
|
|
15
|
+
export type { AudioUseCase, ComposerAttachMenuAction, ComposerPromptField, ComposerAttachment, ComposerSelection, ComposerSubmitPayload, ComposerUseCase, DroppedMedia, EditRegion, EditVersion, Evaluation, EvaluationCheck, JudgePromptInput, ChaiEvent, ChaiEventName, GenerationEngine, GenerationUseCase, MediaAnalysisKind, MediaAnalysisPromptLength, MediaAnalyzerAttachment, MediaAnalyzerSubmitPayload, MediaKind, MenuPlacement, ModelOption, OutputKind, Transcribe, VoiceClip, VoiceInputConfig, VoiceOption, ParameterOption, Reasoning, RegionBox, RegionFormat, Request, Result, ResultStatus, Run, SuggestedModelProblem, SuggestedModelsCheck, FalInputFormat, Usage, } from "@chai-ui/core";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,yB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EACV,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,EACP,MAAM,EACN,YAAY,EACZ,GAAG,EACH,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,KAAK,GACN,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, computed, defineComponent, provide, renderSlot, watch, onScopeDispose, h, ref, nextTick, openBlock, createElementBlock, createElementVNode, normalizeClass, createBlock, unref, Fragment, renderList, resolveDynamicComponent, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, createVNode, useId, shallowRef, mergeProps, onMounted, onUnmounted, withModifiers, withCtx, withDirectives, vModelText, reactive, toValue } from "vue";
|
|
2
|
-
import { reasoningEngineFor, createReasoning, menuOpensAbove, regionColor, MAX_ANIMATE_ENHANCE_LENGTH, enhanceRevealDurationMs, VOICE_LEVEL_COUNT, formatVoiceElapsed, composerView, composerAttachMenuItems, createVoiceInput, composerAttachmentsFromFiles, regionBoxStyle, REGION_CORNERS, DEFAULT_MAX_REGIONS, freeRegionNumber, EDIT_ZOOM_STEPS, regionPopoverPosition, editCardWidth, newRegion, panForZoom, clampPan, fitBox, resizeBox, regionBoxForKey, panForKey, downloadMedia, downloadFilename, shareMedia, resultModelLabel, formatTokens, formatCost, formatDuration, formatAspectRatio, SUGGESTED_ANALYSIS_MODELS, DEFAULT_MAX_ATTACHMENTS_BY_KIND, isMediaAnalyzerAtCap, mediaAnalyzerModelSections, PROMPT_LENGTH_HINT, readMediaFiles, nextMediaAnalyzerAttachments, replacedNote, createComposerStore, pickReasoning, createMediaAnalyzerStore } from "@chai-ui/core";
|
|
3
|
-
import { CREATE_MUSIC_USE_CASE, CREATE_SPEECH_USE_CASE, DEFAULT_EVALUATION_CHECKS, DEFAULT_MAX_ATTACHMENTS_BY_KIND as DEFAULT_MAX_ATTACHMENTS_BY_KIND2, DEFAULT_MAX_REGIONS as DEFAULT_MAX_REGIONS2, DEFAULT_MEDIA_ANALYSIS_PROMPT_LENGTH, DEFAULT_MODEL_ID, DEFAULT_REASONING_MODEL, DEFAULT_REASONING_MODEL_BY_KIND, EDIT_IMAGE_USE_CASE, GenerationError, MEDIA_ANALYSIS_PROMPTS, MEDIA_ANALYSIS_PROMPT_LENGTHS, PRECISE_EDIT_MODELS, ROUTING_MODEL_ID, SUGGESTED_ANALYSIS_MODELS as SUGGESTED_ANALYSIS_MODELS2, SUGGESTED_EDIT_MODELS, SUGGESTED_IMAGE_MODELS, SUGGESTED_IMAGE_TO_VIDEO_MODELS, SUGGESTED_TEXT_TO_VIDEO_MODELS, TEXT_USE_CASE, buildJudgePrompt, buildRegionEditPrompt, checkSuggestedModels, combinesWithOthers, createFalEngine, createFalTranscriber, createMockEngine, createOpenRouterEngine, isMediaAnalyzerAtCap as isMediaAnalyzerAtCap2, mockEngine, nextMediaAnalyzerAttachments as nextMediaAnalyzerAttachments2, nextUseCases, promptWithGenres, reasoningModelFor, suggestedModels } from "@chai-ui/core";
|
|
2
|
+
import { reasoningEngineFor, createReasoning, menuOpensAbove, regionColor, MAX_ANIMATE_ENHANCE_LENGTH, enhanceRevealDurationMs, VOICE_LEVEL_COUNT, formatVoiceElapsed, composerView, composerAttachMenuItems, createVoiceInput, composerEvents, composerAttachmentsFromFiles, regionBoxStyle, REGION_CORNERS, DEFAULT_MAX_REGIONS, freeRegionNumber, EDIT_ZOOM_STEPS, regionPopoverPosition, editCardWidth, newRegion, panForZoom, clampPan, fitBox, resizeBox, regionBoxForKey, panForKey, downloadMedia, downloadFilename, shareMedia, resultModelLabel, formatTokens, formatCost, formatDuration, formatAspectRatio, resultCardEvents, SUGGESTED_ANALYSIS_MODELS, DEFAULT_MAX_ATTACHMENTS_BY_KIND, isMediaAnalyzerAtCap, mediaAnalyzerModelSections, PROMPT_LENGTH_HINT, readMediaFiles, nextMediaAnalyzerAttachments, replacedNote, createComposerStore, pickReasoning, createMediaAnalyzerStore } from "@chai-ui/core";
|
|
3
|
+
import { CREATE_MUSIC_USE_CASE, CREATE_SPEECH_USE_CASE, DEFAULT_EVALUATION_CHECKS, DEFAULT_MAX_ATTACHMENTS_BY_KIND as DEFAULT_MAX_ATTACHMENTS_BY_KIND2, DEFAULT_MAX_REGIONS as DEFAULT_MAX_REGIONS2, DEFAULT_MEDIA_ANALYSIS_PROMPT_LENGTH, DEFAULT_MODEL_ID, DEFAULT_REASONING_MODEL, DEFAULT_REASONING_MODEL_BY_KIND, EDIT_IMAGE_USE_CASE, GenerationError, MEDIA_ANALYSIS_PROMPTS, MEDIA_ANALYSIS_PROMPT_LENGTHS, PRECISE_EDIT_MODELS, ROUTING_MODEL_ID, SUGGESTED_ANALYSIS_MODELS as SUGGESTED_ANALYSIS_MODELS2, SUGGESTED_EDIT_MODELS, SUGGESTED_IMAGE_MODELS, SUGGESTED_IMAGE_TO_VIDEO_MODELS, SUGGESTED_TEXT_TO_VIDEO_MODELS, TEXT_USE_CASE, buildJudgePrompt, buildRegionEditPrompt, checkSuggestedModels, combinesWithOthers, composerEvents as composerEvents2, createFalEngine, createFalTranscriber, createMockEngine, createOpenRouterEngine, isMediaAnalyzerAtCap as isMediaAnalyzerAtCap2, mockEngine, nextMediaAnalyzerAttachments as nextMediaAnalyzerAttachments2, nextUseCases, promptWithGenres, reasoningModelFor, resultCardEvents as resultCardEvents2, suggestedModels } from "@chai-ui/core";
|
|
4
4
|
import "@material/web/fab/fab.js";
|
|
5
5
|
import "@material/web/checkbox/checkbox.js";
|
|
6
6
|
import "@material/web/textfield/outlined-text-field.js";
|
|
@@ -277,6 +277,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
277
277
|
note: {},
|
|
278
278
|
hint: {},
|
|
279
279
|
onEnhance: { type: Function },
|
|
280
|
+
onRevert: { type: Function },
|
|
280
281
|
enhancing: { type: Boolean },
|
|
281
282
|
disabled: { type: Boolean }
|
|
282
283
|
},
|
|
@@ -333,6 +334,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
333
334
|
enhancedValue.value = null;
|
|
334
335
|
originalValue.value = null;
|
|
335
336
|
if (original != null) emit("change", original);
|
|
337
|
+
props.onRevert?.();
|
|
336
338
|
return;
|
|
337
339
|
}
|
|
338
340
|
originalValue.value = props.value;
|
|
@@ -429,7 +431,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
429
431
|
props: {
|
|
430
432
|
voice: {},
|
|
431
433
|
state: {},
|
|
432
|
-
disabled: { type: Boolean }
|
|
434
|
+
disabled: { type: Boolean },
|
|
435
|
+
onStart: { type: Function }
|
|
433
436
|
},
|
|
434
437
|
setup(__props) {
|
|
435
438
|
const props = __props;
|
|
@@ -442,6 +445,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
442
445
|
else if (status === "transcribing") props.voice.cancel();
|
|
443
446
|
else {
|
|
444
447
|
props.voice.dismiss();
|
|
448
|
+
props.onStart?.();
|
|
445
449
|
void props.voice.start();
|
|
446
450
|
}
|
|
447
451
|
}
|
|
@@ -839,6 +843,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
839
843
|
submitting: { type: Boolean },
|
|
840
844
|
onAbort: {},
|
|
841
845
|
onAttachMenuSelect: {},
|
|
846
|
+
onEvent: {},
|
|
842
847
|
attachMenuActions: {},
|
|
843
848
|
regions: { default: () => [] },
|
|
844
849
|
"onUpdate:regions": {},
|
|
@@ -882,11 +887,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
882
887
|
}
|
|
883
888
|
);
|
|
884
889
|
function pickModel(menu, id) {
|
|
890
|
+
props.onEvent?.(composerEvents.modelPicked(menu.key, id));
|
|
885
891
|
if (view.value.multiModel) props["onUpdate:modelIds"]?.(menu.next(id));
|
|
886
892
|
else props["onUpdate:modelId"]?.(id);
|
|
887
893
|
}
|
|
888
894
|
const enhancingField = ref("prompt");
|
|
889
895
|
const enhanceField = (field) => props.onEnhance && ((current) => {
|
|
896
|
+
props.onEvent?.(composerEvents.enhanceClicked(field, current.length));
|
|
890
897
|
enhancingField.value = field;
|
|
891
898
|
props.onEnhance?.(current, field, view.value.enhanceMode);
|
|
892
899
|
});
|
|
@@ -906,17 +913,44 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
906
913
|
async function onFiles(files) {
|
|
907
914
|
const onAttachments = props["onUpdate:attachments"];
|
|
908
915
|
if (!files || files.length === 0 || !onAttachments) return;
|
|
916
|
+
const picked = files.length;
|
|
909
917
|
const { attachments, unsupported } = await composerAttachmentsFromFiles(files, props.attachments, view.value.editing);
|
|
910
918
|
unsupported.forEach((name) => emit("unsupportedFile", name));
|
|
919
|
+
props.onEvent?.(composerEvents.mediaAttached(picked - unsupported.length, unsupported.length));
|
|
911
920
|
if (attachments) onAttachments(attachments);
|
|
912
921
|
}
|
|
913
922
|
function removeUseCase(useCase) {
|
|
923
|
+
props.onEvent?.(composerEvents.useCaseRemoved(useCase));
|
|
914
924
|
if (props.multiSelectUseCases) props["onUpdate:useCases"]?.(props.useCases.filter((u) => u.kind !== useCase.kind));
|
|
915
925
|
else props.onClearUseCase?.();
|
|
916
926
|
}
|
|
917
927
|
function onSubmitClick() {
|
|
918
|
-
if (view.value.showStop)
|
|
919
|
-
|
|
928
|
+
if (view.value.showStop) {
|
|
929
|
+
props.onEvent?.(composerEvents.stopped());
|
|
930
|
+
props.onAbort?.();
|
|
931
|
+
} else if (!view.value.isSubmitDisabled && !props.submitting) {
|
|
932
|
+
const payload = view.value.payload();
|
|
933
|
+
props.onEvent?.(composerEvents.submitted(payload, Boolean(props.submitError)));
|
|
934
|
+
emit("submit", payload);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
function onMenuSelect(action) {
|
|
938
|
+
if (action !== "add-media") props.onEvent?.(composerEvents.useCasePicked(action));
|
|
939
|
+
props.onAttachMenuSelect?.(action);
|
|
940
|
+
}
|
|
941
|
+
function toggleAutoSelect(on) {
|
|
942
|
+
props.onEvent?.(composerEvents.autoSelectToggled(on));
|
|
943
|
+
props["onUpdate:autoSelectModel"]?.(on);
|
|
944
|
+
}
|
|
945
|
+
function revertField(field) {
|
|
946
|
+
props.onEvent?.(composerEvents.enhanceReverted(field));
|
|
947
|
+
}
|
|
948
|
+
function onVoiceStart() {
|
|
949
|
+
props.onEvent?.(composerEvents.voiceStarted());
|
|
950
|
+
}
|
|
951
|
+
function pickOption(option, id, apply) {
|
|
952
|
+
props.onEvent?.(composerEvents.optionPicked(option, id));
|
|
953
|
+
apply();
|
|
920
954
|
}
|
|
921
955
|
return (_ctx, _cache) => {
|
|
922
956
|
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
@@ -973,10 +1007,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
973
1007
|
note: "(required)",
|
|
974
1008
|
hint: view.value.environmentHint,
|
|
975
1009
|
"on-enhance": enhanceField("environment"),
|
|
1010
|
+
"on-revert": () => revertField("environment"),
|
|
976
1011
|
enhancing: Boolean(__props.enhancing) && enhancingField.value === "environment",
|
|
977
1012
|
disabled: __props.disabled,
|
|
978
1013
|
onChange: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event))
|
|
979
|
-
}, null, 8, ["value", "placeholder", "hint", "on-enhance", "enhancing", "disabled"]),
|
|
1014
|
+
}, null, 8, ["value", "placeholder", "hint", "on-enhance", "on-revert", "enhancing", "disabled"]),
|
|
980
1015
|
props["onUpdate:character"] ? (openBlock(), createBlock(_sfc_main$h, {
|
|
981
1016
|
key: 0,
|
|
982
1017
|
value: __props.character,
|
|
@@ -984,20 +1019,22 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
984
1019
|
heading: "Character",
|
|
985
1020
|
note: "(optional)",
|
|
986
1021
|
"on-enhance": enhanceField("character"),
|
|
1022
|
+
"on-revert": () => revertField("character"),
|
|
987
1023
|
enhancing: Boolean(__props.enhancing) && enhancingField.value === "character",
|
|
988
1024
|
disabled: __props.disabled,
|
|
989
1025
|
onChange: _cache[1] || (_cache[1] = ($event) => props["onUpdate:character"]?.($event))
|
|
990
|
-
}, null, 8, ["value", "placeholder", "on-enhance", "enhancing", "disabled"])) : createCommentVNode("", true)
|
|
1026
|
+
}, null, 8, ["value", "placeholder", "on-enhance", "on-revert", "enhancing", "disabled"])) : createCommentVNode("", true)
|
|
991
1027
|
])) : (openBlock(), createBlock(_sfc_main$h, {
|
|
992
1028
|
key: 4,
|
|
993
1029
|
value: __props.modelValue,
|
|
994
1030
|
placeholder: view.value.placeholder,
|
|
995
1031
|
label: __props.promptLabel,
|
|
996
1032
|
"on-enhance": enhanceField("prompt"),
|
|
1033
|
+
"on-revert": () => revertField("prompt"),
|
|
997
1034
|
enhancing: Boolean(__props.enhancing),
|
|
998
1035
|
disabled: __props.disabled,
|
|
999
1036
|
onChange: _cache[2] || (_cache[2] = ($event) => emit("update:modelValue", $event))
|
|
1000
|
-
}, null, 8, ["value", "placeholder", "label", "on-enhance", "enhancing", "disabled"])),
|
|
1037
|
+
}, null, 8, ["value", "placeholder", "label", "on-enhance", "on-revert", "enhancing", "disabled"])),
|
|
1001
1038
|
__props.submitError ? (openBlock(), createElementBlock("p", _hoisted_8$4, [
|
|
1002
1039
|
createVNode(unref(ErrorIcon)),
|
|
1003
1040
|
createTextVNode(toDisplayString(__props.submitError), 1)
|
|
@@ -1014,7 +1051,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1014
1051
|
"images-only": view.value.editing,
|
|
1015
1052
|
disabled: __props.disabled,
|
|
1016
1053
|
placement: __props.menuPlacement,
|
|
1017
|
-
onSelect: _cache[3] || (_cache[3] = ($event) =>
|
|
1054
|
+
onSelect: _cache[3] || (_cache[3] = ($event) => onMenuSelect($event)),
|
|
1018
1055
|
onFiles
|
|
1019
1056
|
}, null, 8, ["items", "images-only", "disabled", "placement"])) : createCommentVNode("", true),
|
|
1020
1057
|
(openBlock(true), createElementBlock(Fragment, null, renderList(view.value.pickedUseCases, (u) => {
|
|
@@ -1033,7 +1070,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1033
1070
|
options: menu.options,
|
|
1034
1071
|
value: menu.value,
|
|
1035
1072
|
multiple: menu.multiple,
|
|
1036
|
-
"toggle-header": __props.showAutoSelectToggle && view.value.offersAutoSelect ? { label: "Auto-select model", value: view.value.autoSelectModel, onChange:
|
|
1073
|
+
"toggle-header": __props.showAutoSelectToggle && view.value.offersAutoSelect ? { label: "Auto-select model", value: view.value.autoSelectModel, onChange: toggleAutoSelect } : void 0,
|
|
1037
1074
|
"trigger-label": menu.triggerLabel,
|
|
1038
1075
|
"menu-label": menu.menuLabel,
|
|
1039
1076
|
searchable: false,
|
|
@@ -1053,7 +1090,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1053
1090
|
searchable: false,
|
|
1054
1091
|
"trigger-variant": "text",
|
|
1055
1092
|
disabled: __props.disabled,
|
|
1056
|
-
onSelect: _cache[4] || (_cache[4] = ($event) => props["onUpdate:aspectRatio"]?.($event.id))
|
|
1093
|
+
onSelect: _cache[4] || (_cache[4] = ($event) => pickOption("aspect_ratio", $event.id, () => props["onUpdate:aspectRatio"]?.($event.id)))
|
|
1057
1094
|
}, null, 8, ["placement", "options", "value", "trigger-label", "disabled"])) : createCommentVNode("", true),
|
|
1058
1095
|
view.value.voiceOptions.length > 0 && props["onUpdate:speechVoice"] ? (openBlock(), createBlock(_sfc_main$d, mergeProps({
|
|
1059
1096
|
key: 2,
|
|
@@ -1065,7 +1102,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1065
1102
|
searchable: view.value.voiceOptions.length > view.value.searchableAt,
|
|
1066
1103
|
"trigger-variant": "text",
|
|
1067
1104
|
disabled: __props.disabled,
|
|
1068
|
-
onSelect: _cache[5] || (_cache[5] = ($event) => props["onUpdate:speechVoice"]?.($event.id))
|
|
1105
|
+
onSelect: _cache[5] || (_cache[5] = ($event) => pickOption("voice", $event.id, () => props["onUpdate:speechVoice"]?.($event.id)))
|
|
1069
1106
|
}), null, 16, ["placement", "value", "trigger-label", "searchable", "disabled"])) : createCommentVNode("", true),
|
|
1070
1107
|
view.value.genreOptions.length > 0 && props["onUpdate:genres"] ? (openBlock(), createBlock(_sfc_main$d, {
|
|
1071
1108
|
key: 3,
|
|
@@ -1078,7 +1115,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1078
1115
|
searchable: view.value.genreOptions.length > view.value.searchableAt,
|
|
1079
1116
|
"trigger-variant": "text",
|
|
1080
1117
|
disabled: __props.disabled,
|
|
1081
|
-
onSelect: _cache[6] || (_cache[6] = ($event) => props["onUpdate:genres"]?.(view.value.toggledGenres($event.id)))
|
|
1118
|
+
onSelect: _cache[6] || (_cache[6] = ($event) => pickOption("genre", $event.id, () => props["onUpdate:genres"]?.(view.value.toggledGenres($event.id))))
|
|
1082
1119
|
}, null, 8, ["placement", "options", "value", "trigger-label", "searchable", "disabled"])) : createCommentVNode("", true),
|
|
1083
1120
|
view.value.frameRateOptions.length > 0 && props["onUpdate:frameRate"] ? (openBlock(), createBlock(_sfc_main$d, {
|
|
1084
1121
|
key: 4,
|
|
@@ -1090,7 +1127,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1090
1127
|
searchable: false,
|
|
1091
1128
|
"trigger-variant": "text",
|
|
1092
1129
|
disabled: __props.disabled,
|
|
1093
|
-
onSelect: _cache[7] || (_cache[7] = ($event) => props["onUpdate:frameRate"]?.(Number($event.id)))
|
|
1130
|
+
onSelect: _cache[7] || (_cache[7] = ($event) => pickOption("frame_rate", $event.id, () => props["onUpdate:frameRate"]?.(Number($event.id))))
|
|
1094
1131
|
}, null, 8, ["placement", "options", "value", "trigger-label", "disabled"])) : createCommentVNode("", true)
|
|
1095
1132
|
]),
|
|
1096
1133
|
createElementVNode("div", _hoisted_12$3, [
|
|
@@ -1098,7 +1135,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1098
1135
|
key: 0,
|
|
1099
1136
|
voice: unref(voice),
|
|
1100
1137
|
state: voiceState.value,
|
|
1101
|
-
disabled: __props.disabled
|
|
1138
|
+
disabled: __props.disabled,
|
|
1139
|
+
"on-start": onVoiceStart
|
|
1102
1140
|
}, null, 8, ["voice", "state", "disabled"])) : createCommentVNode("", true),
|
|
1103
1141
|
!(__props.voiceInput && (voiceState.value.status === "recording" || voiceState.value.status === "transcribing")) ? (openBlock(), createElementBlock("md-fab", {
|
|
1104
1142
|
key: 1,
|
|
@@ -2234,7 +2272,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2234
2272
|
models: {},
|
|
2235
2273
|
getVote: { type: Function },
|
|
2236
2274
|
moreActions: {},
|
|
2237
|
-
disabled: { type: Boolean }
|
|
2275
|
+
disabled: { type: Boolean },
|
|
2276
|
+
onEvent: { type: Function }
|
|
2238
2277
|
},
|
|
2239
2278
|
emits: ["action"],
|
|
2240
2279
|
setup(__props, { emit: __emit }) {
|
|
@@ -2279,7 +2318,32 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2279
2318
|
index: index.value,
|
|
2280
2319
|
image: kind.value === "image" ? result.value.output.src : void 0
|
|
2281
2320
|
}));
|
|
2282
|
-
|
|
2321
|
+
function report(action, r) {
|
|
2322
|
+
props.onEvent?.(resultCardEvents.action(action));
|
|
2323
|
+
emit("action", action, r);
|
|
2324
|
+
}
|
|
2325
|
+
const act = (action) => report(action, result.value);
|
|
2326
|
+
function goTo(next) {
|
|
2327
|
+
if (next !== index.value) props.onEvent?.(resultCardEvents.paged(next, props.results.length));
|
|
2328
|
+
activeIndex.value = next;
|
|
2329
|
+
}
|
|
2330
|
+
function openInfo() {
|
|
2331
|
+
props.onEvent?.(resultCardEvents.infoOpened());
|
|
2332
|
+
flipped.value = true;
|
|
2333
|
+
}
|
|
2334
|
+
const shownIds = /* @__PURE__ */ new Set();
|
|
2335
|
+
watch(
|
|
2336
|
+
() => props.results,
|
|
2337
|
+
(results) => {
|
|
2338
|
+
for (const r of results) {
|
|
2339
|
+
if ((r.status === "done" || r.status === "error") && !shownIds.has(r.id)) {
|
|
2340
|
+
shownIds.add(r.id);
|
|
2341
|
+
props.onEvent?.(resultCardEvents.shown(r.status, r.output?.kind, results.length));
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
},
|
|
2345
|
+
{ immediate: true, deep: true }
|
|
2346
|
+
);
|
|
2283
2347
|
function flash(flag) {
|
|
2284
2348
|
flag.value = true;
|
|
2285
2349
|
setTimeout(() => flag.value = false, 1500);
|
|
@@ -2293,12 +2357,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2293
2357
|
async function download() {
|
|
2294
2358
|
const r = result.value;
|
|
2295
2359
|
if (r.output) await downloadMedia(r.output.src, downloadFilename(r.id, r.output.kind, r.output.src));
|
|
2296
|
-
|
|
2360
|
+
report("download", r);
|
|
2297
2361
|
}
|
|
2298
2362
|
async function share() {
|
|
2299
2363
|
const r = result.value;
|
|
2300
2364
|
if (r.output && await shareMedia(r.output.src) === "copied") flash(linkCopied);
|
|
2301
|
-
|
|
2365
|
+
report("share", r);
|
|
2302
2366
|
}
|
|
2303
2367
|
watch(
|
|
2304
2368
|
flipped,
|
|
@@ -2384,7 +2448,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2384
2448
|
index: index.value,
|
|
2385
2449
|
label: "Results",
|
|
2386
2450
|
disabled: __props.disabled,
|
|
2387
|
-
"onUpdate:index": _cache[3] || (_cache[3] = ($event) =>
|
|
2451
|
+
"onUpdate:index": _cache[3] || (_cache[3] = ($event) => goTo($event))
|
|
2388
2452
|
}, null, 8, ["count", "index", "disabled"])
|
|
2389
2453
|
], 2)) : createCommentVNode("", true),
|
|
2390
2454
|
createElementVNode("div", _hoisted_6$1, [
|
|
@@ -2436,7 +2500,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2436
2500
|
variant: "round",
|
|
2437
2501
|
label: "Show details",
|
|
2438
2502
|
disabled: __props.disabled,
|
|
2439
|
-
onClick:
|
|
2503
|
+
onClick: openInfo
|
|
2440
2504
|
}, {
|
|
2441
2505
|
default: withCtx(() => [
|
|
2442
2506
|
createVNode(unref(InfoIcon))
|
|
@@ -2457,7 +2521,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2457
2521
|
type: "button",
|
|
2458
2522
|
class: "chai-result-card__close",
|
|
2459
2523
|
"aria-label": "Close details",
|
|
2460
|
-
onClick: _cache[
|
|
2524
|
+
onClick: _cache[8] || (_cache[8] = ($event) => flipped.value = false)
|
|
2461
2525
|
}, [
|
|
2462
2526
|
createVNode(unref(CloseIcon))
|
|
2463
2527
|
]),
|
|
@@ -2511,7 +2575,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2511
2575
|
createElementVNode("div", {
|
|
2512
2576
|
class: "chai-result-card__expand-scrim",
|
|
2513
2577
|
role: "presentation",
|
|
2514
|
-
onClick: _cache[
|
|
2578
|
+
onClick: _cache[9] || (_cache[9] = ($event) => mediaExpanded.value = false)
|
|
2515
2579
|
}),
|
|
2516
2580
|
createElementVNode("div", _hoisted_17, [
|
|
2517
2581
|
kind.value === "video" ? (openBlock(), createBlock(_sfc_main$3, {
|
|
@@ -2520,7 +2584,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2520
2584
|
expanded: "",
|
|
2521
2585
|
time: videoTime,
|
|
2522
2586
|
"was-playing": videoWasPlaying.value,
|
|
2523
|
-
onPlayingChange: _cache[
|
|
2587
|
+
onPlayingChange: _cache[10] || (_cache[10] = ($event) => videoWasPlaying.value = $event)
|
|
2524
2588
|
}, null, 8, ["src", "time", "was-playing"])) : (openBlock(), createElementBlock("img", {
|
|
2525
2589
|
key: 1,
|
|
2526
2590
|
class: "chai-result-card__image",
|
|
@@ -2531,7 +2595,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2531
2595
|
type: "button",
|
|
2532
2596
|
class: "chai-result-card__collapse",
|
|
2533
2597
|
"aria-label": "Collapse",
|
|
2534
|
-
onClick: _cache[
|
|
2598
|
+
onClick: _cache[11] || (_cache[11] = ($event) => mediaExpanded.value = false)
|
|
2535
2599
|
}, [
|
|
2536
2600
|
createVNode(unref(CloseIcon))
|
|
2537
2601
|
])
|
|
@@ -2842,6 +2906,7 @@ export {
|
|
|
2842
2906
|
buildRegionEditPrompt,
|
|
2843
2907
|
checkSuggestedModels,
|
|
2844
2908
|
combinesWithOthers,
|
|
2909
|
+
composerEvents2 as composerEvents,
|
|
2845
2910
|
createFalEngine,
|
|
2846
2911
|
createFalTranscriber,
|
|
2847
2912
|
createMockEngine,
|
|
@@ -2853,6 +2918,7 @@ export {
|
|
|
2853
2918
|
promptWithGenres,
|
|
2854
2919
|
reasoningKey,
|
|
2855
2920
|
reasoningModelFor,
|
|
2921
|
+
resultCardEvents2 as resultCardEvents,
|
|
2856
2922
|
suggestedModels,
|
|
2857
2923
|
useComposer,
|
|
2858
2924
|
useMediaAnalyzer,
|