@meistrari/chat-nuxt 4.13.0-rc.0 → 4.13.0-rc.10
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/module.json +1 -1
- package/dist/runtime/conversations/components/chat-export-code-block.d.vue.ts +9 -0
- package/dist/runtime/conversations/components/chat-export-code-block.vue +12 -0
- package/dist/runtime/conversations/components/chat-export-code-block.vue.d.ts +9 -0
- package/dist/runtime/conversations/components/chat-export-openui.vue +4 -1
- package/dist/runtime/conversations/components/chat-export-steps.d.vue.ts +15 -0
- package/dist/runtime/conversations/components/chat-export-steps.vue +18 -0
- package/dist/runtime/conversations/components/chat-export-steps.vue.d.ts +15 -0
- package/dist/runtime/conversations/components/chat-new-conversation-modal.d.vue.ts +1 -1
- package/dist/runtime/conversations/components/chat-new-conversation-modal.vue.d.ts +1 -1
- package/dist/runtime/conversations/export.js +15 -2
- package/dist/runtime/embed/components/mobile/chat-mobile-header.d.vue.ts +6 -6
- package/dist/runtime/embed/components/mobile/chat-mobile-header.vue.d.ts +6 -6
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +13 -13
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +13 -13
- package/dist/runtime/files/components/chat-file-reference.d.vue.ts +9 -0
- package/dist/runtime/files/components/chat-file-reference.vue +82 -0
- package/dist/runtime/files/components/chat-file-reference.vue.d.ts +9 -0
- package/dist/runtime/files/components/chat-vault-link.vue +31 -1
- package/dist/runtime/files/file-reference.d.ts +14 -0
- package/dist/runtime/files/file-reference.js +14 -0
- package/dist/runtime/messages/components/chat-debug-widget-gallery.d.vue.ts +7 -0
- package/dist/runtime/messages/components/chat-debug-widget-gallery.vue +218 -0
- package/dist/runtime/messages/components/chat-debug-widget-gallery.vue.d.ts +7 -0
- package/dist/runtime/rendering/debug/widget-gallery.d.ts +24 -0
- package/dist/runtime/rendering/debug/widget-gallery.js +25 -0
- package/dist/runtime/types/schemas/chat/v3.d.ts +51 -1
- package/dist/runtime/types/schemas/chat/v3.js +45 -2
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
props: {
|
|
3
|
+
code: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
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
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
props: { type: Object, required: true }
|
|
4
|
+
});
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div data-openui="code-block" border rounded-8px p-12px flex="~ col" gap-4px>
|
|
9
|
+
<span v-if="props.language" body-12-regular>{{ props.language }}</span>
|
|
10
|
+
<pre m-0 whitespace-pre-wrap font-mono text-13px><code>{{ props.code }}</code></pre>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
props: {
|
|
3
|
+
code: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
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
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -4,13 +4,16 @@ import OpenuiImage from "../../rendering/components/openui/image.vue";
|
|
|
4
4
|
import OpenuiCitation from "../../rendering/components/openui/citation.vue";
|
|
5
5
|
import ChatExportQuestions from "./chat-export-questions.vue";
|
|
6
6
|
import ChatExportFile from "./chat-export-file.vue";
|
|
7
|
+
import ChatExportCodeBlock from "./chat-export-code-block.vue";
|
|
8
|
+
import ChatExportSteps from "./chat-export-steps.vue";
|
|
7
9
|
const props = defineProps({
|
|
8
10
|
node: { type: Object, required: true }
|
|
9
11
|
});
|
|
10
12
|
const code = computed(() => props.node.code ?? props.node.content ?? "");
|
|
11
13
|
const host = {
|
|
12
14
|
prose: OpenuiMarkdownProse,
|
|
13
|
-
|
|
15
|
+
expanded: true,
|
|
16
|
+
components: { Questions: ChatExportQuestions, FileCard: ChatExportFile, Image: OpenuiImage, Citation: OpenuiCitation, CodeBlock: ChatExportCodeBlock, Steps: ChatExportSteps }
|
|
14
17
|
};
|
|
15
18
|
</script>
|
|
16
19
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Step = {
|
|
2
|
+
props?: {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
status?: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
props: {
|
|
10
|
+
steps?: Step[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
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>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
props: { type: Object, required: true }
|
|
4
|
+
});
|
|
5
|
+
const STATUS_LABELS = { done: "conclu\xEDda", current: "em andamento", pending: "pendente" };
|
|
6
|
+
function line(step) {
|
|
7
|
+
const status = STATUS_LABELS[step.props?.status ?? ""];
|
|
8
|
+
return `${step.props?.title ?? ""}${status ? ` (${status})` : ""}${step.props?.description ? ` \u2014 ${step.props.description}` : ""}`;
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ol data-openui="steps" pl-20px>
|
|
14
|
+
<li v-for="(step, index) in props.steps ?? []" :key="index" body-14-regular>
|
|
15
|
+
{{ line(step) }}
|
|
16
|
+
</li>
|
|
17
|
+
</ol>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Step = {
|
|
2
|
+
props?: {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
status?: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
props: {
|
|
10
|
+
steps?: Step[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
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>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -6,8 +6,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
6
6
|
} & {
|
|
7
7
|
create: (canvasTools: CanvasTool[]) => any;
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
9
|
-
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
10
9
|
onCreate?: ((canvasTools: CanvasTool[]) => any) | undefined;
|
|
10
|
+
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
11
11
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
|
13
13
|
export default _default;
|
|
@@ -6,8 +6,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
6
6
|
} & {
|
|
7
7
|
create: (canvasTools: CanvasTool[]) => any;
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
9
|
-
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
10
9
|
onCreate?: ((canvasTools: CanvasTool[]) => any) | undefined;
|
|
10
|
+
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
11
11
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
|
13
13
|
export default _default;
|
|
@@ -38,13 +38,14 @@ export function conversationExportFilename(title, format) {
|
|
|
38
38
|
return `${title.trim().replace(/[<>:"/\\|?*\p{Cc}]/gu, "_").slice(0, 150) || "Conversa"}.${format}`;
|
|
39
39
|
}
|
|
40
40
|
export function renderedConversationToText(html) {
|
|
41
|
-
const blocks = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "section", "article", "header", "footer", "table", "ul", "ol", "pre", "blockquote", "figure"]);
|
|
41
|
+
const blocks = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "section", "article", "header", "footer", "table", "ul", "ol", "dl", "pre", "blockquote", "figure"]);
|
|
42
42
|
const ignored = /* @__PURE__ */ new Set(["script", "style", "svg"]);
|
|
43
43
|
const links = [];
|
|
44
44
|
let text = "";
|
|
45
45
|
let ignoredDepth = 0;
|
|
46
46
|
const whitespace = [];
|
|
47
47
|
let cells = 0;
|
|
48
|
+
let trimNextText = false;
|
|
48
49
|
const parser = new Parser({
|
|
49
50
|
onopentag(name, attributes) {
|
|
50
51
|
if (ignoredDepth || ignored.has(name)) {
|
|
@@ -65,6 +66,14 @@ export function renderedConversationToText(html) {
|
|
|
65
66
|
}
|
|
66
67
|
if (name === "li")
|
|
67
68
|
text += "\n- ";
|
|
69
|
+
if (name === "dt") {
|
|
70
|
+
text += "\n";
|
|
71
|
+
trimNextText = true;
|
|
72
|
+
}
|
|
73
|
+
if (name === "dd") {
|
|
74
|
+
text = `${text.replace(/[ \t]+$/, "")}: `;
|
|
75
|
+
trimNextText = true;
|
|
76
|
+
}
|
|
68
77
|
if (name === "br" || name === "hr")
|
|
69
78
|
text += "\n";
|
|
70
79
|
if (name === "img" && attributes.alt)
|
|
@@ -75,7 +84,11 @@ export function renderedConversationToText(html) {
|
|
|
75
84
|
ontext(value) {
|
|
76
85
|
if (!ignoredDepth) {
|
|
77
86
|
const mode = whitespace.at(-1);
|
|
78
|
-
|
|
87
|
+
const written = mode === "pre" || mode === "pre-wrap" || mode === "break-spaces" ? value : mode === "pre-line" ? value.replace(/[^\S\r\n]+/g, " ") : value.replace(/\s+/g, " ");
|
|
88
|
+
const shown = trimNextText ? written.trimStart() : written;
|
|
89
|
+
if (shown)
|
|
90
|
+
trimNextText = false;
|
|
91
|
+
text += shown;
|
|
79
92
|
}
|
|
80
93
|
},
|
|
81
94
|
onclosetag(name) {
|
|
@@ -15,23 +15,23 @@ type __VLS_Props = {
|
|
|
15
15
|
};
|
|
16
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
17
|
delete: () => any;
|
|
18
|
+
openDrawer: () => any;
|
|
19
|
+
copyLink: () => any;
|
|
20
|
+
openOutdatedSettings: () => any;
|
|
18
21
|
rename: () => any;
|
|
19
22
|
duplicate: () => any;
|
|
20
23
|
export: () => any;
|
|
21
|
-
copyLink: () => any;
|
|
22
24
|
debug: () => any;
|
|
23
|
-
openDrawer: () => any;
|
|
24
|
-
openOutdatedSettings: () => any;
|
|
25
25
|
tabChange: (tab: TopbarTab) => any;
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
27
|
onDelete?: (() => any) | undefined;
|
|
28
|
+
onOpenDrawer?: (() => any) | undefined;
|
|
29
|
+
onCopyLink?: (() => any) | undefined;
|
|
30
|
+
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
28
31
|
onRename?: (() => any) | undefined;
|
|
29
32
|
onDuplicate?: (() => any) | undefined;
|
|
30
33
|
onExport?: (() => any) | undefined;
|
|
31
|
-
onCopyLink?: (() => any) | undefined;
|
|
32
34
|
onDebug?: (() => any) | undefined;
|
|
33
|
-
onOpenDrawer?: (() => any) | undefined;
|
|
34
|
-
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
35
35
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
36
36
|
}>, {
|
|
37
37
|
showDrawerButton: boolean;
|
|
@@ -15,23 +15,23 @@ type __VLS_Props = {
|
|
|
15
15
|
};
|
|
16
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
17
|
delete: () => any;
|
|
18
|
+
openDrawer: () => any;
|
|
19
|
+
copyLink: () => any;
|
|
20
|
+
openOutdatedSettings: () => any;
|
|
18
21
|
rename: () => any;
|
|
19
22
|
duplicate: () => any;
|
|
20
23
|
export: () => any;
|
|
21
|
-
copyLink: () => any;
|
|
22
24
|
debug: () => any;
|
|
23
|
-
openDrawer: () => any;
|
|
24
|
-
openOutdatedSettings: () => any;
|
|
25
25
|
tabChange: (tab: TopbarTab) => any;
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
27
|
onDelete?: (() => any) | undefined;
|
|
28
|
+
onOpenDrawer?: (() => any) | undefined;
|
|
29
|
+
onCopyLink?: (() => any) | undefined;
|
|
30
|
+
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
28
31
|
onRename?: (() => any) | undefined;
|
|
29
32
|
onDuplicate?: (() => any) | undefined;
|
|
30
33
|
onExport?: (() => any) | undefined;
|
|
31
|
-
onCopyLink?: (() => any) | undefined;
|
|
32
34
|
onDebug?: (() => any) | undefined;
|
|
33
|
-
onOpenDrawer?: (() => any) | undefined;
|
|
34
|
-
onOpenOutdatedSettings?: (() => any) | undefined;
|
|
35
35
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
36
36
|
}>, {
|
|
37
37
|
showDrawerButton: boolean;
|
|
@@ -66,46 +66,46 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
66
66
|
} & {
|
|
67
67
|
delete: () => any;
|
|
68
68
|
cancel: () => any;
|
|
69
|
+
settings: () => any;
|
|
70
|
+
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
71
|
+
newConversation: (groupId?: string | null | undefined) => any;
|
|
72
|
+
selectExecutionProfile: (profile: ChatExecutionProfile) => any;
|
|
73
|
+
copyLink: () => any;
|
|
69
74
|
rename: () => any;
|
|
70
75
|
duplicate: () => any;
|
|
71
76
|
export: () => any;
|
|
72
|
-
copyLink: () => any;
|
|
73
77
|
debug: () => any;
|
|
74
|
-
selectConversation: (id: string) => any;
|
|
75
|
-
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
76
|
-
settings: () => any;
|
|
77
|
-
newConversation: (groupId?: string | null | undefined) => any;
|
|
78
|
-
selectExecutionProfile: (profile: ChatExecutionProfile) => any;
|
|
79
78
|
tabChange: (tab: TopbarTab) => any;
|
|
80
79
|
switchWorkspace: () => any;
|
|
81
80
|
signout: () => any;
|
|
82
81
|
cancelEditing: () => any;
|
|
83
82
|
dismissOutdatedBanner: () => any;
|
|
84
83
|
saveTitle: () => any;
|
|
84
|
+
selectConversation: (id: string) => any;
|
|
85
85
|
"update:drawerOpen": (value: boolean) => any;
|
|
86
86
|
"update:editTitle": (value: string) => any;
|
|
87
87
|
"update:workspaceSheetOpen": (value: boolean) => any;
|
|
88
88
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
89
89
|
onDelete?: (() => any) | undefined;
|
|
90
90
|
onCancel?: (() => any) | undefined;
|
|
91
|
-
onRename?: (() => any) | undefined;
|
|
92
|
-
onDuplicate?: (() => any) | undefined;
|
|
93
|
-
onExport?: (() => any) | undefined;
|
|
94
|
-
onCopyLink?: (() => any) | undefined;
|
|
95
|
-
onDebug?: (() => any) | undefined;
|
|
96
|
-
onSelectConversation?: ((id: string) => any) | undefined;
|
|
97
|
-
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
98
91
|
onSettings?: (() => any) | undefined;
|
|
92
|
+
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
99
93
|
onNewConversation?: ((groupId?: string | null | undefined) => any) | undefined;
|
|
100
94
|
onSelectExecutionProfile?: ((profile: ChatExecutionProfile) => any) | undefined;
|
|
101
95
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
102
96
|
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
97
|
+
onCopyLink?: (() => any) | undefined;
|
|
98
|
+
onRename?: (() => any) | undefined;
|
|
99
|
+
onDuplicate?: (() => any) | undefined;
|
|
100
|
+
onExport?: (() => any) | undefined;
|
|
101
|
+
onDebug?: (() => any) | undefined;
|
|
103
102
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
104
103
|
onSwitchWorkspace?: (() => any) | undefined;
|
|
105
104
|
onSignout?: (() => any) | undefined;
|
|
106
105
|
onCancelEditing?: (() => any) | undefined;
|
|
107
106
|
onDismissOutdatedBanner?: (() => any) | undefined;
|
|
108
107
|
onSaveTitle?: (() => any) | undefined;
|
|
108
|
+
onSelectConversation?: ((id: string) => any) | undefined;
|
|
109
109
|
"onUpdate:drawerOpen"?: ((value: boolean) => any) | undefined;
|
|
110
110
|
"onUpdate:editTitle"?: ((value: string) => any) | undefined;
|
|
111
111
|
"onUpdate:workspaceSheetOpen"?: ((value: boolean) => any) | undefined;
|
|
@@ -66,46 +66,46 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
66
66
|
} & {
|
|
67
67
|
delete: () => any;
|
|
68
68
|
cancel: () => any;
|
|
69
|
+
settings: () => any;
|
|
70
|
+
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
71
|
+
newConversation: (groupId?: string | null | undefined) => any;
|
|
72
|
+
selectExecutionProfile: (profile: ChatExecutionProfile) => any;
|
|
73
|
+
copyLink: () => any;
|
|
69
74
|
rename: () => any;
|
|
70
75
|
duplicate: () => any;
|
|
71
76
|
export: () => any;
|
|
72
|
-
copyLink: () => any;
|
|
73
77
|
debug: () => any;
|
|
74
|
-
selectConversation: (id: string) => any;
|
|
75
|
-
send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
|
|
76
|
-
settings: () => any;
|
|
77
|
-
newConversation: (groupId?: string | null | undefined) => any;
|
|
78
|
-
selectExecutionProfile: (profile: ChatExecutionProfile) => any;
|
|
79
78
|
tabChange: (tab: TopbarTab) => any;
|
|
80
79
|
switchWorkspace: () => any;
|
|
81
80
|
signout: () => any;
|
|
82
81
|
cancelEditing: () => any;
|
|
83
82
|
dismissOutdatedBanner: () => any;
|
|
84
83
|
saveTitle: () => any;
|
|
84
|
+
selectConversation: (id: string) => any;
|
|
85
85
|
"update:drawerOpen": (value: boolean) => any;
|
|
86
86
|
"update:editTitle": (value: string) => any;
|
|
87
87
|
"update:workspaceSheetOpen": (value: boolean) => any;
|
|
88
88
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
89
89
|
onDelete?: (() => any) | undefined;
|
|
90
90
|
onCancel?: (() => any) | undefined;
|
|
91
|
-
onRename?: (() => any) | undefined;
|
|
92
|
-
onDuplicate?: (() => any) | undefined;
|
|
93
|
-
onExport?: (() => any) | undefined;
|
|
94
|
-
onCopyLink?: (() => any) | undefined;
|
|
95
|
-
onDebug?: (() => any) | undefined;
|
|
96
|
-
onSelectConversation?: ((id: string) => any) | undefined;
|
|
97
|
-
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
98
91
|
onSettings?: (() => any) | undefined;
|
|
92
|
+
onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
|
|
99
93
|
onNewConversation?: ((groupId?: string | null | undefined) => any) | undefined;
|
|
100
94
|
onSelectExecutionProfile?: ((profile: ChatExecutionProfile) => any) | undefined;
|
|
101
95
|
"onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
|
|
102
96
|
"onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
|
|
97
|
+
onCopyLink?: (() => any) | undefined;
|
|
98
|
+
onRename?: (() => any) | undefined;
|
|
99
|
+
onDuplicate?: (() => any) | undefined;
|
|
100
|
+
onExport?: (() => any) | undefined;
|
|
101
|
+
onDebug?: (() => any) | undefined;
|
|
103
102
|
onTabChange?: ((tab: TopbarTab) => any) | undefined;
|
|
104
103
|
onSwitchWorkspace?: (() => any) | undefined;
|
|
105
104
|
onSignout?: (() => any) | undefined;
|
|
106
105
|
onCancelEditing?: (() => any) | undefined;
|
|
107
106
|
onDismissOutdatedBanner?: (() => any) | undefined;
|
|
108
107
|
onSaveTitle?: (() => any) | undefined;
|
|
108
|
+
onSelectConversation?: ((id: string) => any) | undefined;
|
|
109
109
|
"onUpdate:drawerOpen"?: ((value: boolean) => any) | undefined;
|
|
110
110
|
"onUpdate:editTitle"?: ((value: string) => any) | undefined;
|
|
111
111
|
"onUpdate:workspaceSheetOpen"?: ((value: boolean) => any) | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DetectedFile } from '../content-detection.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
file: DetectedFile;
|
|
4
|
+
/** The text the author wrote for the link. */
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
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
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFilePreviewPanel } from "../composables/file-preview-panel";
|
|
3
|
+
import { useVault } from "../composables/vault";
|
|
4
|
+
import { getFileIcon } from "../icons";
|
|
5
|
+
import { normalizeMimeType } from "../mime";
|
|
6
|
+
import { isVaultPermalink } from "../vault-links";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
file: { type: Object, required: true },
|
|
9
|
+
label: { type: String, required: true }
|
|
10
|
+
});
|
|
11
|
+
const { openPreview, updatePreview, setError, currentFile } = useFilePreviewPanel();
|
|
12
|
+
const { getFileInfo, isVaultReference } = useVault();
|
|
13
|
+
const fileName = computed(() => props.file.hashParams?.filename ?? props.file.name);
|
|
14
|
+
const iconSrc = computed(() => props.file.mimeType === "unknown" ? null : getFileIcon(normalizeMimeType(props.file.mimeType)));
|
|
15
|
+
const open = ref(false);
|
|
16
|
+
async function resolveFile() {
|
|
17
|
+
const reference = props.file.reference;
|
|
18
|
+
const cleanReference = reference.split("#")[0] ?? reference;
|
|
19
|
+
if (isVaultReference(cleanReference)) {
|
|
20
|
+
const info = await getFileInfo(cleanReference);
|
|
21
|
+
return { resolvedUrl: info.url, resolvedMimeType: info.mimeType, originalFileName: info.originalFileName };
|
|
22
|
+
}
|
|
23
|
+
if (isVaultPermalink(reference)) {
|
|
24
|
+
const metadata = await $fetch("/api/vault/permalink-metadata", {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: { url: reference }
|
|
27
|
+
}).catch(() => ({}));
|
|
28
|
+
return { resolvedUrl: reference, resolvedMimeType: metadata.mimeType, originalFileName: metadata.originalFileName, fileSize: metadata.fileSize };
|
|
29
|
+
}
|
|
30
|
+
return { resolvedUrl: reference };
|
|
31
|
+
}
|
|
32
|
+
async function openInPanel() {
|
|
33
|
+
const file = props.file;
|
|
34
|
+
const stillOpen = () => toRaw(currentFile.value?.file) === toRaw(file);
|
|
35
|
+
open.value = false;
|
|
36
|
+
openPreview({ file });
|
|
37
|
+
try {
|
|
38
|
+
const resolved = await resolveFile();
|
|
39
|
+
if (stillOpen())
|
|
40
|
+
updatePreview(resolved);
|
|
41
|
+
} catch {
|
|
42
|
+
if (stillOpen())
|
|
43
|
+
setError();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<TelaPopover v-model:open="open">
|
|
50
|
+
<TelaPopoverTrigger as-child>
|
|
51
|
+
<button type="button" class="chat-file-ref" data-chat-file="reference">
|
|
52
|
+
<img v-if="iconSrc" :src="iconSrc" alt="" class="chat-file-ref-icon chat-file-ref-icon--type"><span v-else i-ph-file-text class="chat-file-ref-icon" />{{ label }}
|
|
53
|
+
</button>
|
|
54
|
+
</TelaPopoverTrigger>
|
|
55
|
+
<TelaPopoverContent
|
|
56
|
+
side="top"
|
|
57
|
+
align="start"
|
|
58
|
+
:side-offset="3"
|
|
59
|
+
class="popover-enter-exit origin-[var(--reka-popover-content-transform-origin)] w-300px p-12px rounded-12px! bg border-0.5px! border! [box-shadow:0_4px_16px_0_rgba(85,91,98,0.14)]!"
|
|
60
|
+
>
|
|
61
|
+
<div flex="~ col" gap-8px>
|
|
62
|
+
<p text-13px leading-18px font-580 text-neutral-900 break-words>
|
|
63
|
+
{{ fileName }}
|
|
64
|
+
</p>
|
|
65
|
+
<button
|
|
66
|
+
type="button"
|
|
67
|
+
self-start inline-flex items-center gap-4px
|
|
68
|
+
text-12px leading-16px font-580 text-neutral-900
|
|
69
|
+
cursor-pointer hover:underline
|
|
70
|
+
@click="openInPanel"
|
|
71
|
+
>
|
|
72
|
+
<span i-ph-arrow-square-out text-13px />
|
|
73
|
+
Abrir arquivo
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
</TelaPopoverContent>
|
|
77
|
+
</TelaPopover>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<style scoped>
|
|
81
|
+
.chat-file-ref{background:transparent;border:0;border-radius:5px;color:inherit;cursor:pointer;display:inline;font:inherit;margin:0 -2px;padding:1px 3px;text-decoration:underline;text-decoration-color:#a3a3a3;text-decoration-style:dotted;text-decoration-thickness:1px;text-underline-offset:3px;transition:background-color .15s ease,text-decoration-color .15s ease}.chat-file-ref:hover{background-color:#f5f5f5;text-decoration-color:#525252}.chat-file-ref-icon{display:inline-block;font-size:.85em;margin-right:.25em;vertical-align:-.08em}.chat-file-ref-icon--type{height:1em;vertical-align:-.15em;width:1em}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DetectedFile } from '../content-detection.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
file: DetectedFile;
|
|
4
|
+
/** The text the author wrote for the link. */
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
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
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -3,7 +3,10 @@ import { isCitationUrl, parseCitationUrl } from "../../citations/citation-links"
|
|
|
3
3
|
import ChatUrlCitation from "../../citations/components/chat-url-citation.vue";
|
|
4
4
|
import { parseUrlCitation } from "../../citations/url-citation";
|
|
5
5
|
import { useEmbedConfig } from "../../embed/composables/embed-config";
|
|
6
|
+
import { CHAT_MESSAGE_CONTEXT_KEY } from "../../types/messages";
|
|
6
7
|
import { detectFileFromUrl } from "../content-detection";
|
|
8
|
+
import { hasTextOutside, isLabelledFileLink } from "../file-reference";
|
|
9
|
+
import ChatFileReference from "./chat-file-reference.vue";
|
|
7
10
|
const props = defineProps({
|
|
8
11
|
node: { type: Object, required: true },
|
|
9
12
|
indexKey: { type: [Number, String], required: true },
|
|
@@ -17,6 +20,18 @@ const linkText = computed(() => {
|
|
|
17
20
|
}
|
|
18
21
|
return props.node.text || props.node.href;
|
|
19
22
|
});
|
|
23
|
+
const labelled = computed(() => isLabelledFileLink(linkText.value, props.node.href));
|
|
24
|
+
const message = inject(CHAT_MESSAGE_CONTEXT_KEY, null);
|
|
25
|
+
const root = ref(null);
|
|
26
|
+
const aloneInBlock = ref(false);
|
|
27
|
+
const standalone = computed(() => aloneInBlock.value && !message?.streaming.value);
|
|
28
|
+
function measureBlock() {
|
|
29
|
+
const element = root.value;
|
|
30
|
+
const block = element?.closest(".paragraph-node, p, td, th");
|
|
31
|
+
aloneInBlock.value = Boolean(element && block && !hasTextOutside(block, element));
|
|
32
|
+
}
|
|
33
|
+
onMounted(measureBlock);
|
|
34
|
+
watch(() => message?.streaming.value, () => nextTick(measureBlock));
|
|
20
35
|
const detectedCitation = computed(() => {
|
|
21
36
|
if (!embedConfig?.citations.value)
|
|
22
37
|
return null;
|
|
@@ -33,8 +48,23 @@ const detectedUrlCitation = computed(() => parseUrlCitation(props.node.href, lin
|
|
|
33
48
|
</script>
|
|
34
49
|
|
|
35
50
|
<template>
|
|
51
|
+
<span v-if="detectedFile && labelled" ref="root">
|
|
52
|
+
<ChatFilePreview
|
|
53
|
+
v-if="standalone"
|
|
54
|
+
:file="detectedFile"
|
|
55
|
+
inline-block
|
|
56
|
+
align-middle
|
|
57
|
+
w-full
|
|
58
|
+
my-4px
|
|
59
|
+
/>
|
|
60
|
+
<ChatFileReference
|
|
61
|
+
v-else
|
|
62
|
+
:file="detectedFile"
|
|
63
|
+
:label="linkText"
|
|
64
|
+
/>
|
|
65
|
+
</span>
|
|
36
66
|
<ChatFilePreview
|
|
37
|
-
v-if="detectedFile"
|
|
67
|
+
v-else-if="detectedFile"
|
|
38
68
|
:file="detectedFile"
|
|
39
69
|
inline-block
|
|
40
70
|
align-middle
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A markdown link whose text the author wrote, as opposed to an autolink that shows its own address. */
|
|
2
|
+
export declare function isLabelledFileLink(label: string, href: string): boolean;
|
|
3
|
+
type TextTreeNode = {
|
|
4
|
+
nodeType: number;
|
|
5
|
+
textContent: string | null;
|
|
6
|
+
childNodes: ArrayLike<unknown>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Whether `block` holds any text outside `inner`. A file link with none is the whole block:
|
|
10
|
+
* the file is being handed over, not cited in a sentence. What `inner` itself renders is left
|
|
11
|
+
* out on purpose, so the answer does not change while a file card swaps in or still loads.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasTextOutside(block: TextTreeNode, inner: TextTreeNode): boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function isLabelledFileLink(label, href) {
|
|
2
|
+
const text = label.trim();
|
|
3
|
+
return text !== "" && text !== href.trim();
|
|
4
|
+
}
|
|
5
|
+
const TEXT_NODE = 3;
|
|
6
|
+
export function hasTextOutside(block, inner) {
|
|
7
|
+
for (const child of Array.from(block.childNodes)) {
|
|
8
|
+
if (child === inner)
|
|
9
|
+
continue;
|
|
10
|
+
if (child.nodeType === TEXT_NODE ? (child.textContent ?? "").trim() !== "" : hasTextOutside(child, inner))
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WidgetGalleryStory } from '../../rendering/debug/widget-gallery.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
stories: readonly WidgetGalleryStory[];
|
|
4
|
+
};
|
|
5
|
+
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>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { provideEmbedConfig } from "../../embed/composables/embed-config";
|
|
3
|
+
import ChatVaultLink from "../../files/components/chat-vault-link.vue";
|
|
4
|
+
import OpenuiBlock from "../../rendering/components/openui-block.vue";
|
|
5
|
+
import { buildSlackPreview, groupWidgetStories } from "../../rendering/debug/widget-gallery";
|
|
6
|
+
import { OPENUI_ERROR_REPORTER_KEY, OPENUI_MARKDOWN_COMPONENTS_KEY } from "../../rendering/openui/context";
|
|
7
|
+
import { CHAT_MESSAGE_CONTEXT_KEY, CHAT_MESSAGE_SEND_KEY } from "../../types/messages";
|
|
8
|
+
import { createChatDebugCitationsConfig } from "../debug/chat-debug-citations";
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
stories: { type: Array, required: true }
|
|
11
|
+
});
|
|
12
|
+
const STREAM_TICK_MS = 40;
|
|
13
|
+
const STREAM_CHARACTERS_PER_TICK = 6;
|
|
14
|
+
const groups = computed(() => groupWidgetStories(props.stories));
|
|
15
|
+
const selectedId = ref(props.stories[0]?.id ?? "");
|
|
16
|
+
const selectedStory = computed(() => props.stories.find((story) => story.id === selectedId.value) ?? props.stories[0]);
|
|
17
|
+
const code = ref(selectedStory.value?.code ?? "");
|
|
18
|
+
const viewportWidth = ref("default");
|
|
19
|
+
const viewportOptions = [
|
|
20
|
+
{ id: "narrow", label: "Narrow" },
|
|
21
|
+
{ id: "default", label: "Default" },
|
|
22
|
+
{ id: "wide", label: "Wide" }
|
|
23
|
+
];
|
|
24
|
+
const streamedCharacters = ref(null);
|
|
25
|
+
const streaming = computed(() => streamedCharacters.value !== null);
|
|
26
|
+
const visibleCode = computed(() => streamedCharacters.value === null ? code.value : code.value.slice(0, streamedCharacters.value));
|
|
27
|
+
let streamTimer = null;
|
|
28
|
+
const mountRevision = ref(0);
|
|
29
|
+
const sentMessages = ref([]);
|
|
30
|
+
const widgetErrors = ref([]);
|
|
31
|
+
const slack = computed(() => buildSlackPreview(code.value));
|
|
32
|
+
const slackJson = computed(() => JSON.stringify(slack.value.blocks, null, 2));
|
|
33
|
+
provideEmbedConfig({
|
|
34
|
+
workspaceId: "chat-debug-widget-gallery",
|
|
35
|
+
hideSidebar: true,
|
|
36
|
+
citations: createChatDebugCitationsConfig()
|
|
37
|
+
}, { syncGlobal: false });
|
|
38
|
+
provide(CHAT_MESSAGE_CONTEXT_KEY, {
|
|
39
|
+
messageId: "chat-debug-widget-gallery",
|
|
40
|
+
role: "assistant",
|
|
41
|
+
isLatestMessage: ref(true),
|
|
42
|
+
streaming
|
|
43
|
+
});
|
|
44
|
+
provide(CHAT_MESSAGE_SEND_KEY, async (content) => {
|
|
45
|
+
sentMessages.value = [...sentMessages.value, content];
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
provide(OPENUI_ERROR_REPORTER_KEY, (errors) => {
|
|
49
|
+
widgetErrors.value = errors.map((error) => `${error.code}: ${error.message}`);
|
|
50
|
+
});
|
|
51
|
+
provide(OPENUI_MARKDOWN_COMPONENTS_KEY, ref({ link: ChatVaultLink }));
|
|
52
|
+
function stopStream() {
|
|
53
|
+
if (streamTimer)
|
|
54
|
+
clearInterval(streamTimer);
|
|
55
|
+
streamTimer = null;
|
|
56
|
+
streamedCharacters.value = null;
|
|
57
|
+
}
|
|
58
|
+
function remount() {
|
|
59
|
+
stopStream();
|
|
60
|
+
sentMessages.value = [];
|
|
61
|
+
widgetErrors.value = [];
|
|
62
|
+
mountRevision.value += 1;
|
|
63
|
+
}
|
|
64
|
+
function selectStory(story) {
|
|
65
|
+
selectedId.value = story.id;
|
|
66
|
+
code.value = story.code;
|
|
67
|
+
remount();
|
|
68
|
+
}
|
|
69
|
+
function playStream() {
|
|
70
|
+
remount();
|
|
71
|
+
streamedCharacters.value = 0;
|
|
72
|
+
streamTimer = setInterval(() => {
|
|
73
|
+
const next = (streamedCharacters.value ?? 0) + STREAM_CHARACTERS_PER_TICK;
|
|
74
|
+
if (next >= code.value.length)
|
|
75
|
+
stopStream();
|
|
76
|
+
else
|
|
77
|
+
streamedCharacters.value = next;
|
|
78
|
+
}, STREAM_TICK_MS);
|
|
79
|
+
}
|
|
80
|
+
async function copySlackJson() {
|
|
81
|
+
await navigator.clipboard.writeText(slackJson.value);
|
|
82
|
+
}
|
|
83
|
+
watch(code, () => {
|
|
84
|
+
widgetErrors.value = [];
|
|
85
|
+
});
|
|
86
|
+
onBeforeUnmount(stopStream);
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<template>
|
|
90
|
+
<section class="chat-debug-widget-gallery" w-full h-full bg text-primary>
|
|
91
|
+
<aside px-20px py-22px overflow-y-auto>
|
|
92
|
+
<div v-for="group in groups" :key="group.name" mb-20px>
|
|
93
|
+
<div body-caption-9-medium text-tertiary mb-10px>
|
|
94
|
+
{{ group.name }}
|
|
95
|
+
</div>
|
|
96
|
+
<div flex="~ col" gap-4px>
|
|
97
|
+
<button
|
|
98
|
+
v-for="story in group.stories"
|
|
99
|
+
:key="story.id"
|
|
100
|
+
type="button"
|
|
101
|
+
py-5px
|
|
102
|
+
text-left
|
|
103
|
+
group
|
|
104
|
+
:data-story="story.id"
|
|
105
|
+
@click="selectStory(story)"
|
|
106
|
+
>
|
|
107
|
+
<div flex items-center gap-7px>
|
|
108
|
+
<span
|
|
109
|
+
w-4px h-4px rounded-full shrink-0
|
|
110
|
+
:class="story.id === selectedId ? 'bg-gray-900' : 'bg-gray-300 group-hover:bg-gray-500'"
|
|
111
|
+
transition-colors
|
|
112
|
+
/>
|
|
113
|
+
<span
|
|
114
|
+
body-12-medium
|
|
115
|
+
truncate
|
|
116
|
+
:class="story.id === selectedId ? 'text-primary' : 'text-secondary group-hover:text-primary'"
|
|
117
|
+
transition-colors
|
|
118
|
+
>
|
|
119
|
+
{{ story.title }}
|
|
120
|
+
</span>
|
|
121
|
+
</div>
|
|
122
|
+
</button>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</aside>
|
|
126
|
+
|
|
127
|
+
<main min-w-0 min-h-0 flex="~ col">
|
|
128
|
+
<div h-48px px-24px flex items-center justify-between shrink-0>
|
|
129
|
+
<div flex items-center gap-8px body-11-regular text-tertiary>
|
|
130
|
+
<span>{{ selectedStory?.title }}</span>
|
|
131
|
+
<TelaDotSeparator />
|
|
132
|
+
<span>{{ streaming ? "streaming" : "complete" }}</span>
|
|
133
|
+
</div>
|
|
134
|
+
<div flex items-center gap-12px>
|
|
135
|
+
<div flex items-center gap-10px>
|
|
136
|
+
<button
|
|
137
|
+
v-for="option in viewportOptions"
|
|
138
|
+
:key="option.id"
|
|
139
|
+
type="button"
|
|
140
|
+
body-11-regular
|
|
141
|
+
:class="viewportWidth === option.id ? 'text-primary' : 'text-tertiary hover:text-secondary'"
|
|
142
|
+
transition-colors
|
|
143
|
+
@click="viewportWidth = option.id"
|
|
144
|
+
>
|
|
145
|
+
{{ option.label }}
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
148
|
+
<button type="button" body-11-regular text-tertiary hover:text-secondary transition-colors data-action="stream" @click="playStream">
|
|
149
|
+
Stream
|
|
150
|
+
</button>
|
|
151
|
+
<button type="button" body-11-regular text-tertiary hover:text-secondary transition-colors data-action="reset" @click="remount">
|
|
152
|
+
Reset
|
|
153
|
+
</button>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div min-h-0 grow overflow-y-auto px-24px pb-24px>
|
|
158
|
+
<div class="widget-under-test" :class="`widget-under-test--${viewportWidth}`" data-gallery="web">
|
|
159
|
+
<OpenuiBlock :key="mountRevision" :node="{ type: 'code_block', raw: visibleCode, code: visibleCode }" :loading="streaming" />
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div class="widget-under-test" :class="`widget-under-test--${viewportWidth}`" mt-24px>
|
|
163
|
+
<div body-caption-9-medium text-tertiary mb-8px>
|
|
164
|
+
Sent messages
|
|
165
|
+
</div>
|
|
166
|
+
<p v-if="!sentMessages.length" body-11-regular text-tertiary>
|
|
167
|
+
Buttons, forms and questions list here the user message they send.
|
|
168
|
+
</p>
|
|
169
|
+
<pre v-for="(message, index) in sentMessages" :key="index" class="gallery-code" body-12-regular mb-8px data-gallery="sent">{{ message }}</pre>
|
|
170
|
+
|
|
171
|
+
<template v-if="widgetErrors.length">
|
|
172
|
+
<div body-caption-9-medium text-tertiary mt-16px mb-8px>
|
|
173
|
+
Widget errors
|
|
174
|
+
</div>
|
|
175
|
+
<pre class="gallery-code" body-12-regular text-red-600 data-gallery="errors">{{ widgetErrors.join("\n") }}</pre>
|
|
176
|
+
</template>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</main>
|
|
180
|
+
|
|
181
|
+
<aside min-h-0 px-24px py-22px flex="~ col" gap-20px overflow-y-auto>
|
|
182
|
+
<div>
|
|
183
|
+
<div body-caption-9-medium text-tertiary mb-8px>
|
|
184
|
+
OpenUI Lang
|
|
185
|
+
</div>
|
|
186
|
+
<textarea
|
|
187
|
+
v-model="code"
|
|
188
|
+
class="gallery-code gallery-editor"
|
|
189
|
+
body-12-regular
|
|
190
|
+
spellcheck="false"
|
|
191
|
+
data-gallery="code"
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<div min-h-0>
|
|
196
|
+
<div flex items-center justify-between mb-8px>
|
|
197
|
+
<span body-caption-9-medium text-tertiary>Slack Block Kit · {{ slack.blocks.length }} blocks</span>
|
|
198
|
+
<span flex items-center gap-10px body-11-regular>
|
|
199
|
+
<button type="button" text-tertiary hover:text-secondary transition-colors @click="copySlackJson">
|
|
200
|
+
Copy
|
|
201
|
+
</button>
|
|
202
|
+
<a :href="slack.builderUrl" target="_blank" rel="noopener" text-tertiary hover:text-secondary transition-colors data-gallery="builder-link">
|
|
203
|
+
Block Kit Builder
|
|
204
|
+
</a>
|
|
205
|
+
</span>
|
|
206
|
+
</div>
|
|
207
|
+
<p body-11-regular text-tertiary mb-8px data-gallery="slack-note">
|
|
208
|
+
Renderer output, before the connector applies its own limits: it sends a long answer as a file instead of blocks.
|
|
209
|
+
</p>
|
|
210
|
+
<pre class="gallery-code" body-12-regular data-gallery="slack">{{ slackJson }}</pre>
|
|
211
|
+
</div>
|
|
212
|
+
</aside>
|
|
213
|
+
</section>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<style scoped>
|
|
217
|
+
.chat-debug-widget-gallery{display:grid;grid-template-columns:220px minmax(420px,1fr) minmax(360px,480px);overflow:hidden}.widget-under-test{margin-inline:auto;width:100%}.widget-under-test--narrow{max-width:520px}.widget-under-test--default{max-width:760px}.widget-under-test--wide{max-width:1040px}.gallery-code{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin:0;overflow-x:auto;padding:12px;white-space:pre-wrap;word-break:break-word}.gallery-editor{display:block;min-height:220px;outline:none;resize:vertical;width:100%}
|
|
218
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WidgetGalleryStory } from '../../rendering/debug/widget-gallery.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
stories: readonly WidgetGalleryStory[];
|
|
4
|
+
};
|
|
5
|
+
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>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SlackBlock } from '@meistrari/chat-ui-lang';
|
|
2
|
+
export type WidgetGalleryStory = {
|
|
3
|
+
id: string;
|
|
4
|
+
group: string;
|
|
5
|
+
title: string;
|
|
6
|
+
/** One OpenUI Lang program, without its fence. */
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
export type WidgetGalleryGroup = {
|
|
10
|
+
name: string;
|
|
11
|
+
stories: WidgetGalleryStory[];
|
|
12
|
+
};
|
|
13
|
+
export declare function groupWidgetStories(stories: readonly WidgetGalleryStory[]): WidgetGalleryGroup[];
|
|
14
|
+
export type SlackPreview = {
|
|
15
|
+
blocks: SlackBlock[];
|
|
16
|
+
/** The answer written out, which Slack uses for notifications. */
|
|
17
|
+
text: string;
|
|
18
|
+
builderUrl: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* What the Slack renderer produces for one program, published in a thread so send buttons stay clickable. The connector
|
|
22
|
+
* applies its own limits after it, such as sending a long answer as a file.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildSlackPreview(code: string): SlackPreview;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { renderSlackAnswer, UI_LANG_FENCE } from "@meistrari/chat-ui-lang";
|
|
2
|
+
export function groupWidgetStories(stories) {
|
|
3
|
+
const groups = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const story of stories)
|
|
5
|
+
groups.set(story.group, [...groups.get(story.group) ?? [], story]);
|
|
6
|
+
return [...groups].map(([name, grouped]) => ({ name, stories: grouped }));
|
|
7
|
+
}
|
|
8
|
+
const BLOCK_KIT_BUILDER_URL = "https://app.slack.com/block-kit-builder/";
|
|
9
|
+
const PREVIEW_THREAD_TS = "1700000000.000100";
|
|
10
|
+
const PREVIEW_MAX_BLOCKS = 40;
|
|
11
|
+
export function buildSlackPreview(code) {
|
|
12
|
+
const answer = code.trim() ? renderSlackAnswer(`\`\`\`${UI_LANG_FENCE}
|
|
13
|
+
${code}
|
|
14
|
+
\`\`\``, {
|
|
15
|
+
prose: (text) => [{ type: "markdown", text }],
|
|
16
|
+
threadTs: PREVIEW_THREAD_TS,
|
|
17
|
+
maxBlocks: PREVIEW_MAX_BLOCKS
|
|
18
|
+
}) : null;
|
|
19
|
+
const blocks = answer?.blocks ?? [];
|
|
20
|
+
return {
|
|
21
|
+
blocks,
|
|
22
|
+
text: answer?.text ?? "",
|
|
23
|
+
builderUrl: `${BLOCK_KIT_BUILDER_URL}#${encodeURIComponent(JSON.stringify({ blocks }))}`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -66,6 +66,7 @@ export declare const chatV3ThreadSchema: z.ZodObject<{
|
|
|
66
66
|
agentId: z.ZodString;
|
|
67
67
|
sessionId: z.ZodString;
|
|
68
68
|
title: z.ZodString;
|
|
69
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
69
70
|
createdAt: z.ZodString;
|
|
70
71
|
updatedAt: z.ZodString;
|
|
71
72
|
}, z.core.$strip>;
|
|
@@ -82,6 +83,7 @@ export declare const chatV3ThreadDetailSchema: z.ZodObject<{
|
|
|
82
83
|
agentId: z.ZodString;
|
|
83
84
|
sessionId: z.ZodString;
|
|
84
85
|
title: z.ZodString;
|
|
86
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
85
87
|
createdAt: z.ZodString;
|
|
86
88
|
updatedAt: z.ZodString;
|
|
87
89
|
session: z.ZodNullable<z.ZodObject<{
|
|
@@ -96,14 +98,20 @@ export type ChatV3ThreadDetail = z.infer<typeof chatV3ThreadDetailSchema>;
|
|
|
96
98
|
export declare const chatV3CreateThreadSchema: z.ZodObject<{
|
|
97
99
|
agentId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
98
100
|
title: z.ZodOptional<z.ZodString>;
|
|
101
|
+
folderId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
99
102
|
}, z.core.$strict>;
|
|
100
103
|
export type ChatV3CreateThread = z.infer<typeof chatV3CreateThreadSchema>;
|
|
104
|
+
/** Renames the thread, moves it into a folder (`folderId`) or out of one (`folderId: null`), or both. */
|
|
101
105
|
export declare const chatV3UpdateThreadSchema: z.ZodObject<{
|
|
102
|
-
title: z.ZodString
|
|
106
|
+
title: z.ZodOptional<z.ZodString>;
|
|
107
|
+
folderId: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
103
108
|
}, z.core.$strict>;
|
|
104
109
|
export type ChatV3UpdateThread = z.infer<typeof chatV3UpdateThreadSchema>;
|
|
110
|
+
/** `folderId=none` lists the threads outside every folder. */
|
|
111
|
+
export declare const CHAT_V3_NO_FOLDER = "none";
|
|
105
112
|
export declare const chatV3ThreadListQuerySchema: z.ZodObject<{
|
|
106
113
|
agentId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
114
|
+
folderId: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>]>>;
|
|
107
115
|
before: z.ZodOptional<z.ZodString>;
|
|
108
116
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
109
117
|
}, z.core.$strict>;
|
|
@@ -114,12 +122,52 @@ export declare const chatV3ThreadListSchema: z.ZodObject<{
|
|
|
114
122
|
agentId: z.ZodString;
|
|
115
123
|
sessionId: z.ZodString;
|
|
116
124
|
title: z.ZodString;
|
|
125
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
117
126
|
createdAt: z.ZodString;
|
|
118
127
|
updatedAt: z.ZodString;
|
|
119
128
|
}, z.core.$strip>>;
|
|
120
129
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
121
130
|
}, z.core.$strip>;
|
|
122
131
|
export type ChatV3ThreadList = z.infer<typeof chatV3ThreadListSchema>;
|
|
132
|
+
export declare const CHAT_V3_FOLDER_NAME_CHARS = 80;
|
|
133
|
+
/**
|
|
134
|
+
* A folder threads are kept in. Like the v1 groups it belongs to the workspace, the agent and the
|
|
135
|
+
* host's scope (`x-chat-conversation-scope`), not to a person, and it only organizes: a folder
|
|
136
|
+
* grants no access to the threads in it.
|
|
137
|
+
*/
|
|
138
|
+
export declare const chatV3FolderSchema: z.ZodObject<{
|
|
139
|
+
folderId: z.ZodString;
|
|
140
|
+
agentId: z.ZodString;
|
|
141
|
+
name: z.ZodString;
|
|
142
|
+
createdAt: z.ZodString;
|
|
143
|
+
updatedAt: z.ZodString;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
export type ChatV3Folder = z.infer<typeof chatV3FolderSchema>;
|
|
146
|
+
export declare const chatV3FolderListQuerySchema: z.ZodObject<{
|
|
147
|
+
agentId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
export type ChatV3FolderListQuery = z.infer<typeof chatV3FolderListQuerySchema>;
|
|
150
|
+
/** Every folder of the agent in the caller's scope, oldest first. */
|
|
151
|
+
export declare const chatV3FolderListSchema: z.ZodObject<{
|
|
152
|
+
folders: z.ZodArray<z.ZodObject<{
|
|
153
|
+
folderId: z.ZodString;
|
|
154
|
+
agentId: z.ZodString;
|
|
155
|
+
name: z.ZodString;
|
|
156
|
+
createdAt: z.ZodString;
|
|
157
|
+
updatedAt: z.ZodString;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type ChatV3FolderList = z.infer<typeof chatV3FolderListSchema>;
|
|
161
|
+
/** Send an `Idempotency-Key` header to retry safely. */
|
|
162
|
+
export declare const chatV3CreateFolderSchema: z.ZodObject<{
|
|
163
|
+
agentId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
export type ChatV3CreateFolder = z.infer<typeof chatV3CreateFolderSchema>;
|
|
167
|
+
export declare const chatV3UpdateFolderSchema: z.ZodObject<{
|
|
168
|
+
name: z.ZodString;
|
|
169
|
+
}, z.core.$strict>;
|
|
170
|
+
export type ChatV3UpdateFolder = z.infer<typeof chatV3UpdateFolderSchema>;
|
|
123
171
|
export declare const CHAT_V3_MESSAGE_PAGE: {
|
|
124
172
|
readonly default: 30;
|
|
125
173
|
readonly max: 100;
|
|
@@ -265,6 +313,7 @@ export declare const chatV3MessageSchema: z.ZodObject<{
|
|
|
265
313
|
textInVault: z.ZodBoolean;
|
|
266
314
|
reply: z.ZodString;
|
|
267
315
|
createdAt: z.ZodString;
|
|
316
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
268
317
|
fileCount: z.ZodNumber;
|
|
269
318
|
question: z.ZodNullable<z.ZodObject<{
|
|
270
319
|
eventId: z.ZodString;
|
|
@@ -322,6 +371,7 @@ export declare const chatV3MessageListSchema: z.ZodObject<{
|
|
|
322
371
|
textInVault: z.ZodBoolean;
|
|
323
372
|
reply: z.ZodString;
|
|
324
373
|
createdAt: z.ZodString;
|
|
374
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
325
375
|
fileCount: z.ZodNumber;
|
|
326
376
|
question: z.ZodNullable<z.ZodObject<{
|
|
327
377
|
eventId: z.ZodString;
|
|
@@ -43,12 +43,16 @@ export const CHAT_V3_THREAD_PAGE = { default: 30, max: 100 };
|
|
|
43
43
|
* write uuids, so the same agent always compares equal.
|
|
44
44
|
*/
|
|
45
45
|
const agentIdSchema = z.string().uuid().transform(id => id.toLowerCase());
|
|
46
|
+
/** A folder's id, lowercased like the agent's so the same folder always compares equal. */
|
|
47
|
+
const folderIdSchema = z.string().uuid().transform(id => id.toLowerCase());
|
|
46
48
|
/** A thread as the chat owns it: access and title here, history in the agent-api session. */
|
|
47
49
|
export const chatV3ThreadSchema = z.object({
|
|
48
50
|
threadId: z.string().uuid(),
|
|
49
51
|
agentId: z.string().uuid(),
|
|
50
52
|
sessionId: z.string().uuid(),
|
|
51
53
|
title: z.string(),
|
|
54
|
+
/** The folder it is kept in; `null` outside any folder. */
|
|
55
|
+
folderId: z.string().uuid().nullable(),
|
|
52
56
|
createdAt: z.string(),
|
|
53
57
|
updatedAt: z.string(),
|
|
54
58
|
});
|
|
@@ -64,12 +68,20 @@ export const chatV3ThreadDetailSchema = chatV3ThreadSchema.extend({ session: cha
|
|
|
64
68
|
export const chatV3CreateThreadSchema = z.object({
|
|
65
69
|
agentId: agentIdSchema,
|
|
66
70
|
title: z.string().trim().max(CHAT_V3_TITLE_CHARS).optional(),
|
|
71
|
+
/** Starts the thread inside this folder, which must be the agent's in the caller's scope. */
|
|
72
|
+
folderId: folderIdSchema.optional(),
|
|
67
73
|
}).strict();
|
|
74
|
+
/** Renames the thread, moves it into a folder (`folderId`) or out of one (`folderId: null`), or both. */
|
|
68
75
|
export const chatV3UpdateThreadSchema = z.object({
|
|
69
|
-
title: z.string().trim().max(CHAT_V3_TITLE_CHARS),
|
|
70
|
-
|
|
76
|
+
title: z.string().trim().max(CHAT_V3_TITLE_CHARS).optional(),
|
|
77
|
+
folderId: folderIdSchema.nullable().optional(),
|
|
78
|
+
}).strict().refine(body => body.title !== undefined || body.folderId !== undefined, { message: 'Send a title, a folderId or both' });
|
|
79
|
+
/** `folderId=none` lists the threads outside every folder. */
|
|
80
|
+
export const CHAT_V3_NO_FOLDER = 'none';
|
|
71
81
|
export const chatV3ThreadListQuerySchema = z.object({
|
|
72
82
|
agentId: agentIdSchema.optional(),
|
|
83
|
+
/** Only the threads of this folder, or with `none` only those outside every folder. */
|
|
84
|
+
folderId: z.union([z.literal(CHAT_V3_NO_FOLDER), folderIdSchema]).optional(),
|
|
73
85
|
/** Exclusive cursor: the last `threadId` of the previous page. */
|
|
74
86
|
before: z.string().uuid().optional(),
|
|
75
87
|
limit: z.coerce.number().int().min(1).max(CHAT_V3_THREAD_PAGE.max).default(CHAT_V3_THREAD_PAGE.default),
|
|
@@ -78,6 +90,35 @@ export const chatV3ThreadListSchema = z.object({
|
|
|
78
90
|
threads: z.array(chatV3ThreadSchema),
|
|
79
91
|
nextCursor: z.string().uuid().nullable(),
|
|
80
92
|
});
|
|
93
|
+
export const CHAT_V3_FOLDER_NAME_CHARS = 80;
|
|
94
|
+
const folderNameSchema = z.string().trim().min(1).max(CHAT_V3_FOLDER_NAME_CHARS);
|
|
95
|
+
/**
|
|
96
|
+
* A folder threads are kept in. Like the v1 groups it belongs to the workspace, the agent and the
|
|
97
|
+
* host's scope (`x-chat-conversation-scope`), not to a person, and it only organizes: a folder
|
|
98
|
+
* grants no access to the threads in it.
|
|
99
|
+
*/
|
|
100
|
+
export const chatV3FolderSchema = z.object({
|
|
101
|
+
folderId: z.string().uuid(),
|
|
102
|
+
agentId: z.string().uuid(),
|
|
103
|
+
name: z.string(),
|
|
104
|
+
createdAt: z.string(),
|
|
105
|
+
updatedAt: z.string(),
|
|
106
|
+
});
|
|
107
|
+
export const chatV3FolderListQuerySchema = z.object({
|
|
108
|
+
agentId: agentIdSchema,
|
|
109
|
+
}).strict();
|
|
110
|
+
/** Every folder of the agent in the caller's scope, oldest first. */
|
|
111
|
+
export const chatV3FolderListSchema = z.object({
|
|
112
|
+
folders: z.array(chatV3FolderSchema),
|
|
113
|
+
});
|
|
114
|
+
/** Send an `Idempotency-Key` header to retry safely. */
|
|
115
|
+
export const chatV3CreateFolderSchema = z.object({
|
|
116
|
+
agentId: agentIdSchema,
|
|
117
|
+
name: folderNameSchema,
|
|
118
|
+
}).strict();
|
|
119
|
+
export const chatV3UpdateFolderSchema = z.object({
|
|
120
|
+
name: folderNameSchema,
|
|
121
|
+
}).strict();
|
|
81
122
|
export const CHAT_V3_MESSAGE_PAGE = { default: 30, max: 100 };
|
|
82
123
|
/** How many files one message carries; with the message they stay within agent-api's batch. */
|
|
83
124
|
export const CHAT_V3_FILES_PER_MESSAGE = 10;
|
|
@@ -194,6 +235,8 @@ export const chatV3MessageSchema = z.object({
|
|
|
194
235
|
textInVault: z.boolean(),
|
|
195
236
|
reply: z.string(),
|
|
196
237
|
createdAt: z.string(),
|
|
238
|
+
/** When its turn ended (completed, failed, cancelled or uncertain); `null` while it is queued or running. */
|
|
239
|
+
completedAt: z.string().nullable(),
|
|
197
240
|
/** Files sent with the message. agent-api keeps no name for them, so only how many. */
|
|
198
241
|
fileCount: z.number().int().nonnegative(),
|
|
199
242
|
/** What the agent asked while answering, if it did: its turn ended waiting for the answer. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/chat-nuxt",
|
|
3
|
-
"version": "4.13.0-rc.
|
|
3
|
+
"version": "4.13.0-rc.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@iconify-json/ph": "^1.2.2",
|
|
53
53
|
"@iconify/vue": "^5.0.0",
|
|
54
54
|
"@meistrari/auth-nuxt": "3.31.0",
|
|
55
|
-
"@meistrari/chat-ui-lang": "0.
|
|
55
|
+
"@meistrari/chat-ui-lang": "0.8.1-rc.0",
|
|
56
56
|
"@meistrari/logger": "^2.1.3",
|
|
57
57
|
"@meistrari/tela-build": "^1.79.0",
|
|
58
58
|
"@openuidev/lang-core": "1.0.0",
|