@8wave/ai-elements 0.122.0-beta.1 → 0.122.0-beta.11
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/_chunks/{Agent-8tYRuiJc.js → Agent-BcmcalNN.js} +2 -1
- package/dist/_chunks/{Agent-8tYRuiJc.js.map → Agent-BcmcalNN.js.map} +1 -1
- package/dist/_chunks/PkChatbotFilePreview-D5jwgPp8.js.map +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-BAiI6n72.js → PkStreamingMarkdown-Dc0R0GHe.js} +22 -16
- package/dist/_chunks/PkStreamingMarkdown-Dc0R0GHe.js.map +1 -0
- package/dist/_chunks/PkToolChatFile-BsvJIdgo.js +181 -0
- package/dist/_chunks/PkToolChatFile-BsvJIdgo.js.map +1 -0
- package/dist/_chunks/{PkToolRequestGeolocation-D1n5Gvks.js → PkToolRequestGeolocation-n1W_drCv.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-D1n5Gvks.js.map → PkToolRequestGeolocation-n1W_drCv.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-2PzVZ_mh.js → PkToolRequestOAuthConnection-DmMeSF2m.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-2PzVZ_mh.js.map → PkToolRequestOAuthConnection-DmMeSF2m.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-B2jj0PEo.js → PkToolShowArtifact-BUnSqAWQ.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-B2jj0PEo.js.map → PkToolShowArtifact-BUnSqAWQ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DNJaM53a.js → PkToolShowContactForm-YX1BuolZ.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DNJaM53a.js.map → PkToolShowContactForm-YX1BuolZ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-Dbua7aMG.js → PkToolShowForm-CkpMsrEo.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-Dbua7aMG.js.map → PkToolShowForm-CkpMsrEo.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-nRTnWZUj.js → PkToolShowImageGallery-BnUnjFeU.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-nRTnWZUj.js.map → PkToolShowImageGallery-BnUnjFeU.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-NMRtT3fT.js → PkToolShowProductList-CPqmqS-Q.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-NMRtT3fT.js.map → PkToolShowProductList-CPqmqS-Q.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-CFcTbjcM.js → PkToolShowSources-BO1IhnmO.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-CFcTbjcM.js.map → PkToolShowSources-BO1IhnmO.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-CeK6mICV.js → PkToolShowSuggestedReply-79UAjTL4.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-CeK6mICV.js.map → PkToolShowSuggestedReply-79UAjTL4.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-BN3AaLy1.js → PkToolShowVideo-DYnH3VIc.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-BN3AaLy1.js.map → PkToolShowVideo-DYnH3VIc.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-DfBR8eAU.js → PkToolShowWebPages-Ci_Yut6X.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-DfBR8eAU.js.map → PkToolShowWebPages-Ci_Yut6X.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-C2-Hy63z.js → chatImagePolicy-B5-NwmIR.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-C2-Hy63z.js.map → chatImagePolicy-B5-NwmIR.js.map} +1 -1
- package/dist/_chunks/{markdown-B-_gMLvu.js → markdown-_sL6w03k.js} +2 -2
- package/dist/_chunks/{markdown-B-_gMLvu.js.map → markdown-_sL6w03k.js.map} +1 -1
- package/dist/ai-elements.es.js +65 -28
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-CYUPbFnK.js → Agent-BWwjGG2f.js} +2 -1
- package/dist-vue/_chunks/{Agent-CYUPbFnK.js.map → Agent-BWwjGG2f.js.map} +1 -1
- package/dist-vue/_chunks/{Document-BvZ768dH.js → Document-DvRaziIf.js} +2 -2
- package/dist-vue/_chunks/{Document-BvZ768dH.js.map → Document-DvRaziIf.js.map} +1 -1
- package/dist-vue/_chunks/PkAvatar-DwtZWSW4.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbot-BVw3-kJg.js → PkChatbot-B7JaLUZw.js} +8 -8
- package/dist-vue/_chunks/PkChatbot-B7JaLUZw.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-DuLoc_ym.js → PkChatbotEmptyState-B76oD7fB.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-DuLoc_ym.js.map → PkChatbotEmptyState-B76oD7fB.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotFilePreview-CzmGvKjI.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-XbH8I-uH.js → PkChatbotInput-BT51V-v4.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-XbH8I-uH.js.map → PkChatbotInput-BT51V-v4.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotMessageFeedback-DltXugdR.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-DcIpivBs.js → PkChatbotMessages-qkodgdDE.js} +17 -17
- package/dist-vue/_chunks/{PkChatbotMessages-DcIpivBs.js.map → PkChatbotMessages-qkodgdDE.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-DXhatUfJ.js → PkChatbotStepPayload-BYChvULZ.js} +2 -2
- package/dist-vue/_chunks/PkChatbotStepPayload-BYChvULZ.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-Sm5cPUAO.js → PkChatbotStepToolDetail-BysPl2ko.js} +3 -3
- package/dist-vue/_chunks/PkChatbotStepToolDetail-BysPl2ko.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotSteps-CWFBX7Rl.js → PkChatbotSteps-p8-SuGGe.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-CWFBX7Rl.js.map → PkChatbotSteps-p8-SuGGe.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-C_dLjNVo.js → PkChatbotViewChat-Djts78Oq.js} +7 -7
- package/dist-vue/_chunks/PkChatbotViewChat-Djts78Oq.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-DgOFajfO.js → PkChatbotViewConversations-4ZJF-y5q.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-DgOFajfO.js.map → PkChatbotViewConversations-4ZJF-y5q.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-DyKSUXeX.js → PkChatbotViewFiles-CfPwNcvf.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-DyKSUXeX.js.map → PkChatbotViewFiles-CfPwNcvf.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-BXrOGpjB.js → PkChatbotViewProfile-Dd8EhOx3.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-BXrOGpjB.js.map → PkChatbotViewProfile-Dd8EhOx3.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-B5vQ1ZZ8.js → PkStreamingMarkdown-B-sEx8BP.js} +378 -372
- package/dist-vue/_chunks/PkStreamingMarkdown-B-sEx8BP.js.map +1 -0
- package/dist-vue/_chunks/PkToolChatFile-s46esp0O.js +179 -0
- package/dist-vue/_chunks/PkToolChatFile-s46esp0O.js.map +1 -0
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BHqLXZDd.js → PkToolRequestGeolocation-e8vyxTI_.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BHqLXZDd.js.map → PkToolRequestGeolocation-e8vyxTI_.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Cg6T3gzF.js → PkToolRequestOAuthConnection-3zLvNF_c.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Cg6T3gzF.js.map → PkToolRequestOAuthConnection-3zLvNF_c.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-Clvs-28Q.js → PkToolShowArtifact-BRwa5pGY.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-Clvs-28Q.js.map → PkToolShowArtifact-BRwa5pGY.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-DA3KYufo.js → PkToolShowContactForm-xHBTmITM.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-DA3KYufo.js.map → PkToolShowContactForm-xHBTmITM.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-DxPuGWin.js → PkToolShowDiagram-DrJs92dg.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-DxPuGWin.js.map → PkToolShowDiagram-DrJs92dg.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DdA2UM-T.js → PkToolShowForm-Fv4iV0VY.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-DdA2UM-T.js.map → PkToolShowForm-Fv4iV0VY.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-B_dA0S6H.js → PkToolShowImageGallery-DD_RGcL6.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-B_dA0S6H.js.map → PkToolShowImageGallery-DD_RGcL6.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-ubDejlbK.js → PkToolShowProductList-8UQSQvRr.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-ubDejlbK.js.map → PkToolShowProductList-8UQSQvRr.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-CRGyOz2J.js → PkToolShowSources-C4rKpypf.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-CRGyOz2J.js.map → PkToolShowSources-C4rKpypf.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-zFmhR7Ju.js → PkToolShowSuggestedReply-Bnhgsh4l.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-zFmhR7Ju.js.map → PkToolShowSuggestedReply-Bnhgsh4l.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-LapBUydt.js → PkToolShowVideo-NOwtZPgI.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-LapBUydt.js.map → PkToolShowVideo-NOwtZPgI.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CSgdDZF6.js → PkToolShowWebPages-DcPboNwp.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CSgdDZF6.js.map → PkToolShowWebPages-DcPboNwp.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-rGWQSzZY.js → createChatbotApiClient-y6jA42S0.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-rGWQSzZY.js.map → createChatbotApiClient-y6jA42S0.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-BBUPN1Fa.js → useChatbotStore-DCXyql8U.js} +3 -3
- package/dist-vue/_chunks/{useChatbotStore-BBUPN1Fa.js.map → useChatbotStore-DCXyql8U.js.map} +1 -1
- package/dist-vue/_chunks/{utils-DAJhpoQS.js → utils-DaAIWTtt.js} +2 -2
- package/dist-vue/_chunks/{utils-DAJhpoQS.js.map → utils-DaAIWTtt.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +1 -3
- package/dist-vue/composables.js +44 -7
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +30 -26
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +50 -10
- package/dist-vue/packages/components/src/chat/PkToolChatFile.d.ts +3 -1
- package/dist-vue/packages/models/src/schema/Agent.d.ts +2 -1
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkStreamingMarkdown-BAiI6n72.js.map +0 -1
- package/dist/_chunks/PkToolChatFile-BuA7AOQ8.js +0 -50
- package/dist/_chunks/PkToolChatFile-BuA7AOQ8.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-BVw3-kJg.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotStepPayload-DXhatUfJ.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotStepToolDetail-Sm5cPUAO.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-C_dLjNVo.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-B5vQ1ZZ8.js.map +0 -1
- package/dist-vue/_chunks/PkToolChatFile-BC_DO--d.js +0 -49
- package/dist-vue/_chunks/PkToolChatFile-BC_DO--d.js.map +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Ot as e, R as t, S as n, h as r, k as i, v as a, w as o, wt as s, y as c } from "./vue.runtime.esm-bundler-DQaOHfo6.js";
|
|
2
|
-
import { r as l } from "./vue-i18n-DjRtpHH3.js";
|
|
3
|
-
import { f as u, v as d } from "./Agent-8tYRuiJc.js";
|
|
4
|
-
import { t as f } from "./PkChatbotFilePreview-D5jwgPp8.js";
|
|
5
|
-
// ../../packages/components/src/chat/PkToolChatFile.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
i(), s();
|
|
7
|
-
var p = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "pk-tool-chat-file"
|
|
10
|
-
}, m = {
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "text-12 text-word-3 mt-xs mb-0"
|
|
13
|
-
}, h = /* @__PURE__ */ o({
|
|
14
|
-
__name: "PkToolChatFile",
|
|
15
|
-
props: {
|
|
16
|
-
part: { type: null },
|
|
17
|
-
fileUrl: { type: Function }
|
|
18
|
-
},
|
|
19
|
-
setup(i) {
|
|
20
|
-
let o = /* @__PURE__ */ new Set(["tool-editWordDocument", "tool-createWordDocument"]), s = i, { t: h } = l({ useScope: "global" }), g = r(() => {
|
|
21
|
-
let e = s.part;
|
|
22
|
-
if (e.state !== "output-available" || !e.output?.storedFileName) return;
|
|
23
|
-
let t = e.output;
|
|
24
|
-
return o.has(e.type ?? "") ? {
|
|
25
|
-
output: t,
|
|
26
|
-
mediaType: d,
|
|
27
|
-
changed: t.changedParagraphs === void 0 ? void 0 : h("messagePart.editWordDocumentParagraphs", t.changedParagraphs)
|
|
28
|
-
} : {
|
|
29
|
-
output: t,
|
|
30
|
-
mediaType: u,
|
|
31
|
-
changed: t.changedCells === void 0 ? void 0 : h("messagePart.editSpreadsheetCells", t.changedCells)
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
return (r, o) => g.value ? (t(), c("div", p, [n(f, {
|
|
35
|
-
"media-type": g.value.mediaType,
|
|
36
|
-
url: i.fileUrl(g.value.output.storedFileName),
|
|
37
|
-
filename: g.value.output.filename,
|
|
38
|
-
size: g.value.output.sizeBytes,
|
|
39
|
-
"show-download": ""
|
|
40
|
-
}, null, 8, [
|
|
41
|
-
"media-type",
|
|
42
|
-
"url",
|
|
43
|
-
"filename",
|
|
44
|
-
"size"
|
|
45
|
-
]), g.value.changed ? (t(), c("p", m, e(g.value.changed), 1)) : a("", !0)])) : a("", !0);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
export { h as default };
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=PkToolChatFile-BuA7AOQ8.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolChatFile-BuA7AOQ8.js","names":["_openBlock","_createElementBlock","_createVNode","PkChatbotFilePreview","_toDisplayString","_createCommentVNode","_sfc_main","toDisplayString","openBlock","createVNode","computed","init_runtime_core_esm_bundler","createCommentVNode","defineComponent","init_shared_esm_bundler","createElementBlock","useI18n","SPREADSHEET_MIME_TYPE","WORD_MIME_TYPE","PkChatbotFilePreview_default","_hoisted_1","_hoisted_2","PkToolChatFile_default","WORD_TOOL_PARTS","props","__props","$t","file","part","output"],"sources":["../../../../packages/components/src/chat/PkToolChatFile.vue","../../../../packages/components/src/chat/PkToolChatFile.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { SPREADSHEET_MIME_TYPE, WORD_MIME_TYPE } from 'models'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n\n /** What the four file tools return that the card shows. */\n type ChatFileOutput = {\n storedFileName: string\n filename?: string\n sizeBytes?: number\n changedCells?: number\n changedParagraphs?: number\n }\n\n /** The tools whose output is a Word document; the others write a spreadsheet. */\n const WORD_TOOL_PARTS = new Set([\n 'tool-editWordDocument',\n 'tool-createWordDocument',\n ])\n\n /**\n * The file a call of `editSpreadsheet`, `editWordDocument`,\n * `createSpreadsheet` or `createWordDocument` wrote, a new version or a\n * new file, to download. Drawn once the call has an output: while it runs,\n * the feed's activity indicator names it, and a refused call is explained\n * by the answer.\n */\n const props = defineProps<{\n part: unknown\n /** The authenticated download URL of a file stored in this chat. */\n fileUrl: (storedFileName: string) => string\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const file = computed(() => {\n const part = props.part as {\n type?: string\n state?: string\n output?: Partial<ChatFileOutput>\n }\n if (part.state !== 'output-available' || !part.output?.storedFileName) {\n return undefined\n }\n const output = part.output as ChatFileOutput\n // A new file has no count of changes.\n if (WORD_TOOL_PARTS.has(part.type ?? '')) {\n return {\n output,\n mediaType: WORD_MIME_TYPE,\n changed:\n output.changedParagraphs !== undefined\n ? $t(\n 'messagePart.editWordDocumentParagraphs',\n output.changedParagraphs,\n )\n : undefined,\n }\n }\n return {\n output,\n mediaType: SPREADSHEET_MIME_TYPE,\n changed:\n output.changedCells !== undefined\n ? $t(\n 'messagePart.editSpreadsheetCells',\n output.changedCells,\n )\n : undefined,\n }\n })\n</script>\n\n<template>\n <div v-if=\"file\" class=\"pk-tool-chat-file\">\n <PkChatbotFilePreview\n :media-type=\"file.mediaType\"\n :url=\"fileUrl(file.output.storedFileName)\"\n :filename=\"file.output.filename\"\n :size=\"file.output.sizeBytes\"\n show-download />\n <p v-if=\"file.changed\" class=\"text-12 text-word-3 mt-xs mb-0\">\n {{ file.changed }}\n </p>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { SPREADSHEET_MIME_TYPE, WORD_MIME_TYPE } from 'models'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n\n /** What the four file tools return that the card shows. */\n type ChatFileOutput = {\n storedFileName: string\n filename?: string\n sizeBytes?: number\n changedCells?: number\n changedParagraphs?: number\n }\n\n /** The tools whose output is a Word document; the others write a spreadsheet. */\n const WORD_TOOL_PARTS = new Set([\n 'tool-editWordDocument',\n 'tool-createWordDocument',\n ])\n\n /**\n * The file a call of `editSpreadsheet`, `editWordDocument`,\n * `createSpreadsheet` or `createWordDocument` wrote, a new version or a\n * new file, to download. Drawn once the call has an output: while it runs,\n * the feed's activity indicator names it, and a refused call is explained\n * by the answer.\n */\n const props = defineProps<{\n part: unknown\n /** The authenticated download URL of a file stored in this chat. */\n fileUrl: (storedFileName: string) => string\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const file = computed(() => {\n const part = props.part as {\n type?: string\n state?: string\n output?: Partial<ChatFileOutput>\n }\n if (part.state !== 'output-available' || !part.output?.storedFileName) {\n return undefined\n }\n const output = part.output as ChatFileOutput\n // A new file has no count of changes.\n if (WORD_TOOL_PARTS.has(part.type ?? '')) {\n return {\n output,\n mediaType: WORD_MIME_TYPE,\n changed:\n output.changedParagraphs !== undefined\n ? $t(\n 'messagePart.editWordDocumentParagraphs',\n output.changedParagraphs,\n )\n : undefined,\n }\n }\n return {\n output,\n mediaType: SPREADSHEET_MIME_TYPE,\n changed:\n output.changedCells !== undefined\n ? $t(\n 'messagePart.editSpreadsheetCells',\n output.changedCells,\n )\n : undefined,\n }\n })\n</script>\n\n<template>\n <div v-if=\"file\" class=\"pk-tool-chat-file\">\n <PkChatbotFilePreview\n :media-type=\"file.mediaType\"\n :url=\"fileUrl(file.output.storedFileName)\"\n :filename=\"file.output.filename\"\n :size=\"file.output.sizeBytes\"\n show-download />\n <p v-if=\"file.changed\" class=\"text-12 text-word-3 mt-xs mb-0\">\n {{ file.changed }}\n </p>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAgBI,IAAMuB,oBAAkB,IAAI,IAAI,CAC5B,yBACA,yBACJ,CAAC,GASKC,IAAQC,GAMR,EAAE,GAAGC,MAAOV,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1CW,IAAOjB,QAAe;GACxB,IAAMkB,IAAOJ,EAAM;GAKnB,IAAII,EAAK,UAAU,sBAAsB,CAACA,EAAK,QAAQ,gBACnD;GAEJ,IAAMC,IAASD,EAAK;GAepB,OAbIL,EAAgB,IAAIK,EAAK,QAAQ,EAAE,IAC5B;IACH;IACA,WAAWV;IACX,SACIW,EAAO,sBAAsB,KAAA,IAKvB,KAAA,IAJAH,EACI,0CACAG,EAAO,iBACX;GAEd,IAEG;IACH;IACA,WAAWZ;IACX,SACIY,EAAO,iBAAiB,KAAA,IAKlB,KAAA,IAJAH,EACI,oCACAG,EAAO,YACX;GAEd;EACJ,CAAC;E,iBAIUF,EAAA,SAAX3B,EAAA,GAAAC,EAUM,OAVNmB,GAUM,CATFlB,EAKoBC,GAAA;GAJf,cAAYwB,EAAA,MAAK;GACjB,KAAKF,EAAA,QAAQE,EAAA,MAAK,OAAO,cAAc;GACvC,UAAUA,EAAA,MAAK,OAAO;GACtB,MAAMA,EAAA,MAAK,OAAO;GACnB,iBAAA;;;;;;E,IACKA,EAAA,MAAK,WAAd3B,EAAA,GAAAC,EAEI,KAFJoB,GAEIjB,EADGuB,EAAA,MAAK,OAAO,GAAA,CAAA,K"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbot-BVw3-kJg.js","names":["_useModel","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","__unplugin_components_5","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_createElementVNode","_unref","_Fragment","_createVNode","_mergeProps","_createBlock","PkAvatar","_createCommentVNode","_toDisplayString","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createTextVNode","PkChatbotViewChat","_createSlots","_renderList","PkChatbotViewConversations","PkChatbotViewFiles","PkChatbotViewProfile","PkStreamingMarkdown","_sfc_main","VvButtonLocalized","provideChatImagePolicy","PkStreamingMarkdown_default","useChatbotStore","agentThemeStyle","resolveContrastColor","PkChatbotViewConversations_default","PkChatbotViewChat_default","provideShortUrlResolver","PkChatbotViewFiles_default","useLocalizedString","PkAvatar_default","ChatbotProfileContextKey","PkChatbotViewProfile_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","PkChatbot_default","defineComponent","\"chatId\"","\"chatIdModifiers\"","__expose","__emit","slots","useSlots","$t","useI18n","props","__props","emit","chatId","useModel","store","hashes","storeToRefs","storeAgentId","toRef","profile","inject","canManageProfile","computed","canSignIn","watch","canManage","activeView","navigate","watchEffect","id","localChatId","chatError","error","parsedError","isFullscreen","isPanel","chatbotEl","useTemplateRef","chatbotWidth","useElementSize","isPhoneWidth","isTightWidth","isWideWidth","isReasoningAgent","showReasoningNotice","messages","message","useColorsForAgentHeader","showHeaderMenu","pageAccessAvailable","themeClass","isDark","mainColor","contrastColor","themeStyle","footerMessage","title","activeMessage","newAgentId","newChatId","newView","_component_VvButton","_component_VvIcon","VvIcon","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","_component_VvButtonGroup","VvButtonGroup","_component_VvAlert","VvAlert","openBlock","createElementBlock","normalizeClass","normalizeStyle","createCommentVNode","createElementVNode","unref","createBlock","Fragment","createVNode","mergeProps","_cache","toDisplayString","withCtx","renderSlot","_ctx","normalizeProps","guardReactiveProps","startNewChat","stopGeneration","createTextVNode","setPageAccessOff","pageAccessOff","$event","createSlots","renderList","slotName","slotData"],"sources":["../../../../packages/components/src/chat/PkChatbot.vue","../../../../packages/components/src/chat/PkChatbot.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import {\n computed,\n inject,\n toRef,\n useTemplateRef,\n watch,\n watchEffect,\n useSlots,\n } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type {\n AgentInterface,\n AgentModel,\n AgentFileUpload,\n AgentGatewayOptions,\n AgentVoiceCapability,\n ChatMessageActions,\n RevisedAnswer,\n UIChatMessage,\n AgentTools,\n HostToolsCapability,\n PageAccessCapability,\n } from 'models'\n import {\n type RegisteredHostTool,\n useChatbotStore,\n useLocalizedString,\n provideShortUrlResolver,\n } from 'composables'\n import PkAvatar from './PkAvatar.vue'\n import PkChatbotViewChat from './PkChatbotViewChat.vue'\n import PkChatbotViewConversations from './PkChatbotViewConversations.vue'\n import PkChatbotViewFiles from './PkChatbotViewFiles.vue'\n import PkChatbotViewProfile from './PkChatbotViewProfile.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n import { provideChatImagePolicy } from './chatImagePolicy'\n import { agentThemeStyle, resolveContrastColor } from './utils'\n\n // Captured in script setup to avoid TS7022 circular inference in template\n const slots = useSlots()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n const props = defineProps<{\n baseUrl: string\n basePath?: string\n agentId: string\n agentType?: 'reasoning' | 'chat'\n userId?: string\n name?: string\n model?: string\n agentModel?: AgentModel\n agentTools?: AgentTools\n agentInterface?: AgentInterface\n actions?: ChatMessageActions[]\n revisedAnswers?: RevisedAnswer[]\n headers?: Record<string, string>\n systemTheme?: 'light' | 'dark'\n agentFileUpload?: AgentFileUpload\n /** Voice configuration from the agent settings: enables the talk button. */\n voice?: AgentVoiceCapability\n fallbackModels?: string[]\n gatewayOptions?: Partial<AgentGatewayOptions>\n externalContext?: Record<string, unknown>\n /** Host tools as the agent allows them (`capabilities.hostTools` of the public agent). */\n hostTools?: HostToolsCapability\n /** Tools the embedding app registered, with the function that runs each (spec `host-tools.md`). */\n hostToolRegistry?: RegisteredHostTool[]\n /** Page access as the agent allows it (`capabilities.pageAccess`, spec `page-tools.md`). */\n pageAccess?: PageAccessCapability\n /** The widget's page tools: only the web component provides them. */\n pageToolRegistry?: RegisteredHostTool[]\n /** The tools of the forms annotated on the page now, read on every request. */\n pageForms?: () => RegisteredHostTool[]\n /** Layout modifier: `widget` (default) keeps the contained layout with header, `fullscreen` removes header/background for full-page usage (the page provides the chrome), `panel` keeps the header but slims it down for a docked side panel (the host provides background and border) */\n modifier?: 'widget' | 'fullscreen' | 'panel'\n /** Display name of the current user, used for the `{name}` placeholder in the fullscreen greeting */\n userName?: string\n /** Show the \"Files in this chat\" menu for hosts that don't provide the\n * profile context but whose user is authenticated (e.g. the backoffice\n * playground). The widget host relies on `canManageProfile` instead. */\n userFilesEnabled?: boolean\n }>()\n const emit = defineEmits<{\n 'message-update': [message: UIChatMessage]\n 'show-info': [message: UIChatMessage]\n revise: [message: UIChatMessage]\n error: [error: { type: string; title: string; status: number }]\n /** That conversation is loaded: a message sent now lands in it. */\n loaded: [chatId: string]\n }>()\n\n const chatId = defineModel<string | undefined>('chatId', {\n type: String,\n default: undefined,\n })\n\n const store = useChatbotStore(props.agentId)\n\n // Resolve backend short-urls (`/api/r/<hash>`) back to their real target\n // for display in tool components. Batched + cached across the chat tree.\n provideShortUrlResolver((hashes) =>\n store.apiClient.resolveShortUrls(hashes),\n )\n\n const {\n messages,\n localChatId,\n activeView,\n chatError,\n isDark,\n pageAccessAvailable,\n pageAccessOff,\n } = storeToRefs(store)\n\n // Ref to store.agentId for watchers (avoids duplicate-key with agentId prop)\n const storeAgentId = toRef(store, 'agentId')\n\n const {\n startNewChat,\n stopGeneration,\n regenerate,\n navigate,\n sendMessage,\n setPageAccessOff,\n } = store\n\n // Images in the answers and the tool cards load by themselves only from\n // the backend this chat talks to and from the hosts the agent lists.\n provideChatImagePolicy(\n () => props.agentInterface?.imageHosts,\n () => props.baseUrl,\n )\n\n // Optional profile-management context provided by the host widget.\n // Present only for authenticated, non-anonymous sessions.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canManageProfile = computed(\n () => profile?.canManageProfile.value ?? false,\n )\n // Anonymous users get a \"Sign in\" entry instead of the profile one,\n // provided the host filled the `view-auth` slot and the agent has at\n // least one auth method enabled.\n const canSignIn = computed(\n () =>\n !canManageProfile.value &&\n (profile?.canSignIn?.value ?? false) &&\n slots['view-auth'] !== undefined,\n )\n\n // Once the sign-in completes (the session becomes non-anonymous) leave\n // the auth view and return to the conversation.\n watch(canManageProfile, (canManage) => {\n if (canManage && activeView.value === 'auth') {\n navigate('chat')\n }\n })\n\n // Sync props → store reactively\n watchEffect(() => {\n store.baseUrl = props.baseUrl\n store.basePath = props.basePath\n store.name = props.name\n store.agentType = props.agentType\n store.userId = props.userId\n store.agentInterface = props.agentInterface\n store.agentModel = props.agentModel\n store.agentTools = props.agentTools\n store.headers = props.headers\n store.revisedAnswers = props.revisedAnswers\n store.model = props.model\n store.actionsInput = props.actions\n store.agentFileUpload = props.agentFileUpload\n store.agentVoice = props.voice\n store.fallbackModels = props.fallbackModels\n store.gatewayOptions = props.gatewayOptions\n store.externalContext = props.externalContext\n store.agentHostTools = props.hostTools\n store.hostToolRegistry = props.hostToolRegistry\n store.agentPageAccess = props.pageAccess\n store.pageToolRegistry = props.pageToolRegistry\n store.pageFormsProvider = props.pageForms\n store.systemTheme = props.systemTheme\n store.hideWelcomeMessage = props.modifier === 'fullscreen'\n })\n\n // Sync chatId v-model ↔ store (bidirectional)\n // Parent → store: if the parent provides an external chatId, push it into\n // the store so the Chat instance picks it up.\n watch(\n () => chatId.value,\n (id) => {\n if (id && id !== store.localChatId) {\n store.localChatId = id\n }\n },\n { immediate: true },\n )\n // Store → parent: keep the v-model in sync whenever the store changes\n // the chatId internally (e.g. startNewChat).\n watch(localChatId, (id) => {\n chatId.value = id\n })\n\n // Emit structured errors from chat to the parent component\n watch(chatError, (error) => {\n if (!error) {\n return\n }\n try {\n const parsedError = JSON.parse(error.message) as {\n type: string\n title: string\n status: number\n }\n emit('error', parsedError)\n } catch {\n // ignore non-JSON errors\n }\n })\n\n // ui\n const isFullscreen = computed(() => props.modifier === 'fullscreen')\n const isPanel = computed(() => props.modifier === 'panel')\n\n /**\n * How much room the chat has, measured on the chat and not on the window.\n *\n * The same chat renders in a phone page, in a 408px widget, in a docked\n * panel and in a preview frame that the side panels squeeze to phone width\n * on a desktop screen, so the viewport says nothing about the space the\n * layout actually has. A CSS container query would read the same number\n * with no JavaScript, but `container-type` makes the element a containing\n * block for `position: fixed` descendants on every engine except Chrome\n * 129 and later, which displaces every dropdown in the chat: see\n * docs/agents/gotchas.md, \"The chat measures its own width, and not with a\n * container query\".\n *\n * The thresholds carry the modifiers, so the CSS stays declarative:\n * `--phone` has as much room as a phone page, `--tight` is too tight for\n * the agent chip beside the field, `--wide` has room for the outline rail\n * beside the reading column. Before the first measurement the width is 0\n * and no modifier applies, which is the roomy layout the base CSS writes.\n */\n const chatbotEl = useTemplateRef<HTMLDivElement>('chatbotEl')\n const { width: chatbotWidth } = useElementSize(chatbotEl)\n const isPhoneWidth = computed(\n () => chatbotWidth.value > 0 && chatbotWidth.value < 576,\n )\n const isTightWidth = computed(\n () => chatbotWidth.value > 0 && chatbotWidth.value < 640,\n )\n const isWideWidth = computed(() => chatbotWidth.value >= 848)\n const isReasoningAgent = computed(() => props.agentType === 'reasoning')\n // The notice says how a reasoning agent reads a message: it stands before\n // the first one, then leaves the room to the answers (pinned, it took a\n // third of a phone screen in the reasoning playground)\n const showReasoningNotice = computed(\n () =>\n isReasoningAgent.value &&\n !messages.value.some((message) => message.role === 'user'),\n )\n // A docked panel keeps a neutral header whatever the agent asks: it sits\n // beside the site or the app as part of the frame, and a colored band\n // made it read as a second site next to the first one.\n const useColorsForAgentHeader = computed(\n () => !isPanel.value && props.agentInterface?.useColorsForAgentHeader,\n )\n // Panel mode promotes the everyday actions (new chat, history) from the\n // dropdown to direct header buttons: the dropdown then only remains for\n // the secondary entries (files, profile, sign-in) and disappears when\n // none of them applies.\n const showHeaderMenu = computed(\n () =>\n !isPanel.value ||\n canManageProfile.value ||\n canSignIn.value ||\n pageAccessAvailable.value ||\n (!!props.userFilesEnabled && !!localChatId.value),\n )\n const themeClass = computed(() => [\n 'theme',\n `theme--${isDark.value ? 'dark' : 'light'}`,\n ])\n const mainColor = computed(() => props.agentInterface?.mainColor)\n const contrastColor = computed(() =>\n resolveContrastColor(props.agentInterface?.textColor, mainColor.value),\n )\n const themeStyle = computed(() =>\n agentThemeStyle(mainColor.value, contrastColor.value),\n )\n const footerMessage = useLocalizedString(\n () => props.agentInterface?.footerMessage,\n )\n const title = computed(() => {\n if (activeView.value === 'conversations') {\n return $t('label.conversations')\n }\n if (activeView.value === 'profile') {\n return $t('label.profile')\n }\n if (activeView.value === 'auth') {\n return $t('label.authentication')\n }\n if (activeView.value === 'files') {\n return $t('userFiles.chatFilesTitle')\n }\n return props.name\n })\n\n // state\n const activeMessage = computed(() => {\n return messages.value?.[messages.value.length - 1]\n })\n\n // expose\n defineExpose({\n startNewChat,\n regenerate,\n stopGeneration,\n sendMessage,\n })\n\n // load chat, conversations and feedbacks on agent or chat change\n watch(\n [storeAgentId, localChatId],\n async ([newAgentId, newChatId]) => {\n await store.initialize(newAgentId, newChatId)\n emit('loaded', newChatId)\n },\n {\n immediate: true,\n },\n )\n // load conversations when navigating to conversations view\n watch(activeView, (newView) => {\n if (newView === 'conversations') {\n store.loadConversations(storeAgentId.value)\n } else if (newView === 'files') {\n store.loadChatFiles()\n }\n })\n // emit message updates for up-to-date context in parent components\n watch(\n activeMessage,\n (message) => {\n if (message) {\n emit('message-update', message)\n }\n },\n {\n deep: true,\n immediate: true,\n },\n )\n</script>\n\n<template>\n <div\n ref=\"chatbotEl\"\n class=\"pk-chatbot\"\n :class=\"[\n themeClass,\n {\n 'pk-chatbot--fullscreen': isFullscreen,\n 'pk-chatbot--panel': isPanel,\n 'pk-chatbot--phone': isPhoneWidth,\n 'pk-chatbot--tight': isTightWidth,\n 'pk-chatbot--wide': isWideWidth,\n },\n ]\"\n :style=\"themeStyle\">\n <!-- #region title -->\n <div\n v-if=\"!isFullscreen\"\n class=\"pk-chatbot__header\"\n :style=\"\n useColorsForAgentHeader\n ? {\n backgroundColor: mainColor,\n }\n : undefined\n \">\n <div class=\"pk-chatbot__header-start\">\n <template v-if=\"activeView !== 'chat'\">\n <VvButton\n v-bind=\"{\n modifiers: useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet',\n icon: 'ri:arrow-left-s-line',\n title: $t('action.goBack'),\n }\"\n @click=\"navigate('chat')\" />\n <VvIcon\n :name=\"\n activeView === 'conversations'\n ? 'ri:history-line'\n : activeView === 'files'\n ? 'ri:attachment-2'\n : 'ri:user-line'\n \"\n class=\"pk-chatbot__nav-icon\"\n :style=\"\n useColorsForAgentHeader\n ? {\n color: contrastColor,\n }\n : undefined\n \" />\n </template>\n <!-- Panel mode: no avatar, the docked panel identifies the\n agent with the title alone -->\n <PkAvatar\n v-else-if=\"!isPanel\"\n class=\"pk-chatbot__avatar\"\n :name\n :img-src=\"agentInterface?.logo\" />\n <strong\n class=\"pk-chatbot__title\"\n :title=\"title\"\n :style=\"\n useColorsForAgentHeader\n ? {\n color: contrastColor,\n }\n : undefined\n \">\n {{ title }}\n </strong>\n </div>\n <VvButtonGroup class=\"pk-chatbot__header-end\" modifiers=\"compact\">\n <slot\n name=\"header-actions\"\n v-bind=\"{\n mainColor,\n useColorsForAgentHeader,\n contrastColor,\n startNewChat,\n stopGeneration,\n }\" />\n <template v-if=\"isPanel\">\n <VvButton\n :modifiers=\"\n useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet'\n \"\n icon=\"ri:edit-box-line\"\n :title=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n <VvButton\n v-if=\"!isReasoningAgent\"\n :modifiers=\"\n useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet'\n \"\n icon=\"ri:history-line\"\n :title=\"$t('action.viewRecentChats')\"\n @click=\"navigate('conversations')\" />\n </template>\n <VvDropdown\n v-if=\"showHeaderMenu\"\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n v-bind=\"{\n modifiers: useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet',\n icon: 'ri:more-2-fill',\n title: $t('action.moreActions'),\n }\" />\n <template #items>\n <VvDropdownAction\n v-if=\"!isPanel\"\n @click=\"startNewChat()\">\n <VvIcon name=\"ri:edit-box-line\" />\n {{ $t('action.startNewChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n v-if=\"!isReasoningAgent && !isPanel\"\n @click=\"navigate('conversations')\">\n <VvIcon name=\"ri:history-line\" />\n {{ $t('action.viewRecentChats') }}\n </VvDropdownAction>\n <VvDropdownAction\n v-if=\"\n (canManageProfile || userFilesEnabled) &&\n localChatId\n \"\n @click=\"navigate('files')\">\n <VvIcon name=\"ri:attachment-2\" />\n {{ $t('userFiles.chatFilesTitle') }}\n </VvDropdownAction>\n <!-- The user's own switch for the page tools, for\n this tab (spec page-tools.md) -->\n <VvDropdownAction\n v-if=\"pageAccessAvailable\"\n @click=\"setPageAccessOff(!pageAccessOff)\">\n <VvIcon\n :name=\"\n pageAccessOff\n ? 'ri:pages-line'\n : 'ri:forbid-line'\n \" />\n {{\n pageAccessOff\n ? $t('action.enablePageAccess')\n : $t('action.disablePageAccess')\n }}\n </VvDropdownAction>\n <VvDropdownAction\n v-if=\"canManageProfile\"\n @click=\"navigate('profile')\">\n <VvIcon name=\"ri:user-line\" />\n {{ $t('label.profile') }}\n </VvDropdownAction>\n <VvDropdownAction\n v-else-if=\"canSignIn\"\n @click=\"navigate('auth')\">\n <VvIcon name=\"ri:account-circle-line\" />\n {{ $t('action.signIn') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n <slot\n name=\"actions\"\n v-bind=\"{\n mainColor,\n useColorsForAgentHeader,\n contrastColor,\n startNewChat,\n stopGeneration,\n }\" />\n </VvButtonGroup>\n </div>\n <!-- #endregion -->\n\n <div v-if=\"showReasoningNotice\">\n <div class=\"pk-chatbot__warning-body\">\n <VvAlert modifiers=\"callout\">\n <div class=\"pk-chatbot__warning-header\">\n <VvIcon\n name=\"ri:alert-line\"\n class=\"pk-chatbot__warning-icon\" />\n <strong class=\"pk-chatbot__warning-title\">\n {{ $t('message.warning') }}\n </strong>\n </div>\n <p class=\"pk-chatbot__warning-text\">\n {{ $t('message.reasoningAgent') }}\n </p>\n </VvAlert>\n </div>\n </div>\n\n <!-- #region views -->\n <PkChatbotViewChat\n v-if=\"activeView === 'chat'\"\n :agent-id\n :modifier\n :user-name\n @show-info=\"emit('show-info', $event)\"\n @revise=\"emit('revise', $event)\">\n <template\n v-for=\"slotName in Object.keys(slots)\"\n #[slotName]=\"slotData\"\n ><slot :name=\"slotName\" v-bind=\"slotData\"\n /></template>\n </PkChatbotViewChat>\n <PkChatbotViewConversations\n v-else-if=\"activeView === 'conversations'\"\n :agent-id>\n <template\n v-for=\"slotName in Object.keys(slots)\"\n #[slotName]=\"slotData\"\n ><slot :name=\"slotName\" v-bind=\"slotData\"\n /></template>\n </PkChatbotViewConversations>\n <PkChatbotViewFiles v-else-if=\"activeView === 'files'\" :agent-id />\n <div\n v-else-if=\"activeView === 'auth'\"\n class=\"pk-chatbot__view-auth flex-1 min-h-0 overflow-y-auto\">\n <!-- Sign-in form provided by the host widget (owns the auth client) -->\n <slot name=\"view-auth\" />\n </div>\n <PkChatbotViewProfile v-else :agent-id>\n <template\n v-for=\"slotName in Object.keys(slots)\"\n #[slotName]=\"slotData\"\n ><slot :name=\"slotName\" v-bind=\"slotData\"\n /></template>\n </PkChatbotViewProfile>\n <!-- #endregion -->\n\n <!-- #region footer -->\n <div v-if=\"footerMessage\" class=\"pk-chatbot__footer\">\n <PkStreamingMarkdown :markdown=\"footerMessage\" class=\"wysiwyg\" />\n </div>\n <!-- #endregion -->\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot {\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n background-color: var(--color-surface);\n\n &__header {\n position: sticky;\n top: 0;\n z-index: 1;\n display: flex;\n justify-content: space-between;\n gap: var(--spacing-14);\n background-color: var(--color-surface-1);\n padding: var(--spacing-14);\n border-bottom: 1px solid var(--color-surface-3);\n }\n\n &__header-start {\n display: flex;\n align-items: center;\n gap: var(--spacing-sm);\n min-width: 0;\n }\n\n &__nav-icon {\n font-size: var(--text-18);\n }\n\n &__avatar {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &__title {\n font-size: var(--text-16);\n font-weight: var(--font-semibold);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__header-end {\n flex-shrink: 0;\n }\n\n &__warning-body {\n padding: var(--spacing-md);\n border-bottom: 1px solid var(--color-surface-3);\n }\n\n &__warning-header {\n display: flex;\n align-items: center;\n gap: var(--spacing-4);\n margin-bottom: var(--spacing-4);\n }\n\n &__warning-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n\n &__warning-title {\n font-weight: 600;\n font-size: var(--text-14);\n }\n\n &__warning-text {\n font-size: var(--text-12);\n color: var(--color-word-3);\n }\n\n &__footer {\n padding: var(--spacing-md);\n border-top: 1px solid var(--color-surface-3);\n text-align: center;\n font-size: var(--text-12);\n color: var(--color-word-2);\n }\n\n // Modifier: fullscreen — layout full-page (Gemini-style): nessun\n // header interno, sfondo trasparente, input pill centrato.\n // Il chrome (sidebar, navigazione) è gestito dalla pagina ospite.\n &--fullscreen {\n // The dock, 60px. Declared rather than taken from the agent chip,\n // which the tight layout hides: the pill fell to 54px there and\n // the call bar that takes its place stayed at 60. There is no 60\n // in the spacing scale and a raw `60px` would stop following the\n // root font size, which the labels inside do follow.\n --pk-chat-fullscreen-dock-height: calc(\n var(--spacing-56) + var(--spacing-4)\n );\n // The pill, the notice that tucks into its top corners and the\n // call bar all round their ends on half of it.\n --pk-chat-dock-radius: calc(\n var(--pk-chat-fullscreen-dock-height) / 2\n );\n\n background-color: transparent;\n\n .pk-chatbot__footer {\n border-top: none;\n padding: 0 var(--spacing-md) var(--spacing-sm) var(--spacing-md);\n }\n\n // Reading column aligned with the input (Gemini-style). The\n // constraint lives on the inner wrapper so the scroll container\n // spans the page and the scrollbar sits at its edge.\n .pk-chatbot-messages {\n // Symmetric gutters: a visible scrollbar would otherwise\n // shrink the content box on one side only, shifting the\n // column off the input axis\n scrollbar-gutter: stable both-edges;\n // Dissolve the content at both edges (works on any page\n // background, dots included — a surface-colored fade band\n // would cut through the pattern instead)\n mask-image: linear-gradient(\n to bottom,\n transparent 0,\n #000 var(--spacing-40),\n #000 calc(100% - var(--spacing-40)),\n transparent 100%\n );\n // Resting clearance so the first/last lines sit inside the\n // fully opaque zone\n padding-block: var(--spacing-48);\n }\n\n .pk-chatbot-messages__wrapper {\n width: 100%;\n max-width: 768px;\n margin-inline: auto;\n }\n\n // Outline rail: wide chats only, measured on the chat and not on\n // the viewport, so a preview frame squeezed by side panels loses\n // it like a phone does. The rail sits at the edge of the scroll\n // area beside the reading column: below the `--wide` threshold\n // (768px column plus a 40px rail on each side) it would cover the\n // messages instead.\n .pk-chatbot-messages__outline {\n display: none;\n }\n\n &.pk-chatbot--wide .pk-chatbot-messages__outline {\n display: block;\n }\n\n .pk-chatbot-file-preview {\n background-color: var(--color-surface);\n }\n\n .pk-chatbot-input__notice {\n background-color: var(--color-surface);\n border-inline: 1px solid var(--color-surface-3);\n border-top: 1px solid var(--color-surface-2);\n padding: var(--spacing-10) var(--spacing-16);\n\n // As deep as the pill's corners, or the page shows through\n // where their curve leaves the side\n &::after {\n background-color: var(--color-surface);\n border-inline: 1px solid var(--color-surface-2);\n bottom: calc(-1 * var(--pk-chat-dock-radius));\n height: var(--pk-chat-dock-radius);\n left: -1px;\n right: -1px;\n }\n }\n\n .pk-chatbot-input {\n width: calc(100% - var(--spacing-sm) * 2);\n max-width: 768px;\n margin-inline: auto;\n\n &__form {\n // True semicircles at rest, concentric with the send\n // button, whose center sits 30px in. Not `rounded-full`:\n // once Shift+Enter grows the field the ends would swell\n // with it and cut into the first and last line.\n border-radius: var(--pk-chat-dock-radius);\n min-height: var(--pk-chat-fullscreen-dock-height);\n padding: var(--spacing-12) var(--spacing-16);\n background-color: var(--color-surface-1);\n border-color: var(--color-surface-2);\n box-shadow: none;\n transition:\n border-color var(--duration-200) var(--ease-in-out),\n box-shadow var(--duration-200) var(--ease-in-out);\n\n &:has(:focus-within) {\n border-color: var(--color-surface-4);\n box-shadow: var(--shadow-sm);\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n\n &__textarea {\n background-color: transparent;\n }\n }\n\n // A live call takes the place of the input, so it takes its shape,\n // its column and its height: full-bleed here would break the\n // reading axis, and a different height would make the dock jump\n // the moment the call starts.\n .pk-voice-session {\n --pk-chat-dock-height: var(--pk-chat-fullscreen-dock-height);\n --pk-voice-orb-size: var(--spacing-40);\n --pk-voice-orb-bars-height: var(--spacing-20);\n --pk-voice-session-surface: var(--color-surface-1);\n width: calc(100% - var(--spacing-sm) * 2);\n max-width: 768px;\n margin-inline: auto;\n padding-inline: var(--spacing-16);\n border-color: var(--color-surface-2);\n border-radius: var(--pk-chat-dock-radius);\n box-shadow: none;\n\n &__timer {\n font-size: var(--text-14);\n }\n }\n }\n\n // Modifier: panel — compact chrome for a docked side panel: the host\n // container owns background and border, the header slims down and\n // drops its own surface so the chat blends into the panel.\n &--panel {\n background-color: transparent;\n\n .pk-chatbot__header {\n background-color: transparent;\n\n // Fixed height so the panel header lines up with the host's\n // own chrome. Custom properties inherit through the shadow\n // root: an embedding host can override it to match its\n // header (the default matches the platform header, 50px).\n height: var(--pk-chatbot-panel-header-height, 50px);\n align-items: center;\n padding-block: 0;\n padding-inline: var(--spacing-10);\n border-bottom: 1px solid var(--color-surface-3);\n }\n\n .pk-chatbot__title {\n font-size: var(--text-14);\n }\n\n .pk-chatbot__footer {\n border-top: none;\n padding: var(--spacing-6) var(--spacing-md);\n }\n }\n\n // A chat given a whole page without the fullscreen layout (the page\n // an iframe embeds, a widget its host lets fill the screen) keeps the\n // reading column of the fullscreen one: at 1440px an answer ran\n // 1408px wide, some two hundred characters a line. Measured on the\n // chat, like `--wide` itself, so a narrow frame is left alone.\n &--wide:not(.pk-chatbot--fullscreen) {\n .pk-chatbot-messages__wrapper,\n .pk-chatbot-input {\n width: 100%;\n max-width: 768px;\n margin-inline: auto;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import {\n computed,\n inject,\n toRef,\n useTemplateRef,\n watch,\n watchEffect,\n useSlots,\n } from 'vue'\n import { useElementSize } from '@vueuse/core'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type {\n AgentInterface,\n AgentModel,\n AgentFileUpload,\n AgentGatewayOptions,\n AgentVoiceCapability,\n ChatMessageActions,\n RevisedAnswer,\n UIChatMessage,\n AgentTools,\n HostToolsCapability,\n PageAccessCapability,\n } from 'models'\n import {\n type RegisteredHostTool,\n useChatbotStore,\n useLocalizedString,\n provideShortUrlResolver,\n } from 'composables'\n import PkAvatar from './PkAvatar.vue'\n import PkChatbotViewChat from './PkChatbotViewChat.vue'\n import PkChatbotViewConversations from './PkChatbotViewConversations.vue'\n import PkChatbotViewFiles from './PkChatbotViewFiles.vue'\n import PkChatbotViewProfile from './PkChatbotViewProfile.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n import { provideChatImagePolicy } from './chatImagePolicy'\n import { agentThemeStyle, resolveContrastColor } from './utils'\n\n // Captured in script setup to avoid TS7022 circular inference in template\n const slots = useSlots()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n const props = defineProps<{\n baseUrl: string\n basePath?: string\n agentId: string\n agentType?: 'reasoning' | 'chat'\n userId?: string\n name?: string\n model?: string\n agentModel?: AgentModel\n agentTools?: AgentTools\n agentInterface?: AgentInterface\n actions?: ChatMessageActions[]\n revisedAnswers?: RevisedAnswer[]\n headers?: Record<string, string>\n systemTheme?: 'light' | 'dark'\n agentFileUpload?: AgentFileUpload\n /** Voice configuration from the agent settings: enables the talk button. */\n voice?: AgentVoiceCapability\n fallbackModels?: string[]\n gatewayOptions?: Partial<AgentGatewayOptions>\n externalContext?: Record<string, unknown>\n /** Host tools as the agent allows them (`capabilities.hostTools` of the public agent). */\n hostTools?: HostToolsCapability\n /** Tools the embedding app registered, with the function that runs each (spec `host-tools.md`). */\n hostToolRegistry?: RegisteredHostTool[]\n /** Page access as the agent allows it (`capabilities.pageAccess`, spec `page-tools.md`). */\n pageAccess?: PageAccessCapability\n /** The widget's page tools: only the web component provides them. */\n pageToolRegistry?: RegisteredHostTool[]\n /** The tools of the forms annotated on the page now, read on every request. */\n pageForms?: () => RegisteredHostTool[]\n /** Layout modifier: `widget` (default) keeps the contained layout with header, `fullscreen` removes header/background for full-page usage (the page provides the chrome), `panel` keeps the header but slims it down for a docked side panel (the host provides background and border) */\n modifier?: 'widget' | 'fullscreen' | 'panel'\n /** Display name of the current user, used for the `{name}` placeholder in the fullscreen greeting */\n userName?: string\n /** Show the \"Files in this chat\" menu for hosts that don't provide the\n * profile context but whose user is authenticated (e.g. the backoffice\n * playground). The widget host relies on `canManageProfile` instead. */\n userFilesEnabled?: boolean\n }>()\n const emit = defineEmits<{\n 'message-update': [message: UIChatMessage]\n 'show-info': [message: UIChatMessage]\n revise: [message: UIChatMessage]\n error: [error: { type: string; title: string; status: number }]\n /** That conversation is loaded: a message sent now lands in it. */\n loaded: [chatId: string]\n }>()\n\n const chatId = defineModel<string | undefined>('chatId', {\n type: String,\n default: undefined,\n })\n\n const store = useChatbotStore(props.agentId)\n\n // Resolve backend short-urls (`/api/r/<hash>`) back to their real target\n // for display in tool components. Batched + cached across the chat tree.\n provideShortUrlResolver((hashes) =>\n store.apiClient.resolveShortUrls(hashes),\n )\n\n const {\n messages,\n localChatId,\n activeView,\n chatError,\n isDark,\n pageAccessAvailable,\n pageAccessOff,\n } = storeToRefs(store)\n\n // Ref to store.agentId for watchers (avoids duplicate-key with agentId prop)\n const storeAgentId = toRef(store, 'agentId')\n\n const {\n startNewChat,\n stopGeneration,\n regenerate,\n navigate,\n sendMessage,\n setPageAccessOff,\n } = store\n\n // Images in the answers and the tool cards load by themselves only from\n // the backend this chat talks to and from the hosts the agent lists.\n provideChatImagePolicy(\n () => props.agentInterface?.imageHosts,\n () => props.baseUrl,\n )\n\n // Optional profile-management context provided by the host widget.\n // Present only for authenticated, non-anonymous sessions.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canManageProfile = computed(\n () => profile?.canManageProfile.value ?? false,\n )\n // Anonymous users get a \"Sign in\" entry instead of the profile one,\n // provided the host filled the `view-auth` slot and the agent has at\n // least one auth method enabled.\n const canSignIn = computed(\n () =>\n !canManageProfile.value &&\n (profile?.canSignIn?.value ?? false) &&\n slots['view-auth'] !== undefined,\n )\n\n // Once the sign-in completes (the session becomes non-anonymous) leave\n // the auth view and return to the conversation.\n watch(canManageProfile, (canManage) => {\n if (canManage && activeView.value === 'auth') {\n navigate('chat')\n }\n })\n\n // Sync props → store reactively\n watchEffect(() => {\n store.baseUrl = props.baseUrl\n store.basePath = props.basePath\n store.name = props.name\n store.agentType = props.agentType\n store.userId = props.userId\n store.agentInterface = props.agentInterface\n store.agentModel = props.agentModel\n store.agentTools = props.agentTools\n store.headers = props.headers\n store.revisedAnswers = props.revisedAnswers\n store.model = props.model\n store.actionsInput = props.actions\n store.agentFileUpload = props.agentFileUpload\n store.agentVoice = props.voice\n store.fallbackModels = props.fallbackModels\n store.gatewayOptions = props.gatewayOptions\n store.externalContext = props.externalContext\n store.agentHostTools = props.hostTools\n store.hostToolRegistry = props.hostToolRegistry\n store.agentPageAccess = props.pageAccess\n store.pageToolRegistry = props.pageToolRegistry\n store.pageFormsProvider = props.pageForms\n store.systemTheme = props.systemTheme\n store.hideWelcomeMessage = props.modifier === 'fullscreen'\n })\n\n // Sync chatId v-model ↔ store (bidirectional)\n // Parent → store: if the parent provides an external chatId, push it into\n // the store so the Chat instance picks it up.\n watch(\n () => chatId.value,\n (id) => {\n if (id && id !== store.localChatId) {\n store.localChatId = id\n }\n },\n { immediate: true },\n )\n // Store → parent: keep the v-model in sync whenever the store changes\n // the chatId internally (e.g. startNewChat).\n watch(localChatId, (id) => {\n chatId.value = id\n })\n\n // Emit structured errors from chat to the parent component\n watch(chatError, (error) => {\n if (!error) {\n return\n }\n try {\n const parsedError = JSON.parse(error.message) as {\n type: string\n title: string\n status: number\n }\n emit('error', parsedError)\n } catch {\n // ignore non-JSON errors\n }\n })\n\n // ui\n const isFullscreen = computed(() => props.modifier === 'fullscreen')\n const isPanel = computed(() => props.modifier === 'panel')\n\n /**\n * How much room the chat has, measured on the chat and not on the window.\n *\n * The same chat renders in a phone page, in a 408px widget, in a docked\n * panel and in a preview frame that the side panels squeeze to phone width\n * on a desktop screen, so the viewport says nothing about the space the\n * layout actually has. A CSS container query would read the same number\n * with no JavaScript, but `container-type` makes the element a containing\n * block for `position: fixed` descendants on every engine except Chrome\n * 129 and later, which displaces every dropdown in the chat: see\n * docs/agents/gotchas.md, \"The chat measures its own width, and not with a\n * container query\".\n *\n * The thresholds carry the modifiers, so the CSS stays declarative:\n * `--phone` has as much room as a phone page, `--tight` is too tight for\n * the agent chip beside the field, `--wide` has room for the outline rail\n * beside the reading column. Before the first measurement the width is 0\n * and no modifier applies, which is the roomy layout the base CSS writes.\n */\n const chatbotEl = useTemplateRef<HTMLDivElement>('chatbotEl')\n const { width: chatbotWidth } = useElementSize(chatbotEl)\n const isPhoneWidth = computed(\n () => chatbotWidth.value > 0 && chatbotWidth.value < 576,\n )\n const isTightWidth = computed(\n () => chatbotWidth.value > 0 && chatbotWidth.value < 640,\n )\n const isWideWidth = computed(() => chatbotWidth.value >= 848)\n const isReasoningAgent = computed(() => props.agentType === 'reasoning')\n // The notice says how a reasoning agent reads a message: it stands before\n // the first one, then leaves the room to the answers (pinned, it took a\n // third of a phone screen in the reasoning playground)\n const showReasoningNotice = computed(\n () =>\n isReasoningAgent.value &&\n !messages.value.some((message) => message.role === 'user'),\n )\n // A docked panel keeps a neutral header whatever the agent asks: it sits\n // beside the site or the app as part of the frame, and a colored band\n // made it read as a second site next to the first one.\n const useColorsForAgentHeader = computed(\n () => !isPanel.value && props.agentInterface?.useColorsForAgentHeader,\n )\n // Panel mode promotes the everyday actions (new chat, history) from the\n // dropdown to direct header buttons: the dropdown then only remains for\n // the secondary entries (files, profile, sign-in) and disappears when\n // none of them applies.\n const showHeaderMenu = computed(\n () =>\n !isPanel.value ||\n canManageProfile.value ||\n canSignIn.value ||\n pageAccessAvailable.value ||\n (!!props.userFilesEnabled && !!localChatId.value),\n )\n const themeClass = computed(() => [\n 'theme',\n `theme--${isDark.value ? 'dark' : 'light'}`,\n ])\n const mainColor = computed(() => props.agentInterface?.mainColor)\n const contrastColor = computed(() =>\n resolveContrastColor(props.agentInterface?.textColor, mainColor.value),\n )\n const themeStyle = computed(() =>\n agentThemeStyle(mainColor.value, contrastColor.value),\n )\n const footerMessage = useLocalizedString(\n () => props.agentInterface?.footerMessage,\n )\n const title = computed(() => {\n if (activeView.value === 'conversations') {\n return $t('label.conversations')\n }\n if (activeView.value === 'profile') {\n return $t('label.profile')\n }\n if (activeView.value === 'auth') {\n return $t('label.authentication')\n }\n if (activeView.value === 'files') {\n return $t('userFiles.chatFilesTitle')\n }\n return props.name\n })\n\n // state\n const activeMessage = computed(() => {\n return messages.value?.[messages.value.length - 1]\n })\n\n // expose\n defineExpose({\n startNewChat,\n regenerate,\n stopGeneration,\n sendMessage,\n })\n\n // load chat, conversations and feedbacks on agent or chat change\n watch(\n [storeAgentId, localChatId],\n async ([newAgentId, newChatId]) => {\n await store.initialize(newAgentId, newChatId)\n emit('loaded', newChatId)\n },\n {\n immediate: true,\n },\n )\n // load conversations when navigating to conversations view\n watch(activeView, (newView) => {\n if (newView === 'conversations') {\n store.loadConversations(storeAgentId.value)\n } else if (newView === 'files') {\n store.loadChatFiles()\n }\n })\n // emit message updates for up-to-date context in parent components\n watch(\n activeMessage,\n (message) => {\n if (message) {\n emit('message-update', message)\n }\n },\n {\n deep: true,\n immediate: true,\n },\n )\n</script>\n\n<template>\n <div\n ref=\"chatbotEl\"\n class=\"pk-chatbot\"\n :class=\"[\n themeClass,\n {\n 'pk-chatbot--fullscreen': isFullscreen,\n 'pk-chatbot--panel': isPanel,\n 'pk-chatbot--phone': isPhoneWidth,\n 'pk-chatbot--tight': isTightWidth,\n 'pk-chatbot--wide': isWideWidth,\n },\n ]\"\n :style=\"themeStyle\">\n <!-- #region title -->\n <div\n v-if=\"!isFullscreen\"\n class=\"pk-chatbot__header\"\n :style=\"\n useColorsForAgentHeader\n ? {\n backgroundColor: mainColor,\n }\n : undefined\n \">\n <div class=\"pk-chatbot__header-start\">\n <template v-if=\"activeView !== 'chat'\">\n <VvButton\n v-bind=\"{\n modifiers: useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet',\n icon: 'ri:arrow-left-s-line',\n title: $t('action.goBack'),\n }\"\n @click=\"navigate('chat')\" />\n <VvIcon\n :name=\"\n activeView === 'conversations'\n ? 'ri:history-line'\n : activeView === 'files'\n ? 'ri:attachment-2'\n : 'ri:user-line'\n \"\n class=\"pk-chatbot__nav-icon\"\n :style=\"\n useColorsForAgentHeader\n ? {\n color: contrastColor,\n }\n : undefined\n \" />\n </template>\n <!-- Panel mode: no avatar, the docked panel identifies the\n agent with the title alone -->\n <PkAvatar\n v-else-if=\"!isPanel\"\n class=\"pk-chatbot__avatar\"\n :name\n :img-src=\"agentInterface?.logo\" />\n <strong\n class=\"pk-chatbot__title\"\n :title=\"title\"\n :style=\"\n useColorsForAgentHeader\n ? {\n color: contrastColor,\n }\n : undefined\n \">\n {{ title }}\n </strong>\n </div>\n <VvButtonGroup class=\"pk-chatbot__header-end\" modifiers=\"compact\">\n <slot\n name=\"header-actions\"\n v-bind=\"{\n mainColor,\n useColorsForAgentHeader,\n contrastColor,\n startNewChat,\n stopGeneration,\n }\" />\n <template v-if=\"isPanel\">\n <VvButton\n :modifiers=\"\n useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet'\n \"\n icon=\"ri:edit-box-line\"\n :title=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n <VvButton\n v-if=\"!isReasoningAgent\"\n :modifiers=\"\n useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet'\n \"\n icon=\"ri:history-line\"\n :title=\"$t('action.viewRecentChats')\"\n @click=\"navigate('conversations')\" />\n </template>\n <VvDropdown\n v-if=\"showHeaderMenu\"\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n v-bind=\"{\n modifiers: useColorsForAgentHeader\n ? `action-quiet-${contrastColor}`\n : 'action-quiet',\n icon: 'ri:more-2-fill',\n title: $t('action.moreActions'),\n }\" />\n <template #items>\n <VvDropdownAction\n v-if=\"!isPanel\"\n @click=\"startNewChat()\">\n <VvIcon name=\"ri:edit-box-line\" />\n {{ $t('action.startNewChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n v-if=\"!isReasoningAgent && !isPanel\"\n @click=\"navigate('conversations')\">\n <VvIcon name=\"ri:history-line\" />\n {{ $t('action.viewRecentChats') }}\n </VvDropdownAction>\n <VvDropdownAction\n v-if=\"\n (canManageProfile || userFilesEnabled) &&\n localChatId\n \"\n @click=\"navigate('files')\">\n <VvIcon name=\"ri:attachment-2\" />\n {{ $t('userFiles.chatFilesTitle') }}\n </VvDropdownAction>\n <!-- The user's own switch for the page tools, for\n this tab (spec page-tools.md) -->\n <VvDropdownAction\n v-if=\"pageAccessAvailable\"\n @click=\"setPageAccessOff(!pageAccessOff)\">\n <VvIcon\n :name=\"\n pageAccessOff\n ? 'ri:pages-line'\n : 'ri:forbid-line'\n \" />\n {{\n pageAccessOff\n ? $t('action.enablePageAccess')\n : $t('action.disablePageAccess')\n }}\n </VvDropdownAction>\n <VvDropdownAction\n v-if=\"canManageProfile\"\n @click=\"navigate('profile')\">\n <VvIcon name=\"ri:user-line\" />\n {{ $t('label.profile') }}\n </VvDropdownAction>\n <VvDropdownAction\n v-else-if=\"canSignIn\"\n @click=\"navigate('auth')\">\n <VvIcon name=\"ri:account-circle-line\" />\n {{ $t('action.signIn') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n <slot\n name=\"actions\"\n v-bind=\"{\n mainColor,\n useColorsForAgentHeader,\n contrastColor,\n startNewChat,\n stopGeneration,\n }\" />\n </VvButtonGroup>\n </div>\n <!-- #endregion -->\n\n <div v-if=\"showReasoningNotice\">\n <div class=\"pk-chatbot__warning-body\">\n <VvAlert modifiers=\"callout\">\n <div class=\"pk-chatbot__warning-header\">\n <VvIcon\n name=\"ri:alert-line\"\n class=\"pk-chatbot__warning-icon\" />\n <strong class=\"pk-chatbot__warning-title\">\n {{ $t('message.warning') }}\n </strong>\n </div>\n <p class=\"pk-chatbot__warning-text\">\n {{ $t('message.reasoningAgent') }}\n </p>\n </VvAlert>\n </div>\n </div>\n\n <!-- #region views -->\n <PkChatbotViewChat\n v-if=\"activeView === 'chat'\"\n :agent-id\n :modifier\n :user-name\n @show-info=\"emit('show-info', $event)\"\n @revise=\"emit('revise', $event)\">\n <template\n v-for=\"slotName in Object.keys(slots)\"\n #[slotName]=\"slotData\"\n ><slot :name=\"slotName\" v-bind=\"slotData\"\n /></template>\n </PkChatbotViewChat>\n <PkChatbotViewConversations\n v-else-if=\"activeView === 'conversations'\"\n :agent-id>\n <template\n v-for=\"slotName in Object.keys(slots)\"\n #[slotName]=\"slotData\"\n ><slot :name=\"slotName\" v-bind=\"slotData\"\n /></template>\n </PkChatbotViewConversations>\n <PkChatbotViewFiles v-else-if=\"activeView === 'files'\" :agent-id />\n <div\n v-else-if=\"activeView === 'auth'\"\n class=\"pk-chatbot__view-auth flex-1 min-h-0 overflow-y-auto\">\n <!-- Sign-in form provided by the host widget (owns the auth client) -->\n <slot name=\"view-auth\" />\n </div>\n <PkChatbotViewProfile v-else :agent-id>\n <template\n v-for=\"slotName in Object.keys(slots)\"\n #[slotName]=\"slotData\"\n ><slot :name=\"slotName\" v-bind=\"slotData\"\n /></template>\n </PkChatbotViewProfile>\n <!-- #endregion -->\n\n <!-- #region footer -->\n <div v-if=\"footerMessage\" class=\"pk-chatbot__footer\">\n <PkStreamingMarkdown :markdown=\"footerMessage\" class=\"wysiwyg\" />\n </div>\n <!-- #endregion -->\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot {\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n background-color: var(--color-surface);\n\n &__header {\n position: sticky;\n top: 0;\n z-index: 1;\n display: flex;\n justify-content: space-between;\n gap: var(--spacing-14);\n background-color: var(--color-surface-1);\n padding: var(--spacing-14);\n border-bottom: 1px solid var(--color-surface-3);\n }\n\n &__header-start {\n display: flex;\n align-items: center;\n gap: var(--spacing-sm);\n min-width: 0;\n }\n\n &__nav-icon {\n font-size: var(--text-18);\n }\n\n &__avatar {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &__title {\n font-size: var(--text-16);\n font-weight: var(--font-semibold);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__header-end {\n flex-shrink: 0;\n }\n\n &__warning-body {\n padding: var(--spacing-md);\n border-bottom: 1px solid var(--color-surface-3);\n }\n\n &__warning-header {\n display: flex;\n align-items: center;\n gap: var(--spacing-4);\n margin-bottom: var(--spacing-4);\n }\n\n &__warning-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n\n &__warning-title {\n font-weight: 600;\n font-size: var(--text-14);\n }\n\n &__warning-text {\n font-size: var(--text-12);\n color: var(--color-word-3);\n }\n\n &__footer {\n padding: var(--spacing-md);\n border-top: 1px solid var(--color-surface-3);\n text-align: center;\n font-size: var(--text-12);\n color: var(--color-word-2);\n }\n\n // Modifier: fullscreen — layout full-page (Gemini-style): nessun\n // header interno, sfondo trasparente, input pill centrato.\n // Il chrome (sidebar, navigazione) è gestito dalla pagina ospite.\n &--fullscreen {\n // The dock, 60px. Declared rather than taken from the agent chip,\n // which the tight layout hides: the pill fell to 54px there and\n // the call bar that takes its place stayed at 60. There is no 60\n // in the spacing scale and a raw `60px` would stop following the\n // root font size, which the labels inside do follow.\n --pk-chat-fullscreen-dock-height: calc(\n var(--spacing-56) + var(--spacing-4)\n );\n // The pill, the notice that tucks into its top corners and the\n // call bar all round their ends on half of it.\n --pk-chat-dock-radius: calc(\n var(--pk-chat-fullscreen-dock-height) / 2\n );\n\n background-color: transparent;\n\n .pk-chatbot__footer {\n border-top: none;\n padding: 0 var(--spacing-md) var(--spacing-sm) var(--spacing-md);\n }\n\n // Reading column aligned with the input (Gemini-style). The\n // constraint lives on the inner wrapper so the scroll container\n // spans the page and the scrollbar sits at its edge.\n .pk-chatbot-messages {\n // Symmetric gutters: a visible scrollbar would otherwise\n // shrink the content box on one side only, shifting the\n // column off the input axis\n scrollbar-gutter: stable both-edges;\n // Dissolve the content at both edges (works on any page\n // background, dots included — a surface-colored fade band\n // would cut through the pattern instead)\n mask-image: linear-gradient(\n to bottom,\n transparent 0,\n #000 var(--spacing-40),\n #000 calc(100% - var(--spacing-40)),\n transparent 100%\n );\n // Resting clearance so the first/last lines sit inside the\n // fully opaque zone\n padding-block: var(--spacing-48);\n }\n\n .pk-chatbot-messages__wrapper {\n width: 100%;\n max-width: 768px;\n margin-inline: auto;\n }\n\n // Outline rail: wide chats only, measured on the chat and not on\n // the viewport, so a preview frame squeezed by side panels loses\n // it like a phone does. The rail sits at the edge of the scroll\n // area beside the reading column: below the `--wide` threshold\n // (768px column plus a 40px rail on each side) it would cover the\n // messages instead.\n .pk-chatbot-messages__outline {\n display: none;\n }\n\n &.pk-chatbot--wide .pk-chatbot-messages__outline {\n display: block;\n }\n\n .pk-chatbot-file-preview {\n background-color: var(--color-surface);\n }\n\n .pk-chatbot-input__notice {\n background-color: var(--color-surface);\n border-inline: 1px solid var(--color-surface-3);\n border-top: 1px solid var(--color-surface-2);\n padding: var(--spacing-10) var(--spacing-16);\n\n // As deep as the pill's corners, or the page shows through\n // where their curve leaves the side\n &::after {\n background-color: var(--color-surface);\n border-inline: 1px solid var(--color-surface-2);\n bottom: calc(-1 * var(--pk-chat-dock-radius));\n height: var(--pk-chat-dock-radius);\n left: -1px;\n right: -1px;\n }\n }\n\n .pk-chatbot-input {\n width: calc(100% - var(--spacing-sm) * 2);\n max-width: 768px;\n margin-inline: auto;\n\n &__form {\n // True semicircles at rest, concentric with the send\n // button, whose center sits 30px in. Not `rounded-full`:\n // once Shift+Enter grows the field the ends would swell\n // with it and cut into the first and last line.\n border-radius: var(--pk-chat-dock-radius);\n min-height: var(--pk-chat-fullscreen-dock-height);\n padding: var(--spacing-12) var(--spacing-16);\n background-color: var(--color-surface-1);\n border-color: var(--color-surface-2);\n box-shadow: none;\n transition:\n border-color var(--duration-200) var(--ease-in-out),\n box-shadow var(--duration-200) var(--ease-in-out);\n\n &:has(:focus-within) {\n border-color: var(--color-surface-4);\n box-shadow: var(--shadow-sm);\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n\n &__textarea {\n background-color: transparent;\n }\n }\n\n // A live call takes the place of the input, so it takes its shape,\n // its column and its height: full-bleed here would break the\n // reading axis, and a different height would make the dock jump\n // the moment the call starts.\n .pk-voice-session {\n --pk-chat-dock-height: var(--pk-chat-fullscreen-dock-height);\n --pk-voice-orb-size: var(--spacing-40);\n --pk-voice-orb-bars-height: var(--spacing-20);\n --pk-voice-session-surface: var(--color-surface-1);\n width: calc(100% - var(--spacing-sm) * 2);\n max-width: 768px;\n margin-inline: auto;\n padding-inline: var(--spacing-16);\n border-color: var(--color-surface-2);\n border-radius: var(--pk-chat-dock-radius);\n box-shadow: none;\n\n &__timer {\n font-size: var(--text-14);\n }\n }\n }\n\n // Modifier: panel — compact chrome for a docked side panel: the host\n // container owns background and border, the header slims down and\n // drops its own surface so the chat blends into the panel.\n &--panel {\n background-color: transparent;\n\n .pk-chatbot__header {\n background-color: transparent;\n\n // Fixed height so the panel header lines up with the host's\n // own chrome. Custom properties inherit through the shadow\n // root: an embedding host can override it to match its\n // header (the default matches the platform header, 50px).\n height: var(--pk-chatbot-panel-header-height, 50px);\n align-items: center;\n padding-block: 0;\n padding-inline: var(--spacing-10);\n border-bottom: 1px solid var(--color-surface-3);\n }\n\n .pk-chatbot__title {\n font-size: var(--text-14);\n }\n\n .pk-chatbot__footer {\n border-top: none;\n padding: var(--spacing-6) var(--spacing-md);\n }\n }\n\n // A chat given a whole page without the fullscreen layout (the page\n // an iframe embeds, a widget its host lets fill the screen) keeps the\n // reading column of the fullscreen one: at 1440px an answer ran\n // 1408px wide, some two hundred characters a line. Measured on the\n // chat, like `--wide` itself, so a narrow frame is left alone.\n &--wide:not(.pk-chatbot--fullscreen) {\n .pk-chatbot-messages__wrapper,\n .pk-chatbot-input {\n width: 100%;\n max-width: 768px;\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O,KAAKf,EAAAkD,CAAA,CAAK,IAA7B,O;KACN,MAAA6F;KACA,IAAAvI,GADY,MAAQ,CACpBC,EACH2H,EAAA,QADgBW,GAAQrI,EAAAC,EAAUqI,CAAQ,CAAA,CAAA,C;;;;;I,MAIjChJ,EAAAuE,CAAA,MAAU,mBADzB5E,EAAA,GAAAS,EAQ6BY,IAAA;;KANxB,YAAAuC,EAAA;I,gBAEsBxC,EAAA,OAAO,KAAKf,EAAAkD,CAAA,CAAK,IAA7B,O;KACN,MAAA6F;KACA,IAAAvI,GADY,MAAQ,CACpBC,EACH2H,EAAA,QADgBW,GAAQrI,EAAAC,EAAUqI,CAAQ,CAAA,CAAA,C;I,8BAGjBhJ,EAAAuE,CAAA,MAAU,WAAzC5E,EAAA,GAAAS,EAAmEa,IAAA;;KAAX,YAAAsC,EAAA;I,6BAEzCvD,EAAAuE,CAAA,MAAU,UADzB5E,EAAA,GAAAC,EAKM,OALN8C,IAKM,CADFjC,EAAyB2H,EAAA,QAAA,WAAA,C,OAE7BzI,EAAA,GAAAS,EAMuBc,IAAA;;KANO,YAAAqC,EAAA;I,gBAEHxC,EAAA,OAAO,KAAKf,EAAAkD,CAAA,CAAK,IAA7B,O;KACN,MAAA6F;KACA,IAAAvI,GADY,MAAQ,CACpBC,EACH2H,EAAA,QADgBW,GAAQrI,EAAAC,EAAUqI,CAAQ,CAAA,CAAA,C;;IAMrChJ,EAAAoG,EAAA,KAAXzG,EAAA,GAAAC,EAEM,OAFN+C,IAEM,CADFzC,EAAiEiB,GAAA;KAA3C,UAAUnB,EAAAoG,EAAA;KAAe,OAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotStepPayload-DXhatUfJ.js","names":["__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createVNode","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_withCtx","_createCommentVNode","_sfc_main","stringifyPayload","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","PREVIEW_LENGTH","PkChatbotStepPayload_default","defineComponent","props","__props","$t","useI18n","stringify","value","indent","toPreview","single","entries","computed","index","item","own","rows","key","preview","full","text","summary","list","row","isOpen","ref","expandedRows","reactive","toggleRow","_component_VvIcon","VvIcon","openBlock","createElementBlock","createElementVNode","_cache","toDisplayString","createVNode","Fragment","renderList","createBlock","resolveDynamicComponent","withCtx","createCommentVNode"],"sources":["../../../../packages/components/src/chat/PkChatbotStepPayload.vue","../../../../packages/components/src/chat/PkChatbotStepPayload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, reactive, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { stringifyPayload } from './utils'\n\n interface PayloadRow {\n key: string\n preview: string\n full?: string\n }\n\n const props = defineProps<{\n label: string\n value: unknown\n }>()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n // A preview stays on a single line: long enough to recognize the value,\n // short enough to keep the payload readable without expanding anything.\n const PREVIEW_LENGTH = 120\n\n const stringify = (value: unknown, indent = 0): string | undefined => {\n try {\n return JSON.stringify(value, null, indent)\n } catch {\n return undefined\n }\n }\n\n const toPreview = (value: unknown): string => {\n if (value === undefined) {\n return ''\n }\n const text =\n typeof value === 'string' ? value : (stringify(value) ?? '')\n const single = text.replace(/\\s+/g, ' ').trim()\n return single.length > PREVIEW_LENGTH\n ? `${single.slice(0, PREVIEW_LENGTH)}…`\n : single\n }\n\n // Objects are listed by key, arrays by position: either way the payload\n // becomes a list of short lines instead of one wall of JSON.\n const entries = computed<[string, unknown][] | undefined>(() => {\n const value = props.value\n if (Array.isArray(value)) {\n return value.length\n ? value.map(\n (item, index) =>\n [`${index + 1}`, item] as [string, unknown],\n )\n : undefined\n }\n if (value && typeof value === 'object') {\n const own = Object.entries(value as Record<string, unknown>)\n return own.length ? own : undefined\n }\n return undefined\n })\n\n const rows = computed<PayloadRow[] | undefined>(() =>\n entries.value?.map(([key, value]) => {\n const preview = toPreview(value)\n const full = typeof value === 'string' ? value : stringify(value, 2)\n return {\n key,\n preview: preview || '-',\n // Only a value the preview had to cut (long, multiline or\n // nested) is worth its own expandable block.\n full: full && full.trim() !== preview ? full : undefined,\n }\n }),\n )\n\n // Scalars and strings have no rows: they fall back to the plain payload.\n const text = computed(() =>\n rows.value ? undefined : stringifyPayload(props.value),\n )\n\n const summary = computed(() => {\n const list = rows.value\n if (!list) {\n return toPreview(props.value)\n }\n if (Array.isArray(props.value)) {\n return $t('messagePart.stepItems', list.length)\n }\n if (list.length === 1) {\n return `${list[0].key}: ${list[0].preview}`\n }\n return list.map((row) => row.key).join(' · ')\n })\n\n const isOpen = ref(false)\n const expandedRows = reactive(new Set<string>())\n const toggleRow = (key: string) => {\n if (expandedRows.has(key)) {\n expandedRows.delete(key)\n } else {\n expandedRows.add(key)\n }\n }\n</script>\n\n<template>\n <div v-if=\"rows || text\" class=\"pk-chatbot-step-payload\">\n <button\n type=\"button\"\n class=\"pk-chatbot-step-payload__header\"\n :aria-expanded=\"isOpen\"\n @click=\"isOpen = !isOpen\">\n <span class=\"pk-chatbot-step-payload__label\">{{ label }}</span>\n <span class=\"pk-chatbot-step-payload__summary\">\n {{ summary }}\n </span>\n <VvIcon\n :name=\"isOpen ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"shrink-0\" />\n </button>\n <ul v-if=\"isOpen && rows\" class=\"pk-chatbot-step-payload__rows\">\n <li v-for=\"row in rows\" :key=\"row.key\">\n <component\n :is=\"row.full ? 'button' : 'div'\"\n :type=\"row.full ? 'button' : undefined\"\n class=\"pk-chatbot-step-payload__row\"\n :aria-expanded=\"\n row.full ? expandedRows.has(row.key) : undefined\n \"\n @click=\"row.full ? toggleRow(row.key) : undefined\">\n <span class=\"pk-chatbot-step-payload__key\">\n {{ row.key }}\n </span>\n <span class=\"pk-chatbot-step-payload__value\">\n {{ row.preview }}\n </span>\n <VvIcon\n v-if=\"row.full\"\n :name=\"\n expandedRows.has(row.key)\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"shrink-0\" />\n </component>\n <pre\n v-if=\"row.full && expandedRows.has(row.key)\"\n class=\"pk-chatbot-step-payload__full\"\n >{{ row.full }}</pre>\n </li>\n </ul>\n <pre v-else-if=\"isOpen\" class=\"pk-chatbot-step-payload__full\">{{\n text\n }}</pre>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-step-payload {\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface-1);\n overflow: hidden;\n\n &__header {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n width: 100%;\n min-height: var(--spacing-28);\n padding: var(--spacing-4) var(--spacing-8);\n text-align: left;\n cursor: pointer;\n transition: background-color 0.2s ease;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n }\n\n &__label {\n flex-shrink: 0;\n font-weight: 600;\n font-size: var(--text-10);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--color-word-3);\n }\n\n &__summary {\n flex: 1 1 0;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: var(--font-mono);\n font-size: var(--text-10);\n color: var(--color-word-4);\n }\n\n &__rows > li {\n border-top: var(--spacing-px) solid var(--color-surface-3);\n }\n\n &__row {\n display: flex;\n align-items: baseline;\n gap: var(--spacing-8);\n width: 100%;\n padding: var(--spacing-4) var(--spacing-8);\n text-align: left;\n font-size: var(--text-10);\n\n &:is(button) {\n cursor: pointer;\n transition: background-color 0.2s ease;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n }\n }\n\n &__key {\n flex-shrink: 0;\n max-width: 40%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: var(--font-mono);\n color: var(--color-word-4);\n }\n\n &__value {\n flex: 1 1 0;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--color-word-2);\n }\n\n &__full {\n padding: var(--spacing-8);\n border-top: var(--spacing-px) solid var(--color-surface-3);\n max-height: var(--spacing-160);\n overflow: auto;\n white-space: pre-wrap;\n word-break: break-word;\n font-family: var(--font-mono);\n font-size: var(--text-10);\n color: var(--color-word-3);\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import { computed, reactive, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { stringifyPayload } from './utils'\n\n interface PayloadRow {\n key: string\n preview: string\n full?: string\n }\n\n const props = defineProps<{\n label: string\n value: unknown\n }>()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n // A preview stays on a single line: long enough to recognize the value,\n // short enough to keep the payload readable without expanding anything.\n const PREVIEW_LENGTH = 120\n\n const stringify = (value: unknown, indent = 0): string | undefined => {\n try {\n return JSON.stringify(value, null, indent)\n } catch {\n return undefined\n }\n }\n\n const toPreview = (value: unknown): string => {\n if (value === undefined) {\n return ''\n }\n const text =\n typeof value === 'string' ? value : (stringify(value) ?? '')\n const single = text.replace(/\\s+/g, ' ').trim()\n return single.length > PREVIEW_LENGTH\n ? `${single.slice(0, PREVIEW_LENGTH)}…`\n : single\n }\n\n // Objects are listed by key, arrays by position: either way the payload\n // becomes a list of short lines instead of one wall of JSON.\n const entries = computed<[string, unknown][] | undefined>(() => {\n const value = props.value\n if (Array.isArray(value)) {\n return value.length\n ? value.map(\n (item, index) =>\n [`${index + 1}`, item] as [string, unknown],\n )\n : undefined\n }\n if (value && typeof value === 'object') {\n const own = Object.entries(value as Record<string, unknown>)\n return own.length ? own : undefined\n }\n return undefined\n })\n\n const rows = computed<PayloadRow[] | undefined>(() =>\n entries.value?.map(([key, value]) => {\n const preview = toPreview(value)\n const full = typeof value === 'string' ? value : stringify(value, 2)\n return {\n key,\n preview: preview || '-',\n // Only a value the preview had to cut (long, multiline or\n // nested) is worth its own expandable block.\n full: full && full.trim() !== preview ? full : undefined,\n }\n }),\n )\n\n // Scalars and strings have no rows: they fall back to the plain payload.\n const text = computed(() =>\n rows.value ? undefined : stringifyPayload(props.value),\n )\n\n const summary = computed(() => {\n const list = rows.value\n if (!list) {\n return toPreview(props.value)\n }\n if (Array.isArray(props.value)) {\n return $t('messagePart.stepItems', list.length)\n }\n if (list.length === 1) {\n return `${list[0].key}: ${list[0].preview}`\n }\n return list.map((row) => row.key).join(' · ')\n })\n\n const isOpen = ref(false)\n const expandedRows = reactive(new Set<string>())\n const toggleRow = (key: string) => {\n if (expandedRows.has(key)) {\n expandedRows.delete(key)\n } else {\n expandedRows.add(key)\n }\n }\n</script>\n\n<template>\n <div v-if=\"rows || text\" class=\"pk-chatbot-step-payload\">\n <button\n type=\"button\"\n class=\"pk-chatbot-step-payload__header\"\n :aria-expanded=\"isOpen\"\n @click=\"isOpen = !isOpen\">\n <span class=\"pk-chatbot-step-payload__label\">{{ label }}</span>\n <span class=\"pk-chatbot-step-payload__summary\">\n {{ summary }}\n </span>\n <VvIcon\n :name=\"isOpen ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\"\n class=\"shrink-0\" />\n </button>\n <ul v-if=\"isOpen && rows\" class=\"pk-chatbot-step-payload__rows\">\n <li v-for=\"row in rows\" :key=\"row.key\">\n <component\n :is=\"row.full ? 'button' : 'div'\"\n :type=\"row.full ? 'button' : undefined\"\n class=\"pk-chatbot-step-payload__row\"\n :aria-expanded=\"\n row.full ? expandedRows.has(row.key) : undefined\n \"\n @click=\"row.full ? toggleRow(row.key) : undefined\">\n <span class=\"pk-chatbot-step-payload__key\">\n {{ row.key }}\n </span>\n <span class=\"pk-chatbot-step-payload__value\">\n {{ row.preview }}\n </span>\n <VvIcon\n v-if=\"row.full\"\n :name=\"\n expandedRows.has(row.key)\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"shrink-0\" />\n </component>\n <pre\n v-if=\"row.full && expandedRows.has(row.key)\"\n class=\"pk-chatbot-step-payload__full\"\n >{{ row.full }}</pre>\n </li>\n </ul>\n <pre v-else-if=\"isOpen\" class=\"pk-chatbot-step-payload__full\">{{\n text\n }}</pre>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-step-payload {\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface-1);\n overflow: hidden;\n\n &__header {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n width: 100%;\n min-height: var(--spacing-28);\n padding: var(--spacing-4) var(--spacing-8);\n text-align: left;\n cursor: pointer;\n transition: background-color 0.2s ease;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n }\n\n &__label {\n flex-shrink: 0;\n font-weight: 600;\n font-size: var(--text-10);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--color-word-3);\n }\n\n &__summary {\n flex: 1 1 0;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: var(--font-mono);\n font-size: var(--text-10);\n color: var(--color-word-4);\n }\n\n &__rows > li {\n border-top: var(--spacing-px) solid var(--color-surface-3);\n }\n\n &__row {\n display: flex;\n align-items: baseline;\n gap: var(--spacing-8);\n width: 100%;\n padding: var(--spacing-4) var(--spacing-8);\n text-align: left;\n font-size: var(--text-10);\n\n &:is(button) {\n cursor: pointer;\n transition: background-color 0.2s ease;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n }\n }\n\n &__key {\n flex-shrink: 0;\n max-width: 40%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: var(--font-mono);\n color: var(--color-word-4);\n }\n\n &__value {\n flex: 1 1 0;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--color-word-2);\n }\n\n &__full {\n padding: var(--spacing-8);\n border-top: var(--spacing-px) solid var(--color-surface-3);\n max-height: var(--spacing-160);\n overflow: auto;\n white-space: pre-wrap;\n word-break: break-word;\n font-family: var(--font-mono);\n font-size: var(--text-10);\n color: var(--color-word-3);\n }\n }\n</style>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AA;IAG/E,UAAK,MAAEA,EAAI,OAAOK,EAAUL,EAAI,GAAG,IAAI,KAAA;;IACxC,SAAArC,QAEO;KAFPP,EAEO,QAFPgB,GAEOf,EADA2C,EAAI,GAAG,GAAA,CAAA;KAEd5C,EAEO,QAFPiB,GAEOhB,EADA2C,EAAI,OAAO,GAAA,CAAA;KAGRA,EAAI,QADd9C,EAAA,GAAAO,EAOuB6C,GAAA;;MALlB,MAAmCH,EAAa,IAAIH,EAAI,GAAG,I;MAK5D,OAAM;;;;;;;;G,KAGJA,EAAI,QAAQG,EAAa,IAAIH,EAAI,GAAG,KAD9C9C,EAAA,GAAAC,EAGyB,OAHzBmB,GAGyBjB,EAAjB2C,EAAI,IAAI,GAAA,CAAA,K,0BAGRC,EAAA,SAAhB/C,EAAA,GAAAC,EAEQ,OAFRoB,GAEQlB,EADJwC,EAAA,KAAI,GAAA,CAAA,K"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotStepToolDetail-Sm5cPUAO.js","names":["__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_renderList","_createVNode","_createElementVNode","_toDisplayString","_createCommentVNode","_unref","_createBlock","_resolveDynamicComponent","_withCtx","_withModifiers","_normalizeStyle","PkChatbotStepPayload","_sfc_main","hasPayload","WEB_SEARCH_TOOL_TYPES","PkChatbotStepPayload_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","PkChatbotStepToolDetail_default","defineComponent","props","__props","$t","useI18n","asRecord","value","pickString","keys","key","record","formatCoordinates","latitude","longitude","rawInputValue","computed","rawOutputValue","input","output","queryChips","raw","query","spreadRelevance","min","scores","max","score","scoredRecords","records","item","relevances","index","knowledgeHits","results","groups","result","document","source","id","similarity","group","list","g","repeatedCount","count","searchFacts","facts","dropped","unavailable","queries","revisedAnswerHits","memoryHits","content","hitsDetail","hits","buildDetail","type","knowledge","totalChunks","name","mimeType","location","startDate","endDate","from","to","text","candidates","detail","expandedHits","reactive","toggleHit","_component_VvIcon","VvIcon","openBlock","createElementBlock","Fragment","renderList","chipIndex","chip","createVNode","createElementVNode","toDisplayString","createCommentVNode","factIndex","fact","unref","hit","createBlock","resolveDynamicComponent","withCtx","_cache","withModifiers","normalizeStyle"],"sources":["../../../../packages/components/src/chat/PkChatbotStepToolDetail.vue","../../../../packages/components/src/chat/PkChatbotStepToolDetail.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, reactive } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { UIChatMessage } from 'models'\n import PkChatbotStepPayload from './PkChatbotStepPayload.vue'\n import { hasPayload, WEB_SEARCH_TOOL_TYPES } from './utils'\n\n type MessagePart = UIChatMessage['parts'][number]\n\n interface DetailHit {\n key: string\n icon: string\n title: string\n url?: string\n meta?: string\n relevance?: number\n body?: string\n }\n\n interface DetailFact {\n icon: string\n text: string\n }\n\n interface Detail {\n chips?: string[]\n facts?: DetailFact[]\n hits?: DetailHit[]\n showEmpty?: boolean\n passage?: { title?: string; meta?: string; content: string }\n rawInput?: unknown\n rawOutput?: unknown\n }\n\n const props = defineProps<{\n part: MessagePart\n }>()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n const asRecord = (value: unknown): Record<string, unknown> | undefined =>\n value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined\n\n const pickString = (\n record: Record<string, unknown> | undefined,\n ...keys: string[]\n ): string | undefined => {\n for (const key of keys) {\n const value = record?.[key]\n if (typeof value === 'string' && value.trim()) {\n return value\n }\n }\n return undefined\n }\n\n const formatCoordinates = (\n record?: Record<string, unknown>,\n ): string | undefined => {\n const latitude = record?.latitude\n const longitude = record?.longitude\n if (typeof latitude !== 'number' || typeof longitude !== 'number') {\n return undefined\n }\n return `${latitude.toFixed(4)}, ${longitude.toFixed(4)}`\n }\n\n const rawInputValue = computed(() =>\n 'input' in props.part ? props.part.input : undefined,\n )\n const rawOutputValue = computed(() =>\n 'output' in props.part ? props.part.output : undefined,\n )\n const input = computed(() => asRecord(rawInputValue.value))\n const output = computed(() => asRecord(rawOutputValue.value))\n\n // Search queries shown as chips (queries[], query or objective)\n const queryChips = computed<string[]>(() => {\n const raw =\n input.value?.queries ?? input.value?.query ?? input.value?.objective\n if (typeof raw === 'string' && raw.trim()) {\n return [raw]\n }\n if (Array.isArray(raw)) {\n return raw.filter(\n (query): query is string =>\n typeof query === 'string' && Boolean(query.trim()),\n )\n }\n return []\n })\n\n // Raw scores live on different scales depending on the agent search mode\n // (RRF ~0.03, cosine 0 to 1) and tend to cluster, so a plain ratio on the\n // max renders every bar as ~100%. Spread them on a min/max scale with a\n // floor so the ordering stays visible, and hide the bar entirely when it\n // carries no information (single hit or identical scores).\n const spreadRelevance = (scores: number[]): (number | undefined)[] => {\n const min = Math.min(...scores)\n const max = Math.max(...scores)\n if (scores.length < 2 || max <= min) {\n return scores.map(() => undefined)\n }\n const floor = 0.15\n return scores.map(\n (score) => floor + ((score - min) / (max - min)) * (1 - floor),\n )\n }\n\n // Normalizes a raw result array into records paired with a spread\n // relevance derived from each record's `similarity` score.\n const scoredRecords = (\n raw: unknown,\n ):\n | { record: Record<string, unknown>; relevance?: number }[]\n | undefined => {\n if (!Array.isArray(raw)) {\n return undefined\n }\n const records = raw\n .map((item) => asRecord(item))\n .filter((record): record is Record<string, unknown> =>\n Boolean(record),\n )\n const relevances = spreadRelevance(\n records.map((record) =>\n typeof record.similarity === 'number' ? record.similarity : 0,\n ),\n )\n return records.map((record, index) => ({\n record,\n relevance: relevances[index],\n }))\n }\n\n // searchInKnowledgeBase: group chunks by document, relevance compares the\n // best chunk score of each document within the result set.\n const knowledgeHits = computed<DetailHit[] | undefined>(() => {\n const results = output.value?.results\n if (!Array.isArray(results)) {\n return undefined\n }\n interface DocumentGroup {\n id: string\n type: string\n title: string\n url?: string\n similarity: number\n chunks: string[]\n }\n const groups = new Map<string, DocumentGroup>()\n for (const [index, raw] of results.entries()) {\n const result = asRecord(raw)\n if (!result) {\n continue\n }\n const document = asRecord(result.document)\n const source = asRecord(document?.source)\n const id =\n typeof document?.id === 'string' ? document.id : `doc-${index}`\n const similarity =\n typeof result.similarity === 'number' ? result.similarity : 0\n let group = groups.get(id)\n if (!group) {\n group = {\n id,\n type:\n typeof document?.type === 'string' ? document.type : '',\n title:\n pickString(document, 'name') ??\n pickString(source, 'filename', 'url') ??\n $t('messagePart.stepDocument'),\n url: pickString(source, 'url'),\n similarity,\n chunks: [],\n }\n groups.set(id, group)\n }\n group.similarity = Math.max(group.similarity, similarity)\n if (typeof result.content === 'string' && result.content.trim()) {\n group.chunks.push(result.content)\n }\n }\n const list = [...groups.values()]\n const relevances = spreadRelevance(list.map((g) => g.similarity))\n return list.map((group, index) => ({\n key: group.id,\n icon: group.type === 'url' ? 'ri:global-line' : 'ri:file-text-line',\n title: group.title,\n url: group.url,\n meta: $t('messagePart.stepExcerpts', group.chunks.length || 1),\n relevance: relevances[index],\n body: group.chunks.join('\\n\\n· · ·\\n\\n') || undefined,\n }))\n })\n\n // Chunks this turn had already returned come back as references without\n // content (spec retrieval-payload-per-turn, R2). They carry no document\n // name to group by, so they are summarized in one line: without it a\n // search that found only known passages reads as \"no results\".\n const repeatedCount = computed<number>(() => {\n const count = asRecord(output.value?.repeated)?.count\n return typeof count === 'number' ? count : 0\n })\n\n // Two declarations every search tool can attach to its output, and the\n // only ones the model is explicitly told not to read as an answer: a\n // query dropped for exceeding the tool's cap, and a search that ran out\n // of time. Without them a timeout renders as \"no results\", which is the\n // reading whoever opens a chat log would take away too.\n const searchFacts = computed<DetailFact[]>(() => {\n const facts: DetailFact[] = []\n const dropped = asRecord(output.value?.inputTruncated)?.dropped\n if (Array.isArray(dropped) && dropped.length) {\n facts.push({\n icon: 'ri:scissors-cut-line',\n text: $t('messagePart.stepDropped', dropped.length),\n })\n }\n const unavailable = asRecord(output.value?.searchUnavailable)\n if (unavailable) {\n // The corrected-answers tool declares one lookup without naming\n // its query, so an absent list means one search, not none.\n const queries = unavailable.queries\n facts.push({\n icon: 'ri:time-line',\n text: $t(\n 'messagePart.stepTimedOut',\n Array.isArray(queries) ? queries.length : 1,\n ),\n })\n }\n return facts\n })\n\n // retrieveRevisedAnswers: one hit per matched question, the corrected\n // answer is the expandable body.\n const revisedAnswerHits = computed<DetailHit[] | undefined>(() =>\n scoredRecords(output.value?.results)?.map(\n ({ record, relevance }, index) => ({\n key:\n pickString(record, 'revisedAnswerId') ?? `revised-${index}`,\n icon: 'ri:file-edit-line',\n title:\n pickString(record, 'userQuestion') ??\n $t('messagePart.revisedAnswers'),\n relevance,\n body: pickString(record, 'revisedMessage'),\n }),\n ),\n )\n\n // recallUserMemory / saveUserMemory delete candidates: one hit per\n // memory, long facts expand to their full text.\n const memoryHits = (raw: unknown): DetailHit[] | undefined =>\n scoredRecords(raw)?.map(({ record, relevance }, index) => {\n const content = pickString(record, 'content') ?? ''\n return {\n key: pickString(record, 'id') ?? `memory-${index}`,\n icon: 'ri:brain-line',\n title: content,\n meta: pickString(record, 'updatedAt')?.slice(0, 10),\n relevance,\n body: content.length > 120 ? content : undefined,\n }\n })\n\n // Query chips over a list of hits, flagging an explicit empty state so the\n // \"no results\" message shows once the tool has run (hits defined, length 0).\n const hitsDetail = (hits: DetailHit[] | undefined): Detail => ({\n chips: queryChips.value,\n hits,\n showEmpty: hits !== undefined && !hits.length,\n })\n\n // Rich, tool-specific view of the step. Returns {} when the tool has\n // nothing meaningful to show yet (the raw fallback is applied by `detail`).\n const buildDetail = (): Detail => {\n const type = props.part.type\n if (type === 'tool-searchInKnowledgeBase') {\n const knowledge = hitsDetail(knowledgeHits.value)\n if (repeatedCount.value) {\n knowledge.facts = [\n {\n icon: 'ri:history-line',\n text: $t(\n 'messagePart.stepRepeated',\n repeatedCount.value,\n ),\n },\n ]\n knowledge.showEmpty = false\n }\n return knowledge\n }\n if (type === 'tool-retrieveRevisedAnswers') {\n return hitsDetail(revisedAnswerHits.value)\n }\n if (type === 'tool-expandChunkContext') {\n const content = pickString(output.value, 'content')\n if (!content) {\n return {}\n }\n const totalChunks = output.value?.totalChunksReturned\n return {\n passage: {\n title: pickString(output.value, 'documentName'),\n meta:\n typeof totalChunks === 'number'\n ? $t('messagePart.stepExcerpts', totalChunks)\n : undefined,\n content,\n },\n }\n }\n if (type === 'tool-readDocumentFile') {\n const name = pickString(output.value, 'name')\n if (!name) {\n return {}\n }\n const mimeType = pickString(output.value, 'mimeType')\n return {\n facts: [\n {\n icon: 'ri:file-text-line',\n text: mimeType ? `${name} (${mimeType})` : name,\n },\n ],\n }\n }\n if (type === 'tool-getWeather') {\n const location =\n pickString(output.value, 'location') ??\n pickString(input.value, 'locationName') ??\n formatCoordinates(input.value)\n if (!location) {\n return {}\n }\n const startDate = pickString(input.value, 'startDate')\n const endDate = pickString(input.value, 'endDate')\n const dateRange = startDate\n ? endDate && endDate !== startDate\n ? ` · ${startDate} → ${endDate}`\n : ` · ${startDate}`\n : ''\n return {\n facts: [\n {\n icon: 'ri:sun-cloudy-line',\n text: `${location}${dateRange}`,\n },\n ],\n }\n }\n if (type === 'tool-geocode') {\n const from =\n pickString(input.value, 'locationName') ??\n formatCoordinates(input.value)\n const to =\n pickString(\n output.value,\n 'name',\n 'displayName',\n 'locationName',\n 'label',\n ) ?? formatCoordinates(output.value)\n const text =\n from && to && from !== to ? `${from} → ${to}` : (from ?? to)\n if (!text) {\n return {}\n }\n return {\n facts: [\n {\n icon: 'ri:map-pin-line',\n text,\n },\n ],\n }\n }\n if (type === 'tool-recallUserMemory') {\n return hitsDetail(memoryHits(output.value?.memories))\n }\n if (type === 'tool-saveUserMemory') {\n const candidates = memoryHits(output.value?.candidates)\n if (candidates) {\n return hitsDetail(candidates)\n }\n const text =\n pickString(input.value, 'content') ??\n pickString(output.value, 'message', 'error')\n if (!text) {\n return {}\n }\n return {\n facts: [\n {\n icon:\n pickString(input.value, 'action') === 'delete'\n ? 'ri:delete-bin-line'\n : 'ri:save-3-line',\n text,\n },\n ],\n }\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(type)) {\n return {\n chips: queryChips.value,\n rawOutput: rawOutputValue.value,\n }\n }\n return {}\n }\n\n const detail = computed<Detail>(() => {\n const result = buildDetail()\n if (searchFacts.value.length) {\n result.facts = [...searchFacts.value, ...(result.facts ?? [])]\n }\n if (output.value?.searchUnavailable) {\n // \"No results found\" under a search that never answered is the\n // one sentence this fact exists to prevent.\n result.showEmpty = false\n }\n // Nothing meaningful to show for this tool yet (e.g. still running):\n // fall back to the raw payloads so the step body is never empty.\n const hasRichContent =\n result.chips?.length ||\n result.facts?.length ||\n result.passage ||\n result.showEmpty ||\n result.hits?.length\n if (!hasRichContent) {\n result.rawInput = rawInputValue.value\n result.rawOutput ??= rawOutputValue.value\n }\n return result\n })\n\n const expandedHits = reactive(new Set<string>())\n const toggleHit = (key: string) => {\n if (expandedHits.has(key)) {\n expandedHits.delete(key)\n } else {\n expandedHits.add(key)\n }\n }\n</script>\n\n<template>\n <div class=\"pk-chatbot-step-detail\">\n <ul v-if=\"detail.chips?.length\" class=\"pk-chatbot-step-detail__chips\">\n <li\n v-for=\"(chip, chipIndex) in detail.chips\"\n :key=\"`${chipIndex}-${chip}`\"\n class=\"pk-chatbot-step-detail__chip\">\n <VvIcon name=\"ri:search-line\" class=\"shrink-0\" />\n <span class=\"pk-chatbot-step-detail__chip-text\">\n {{ chip }}\n </span>\n </li>\n </ul>\n <div\n v-for=\"(fact, factIndex) in detail.facts\"\n :key=\"`${factIndex}-${fact.text}`\"\n class=\"pk-chatbot-step-detail__fact\">\n <VvIcon :name=\"fact.icon\" class=\"shrink-0\" />\n <span>{{ fact.text }}</span>\n </div>\n <div v-if=\"detail.showEmpty\" class=\"pk-chatbot-step-detail__empty\">\n {{ $t('messagePart.stepNoResults') }}\n </div>\n <ul\n v-else-if=\"detail.hits?.length\"\n class=\"pk-chatbot-step-detail__hits\">\n <li v-for=\"hit in detail.hits\" :key=\"hit.key\">\n <component\n :is=\"hit.body ? 'button' : 'div'\"\n :type=\"hit.body ? 'button' : undefined\"\n class=\"pk-chatbot-step-detail__hit-header\"\n :aria-expanded=\"\n hit.body ? expandedHits.has(hit.key) : undefined\n \"\n @click=\"hit.body ? toggleHit(hit.key) : undefined\">\n <VvIcon\n :name=\"hit.icon\"\n class=\"pk-chatbot-step-detail__hit-icon\" />\n <span class=\"pk-chatbot-step-detail__hit-heading\">\n <span class=\"pk-chatbot-step-detail__hit-title\">\n {{ hit.title }}\n </span>\n <a\n v-if=\"hit.url\"\n :href=\"hit.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-step-detail__link\"\n @click.stop>\n <VvIcon name=\"ri:external-link-line\" />\n </a>\n </span>\n <span\n v-if=\"hit.meta\"\n class=\"pk-chatbot-step-detail__hit-meta\">\n {{ hit.meta }}\n </span>\n <span\n v-if=\"hit.relevance !== undefined\"\n class=\"pk-chatbot-step-detail__relevance\"\n aria-hidden=\"true\">\n <span\n class=\"pk-chatbot-step-detail__relevance-fill\"\n :style=\"{\n width: `${Math.round(hit.relevance * 100)}%`,\n }\" />\n </span>\n <VvIcon\n v-if=\"hit.body\"\n :name=\"\n expandedHits.has(hit.key)\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"shrink-0\" />\n </component>\n <div\n v-if=\"hit.body && expandedHits.has(hit.key)\"\n class=\"pk-chatbot-step-detail__hit-body\">\n {{ hit.body }}\n </div>\n </li>\n </ul>\n <div v-if=\"detail.passage\" class=\"pk-chatbot-step-detail__passage\">\n <div class=\"pk-chatbot-step-detail__passage-header\">\n <VvIcon name=\"ri:file-text-line\" class=\"shrink-0\" />\n <span class=\"pk-chatbot-step-detail__hit-heading\">\n <span class=\"pk-chatbot-step-detail__hit-title\">\n {{\n detail.passage.title ??\n $t('messagePart.stepDocument')\n }}\n </span>\n </span>\n <span\n v-if=\"detail.passage.meta\"\n class=\"pk-chatbot-step-detail__hit-meta\">\n {{ detail.passage.meta }}\n </span>\n </div>\n <div class=\"pk-chatbot-step-detail__passage-content\">\n {{ detail.passage.content }}\n </div>\n </div>\n <PkChatbotStepPayload\n v-if=\"hasPayload(detail.rawInput)\"\n :label=\"$t('messagePart.stepInput')\"\n :value=\"detail.rawInput\" />\n <PkChatbotStepPayload\n v-if=\"hasPayload(detail.rawOutput)\"\n :label=\"$t('messagePart.stepOutput')\"\n :value=\"detail.rawOutput\" />\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-step-detail {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-8);\n font-size: var(--text-12);\n color: var(--color-word-3);\n\n &__chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-4);\n }\n\n &__chip {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n max-width: 100%;\n padding: var(--spacing-2) var(--spacing-8);\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded-full);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n }\n\n &__chip-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__fact {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n color: var(--color-word-2);\n }\n\n &__empty {\n color: var(--color-word-4);\n font-style: italic;\n }\n\n &__hits {\n display: flex;\n flex-direction: column;\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface-1);\n overflow: hidden;\n\n > li + li {\n border-top: var(--spacing-px) solid var(--color-surface-3);\n }\n }\n\n &__hit-header {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n width: 100%;\n min-height: var(--spacing-32);\n padding: var(--spacing-4) var(--spacing-8);\n text-align: left;\n\n &:is(button) {\n cursor: pointer;\n transition: background-color 0.2s ease;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n }\n }\n\n &__hit-icon {\n flex-shrink: 0;\n color: var(--color-word-3);\n }\n\n // Grows to fill the row so meta, relevance and chevron stay aligned;\n // the title inside only shrinks, keeping the link icon next to the\n // title text instead of pushed to the right edge.\n &__hit-heading {\n display: flex;\n align-items: center;\n gap: var(--spacing-4);\n flex: 1 1 0;\n min-width: 0;\n }\n\n &__hit-title {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--color-word-2);\n }\n\n &__hit-meta {\n color: var(--color-word-4);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n &__relevance {\n flex-shrink: 0;\n width: var(--spacing-40);\n height: var(--spacing-4);\n border-radius: var(--rounded-full);\n background-color: var(--color-surface-3);\n overflow: hidden;\n }\n\n &__relevance-fill {\n display: block;\n height: 100%;\n border-radius: inherit;\n background-color: var(--chatbot-main-color, var(--color-word-4));\n }\n\n &__link {\n flex-shrink: 0;\n display: inline-flex;\n color: var(--color-word-4);\n\n &:hover {\n color: var(--color-word-1);\n }\n }\n\n &__hit-body,\n &__passage-content {\n padding: var(--spacing-8);\n max-height: var(--spacing-160);\n overflow: auto;\n white-space: pre-wrap;\n word-break: break-word;\n color: var(--color-word-3);\n }\n\n &__hit-body {\n border-top: var(--spacing-px) solid var(--color-surface-3);\n }\n\n &__passage {\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface-1);\n overflow: hidden;\n }\n\n &__passage-header {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n min-height: var(--spacing-32);\n padding: var(--spacing-4) var(--spacing-8);\n border-bottom: var(--spacing-px) solid var(--color-surface-3);\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import { computed, reactive } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { UIChatMessage } from 'models'\n import PkChatbotStepPayload from './PkChatbotStepPayload.vue'\n import { hasPayload, WEB_SEARCH_TOOL_TYPES } from './utils'\n\n type MessagePart = UIChatMessage['parts'][number]\n\n interface DetailHit {\n key: string\n icon: string\n title: string\n url?: string\n meta?: string\n relevance?: number\n body?: string\n }\n\n interface DetailFact {\n icon: string\n text: string\n }\n\n interface Detail {\n chips?: string[]\n facts?: DetailFact[]\n hits?: DetailHit[]\n showEmpty?: boolean\n passage?: { title?: string; meta?: string; content: string }\n rawInput?: unknown\n rawOutput?: unknown\n }\n\n const props = defineProps<{\n part: MessagePart\n }>()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n const asRecord = (value: unknown): Record<string, unknown> | undefined =>\n value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined\n\n const pickString = (\n record: Record<string, unknown> | undefined,\n ...keys: string[]\n ): string | undefined => {\n for (const key of keys) {\n const value = record?.[key]\n if (typeof value === 'string' && value.trim()) {\n return value\n }\n }\n return undefined\n }\n\n const formatCoordinates = (\n record?: Record<string, unknown>,\n ): string | undefined => {\n const latitude = record?.latitude\n const longitude = record?.longitude\n if (typeof latitude !== 'number' || typeof longitude !== 'number') {\n return undefined\n }\n return `${latitude.toFixed(4)}, ${longitude.toFixed(4)}`\n }\n\n const rawInputValue = computed(() =>\n 'input' in props.part ? props.part.input : undefined,\n )\n const rawOutputValue = computed(() =>\n 'output' in props.part ? props.part.output : undefined,\n )\n const input = computed(() => asRecord(rawInputValue.value))\n const output = computed(() => asRecord(rawOutputValue.value))\n\n // Search queries shown as chips (queries[], query or objective)\n const queryChips = computed<string[]>(() => {\n const raw =\n input.value?.queries ?? input.value?.query ?? input.value?.objective\n if (typeof raw === 'string' && raw.trim()) {\n return [raw]\n }\n if (Array.isArray(raw)) {\n return raw.filter(\n (query): query is string =>\n typeof query === 'string' && Boolean(query.trim()),\n )\n }\n return []\n })\n\n // Raw scores live on different scales depending on the agent search mode\n // (RRF ~0.03, cosine 0 to 1) and tend to cluster, so a plain ratio on the\n // max renders every bar as ~100%. Spread them on a min/max scale with a\n // floor so the ordering stays visible, and hide the bar entirely when it\n // carries no information (single hit or identical scores).\n const spreadRelevance = (scores: number[]): (number | undefined)[] => {\n const min = Math.min(...scores)\n const max = Math.max(...scores)\n if (scores.length < 2 || max <= min) {\n return scores.map(() => undefined)\n }\n const floor = 0.15\n return scores.map(\n (score) => floor + ((score - min) / (max - min)) * (1 - floor),\n )\n }\n\n // Normalizes a raw result array into records paired with a spread\n // relevance derived from each record's `similarity` score.\n const scoredRecords = (\n raw: unknown,\n ):\n | { record: Record<string, unknown>; relevance?: number }[]\n | undefined => {\n if (!Array.isArray(raw)) {\n return undefined\n }\n const records = raw\n .map((item) => asRecord(item))\n .filter((record): record is Record<string, unknown> =>\n Boolean(record),\n )\n const relevances = spreadRelevance(\n records.map((record) =>\n typeof record.similarity === 'number' ? record.similarity : 0,\n ),\n )\n return records.map((record, index) => ({\n record,\n relevance: relevances[index],\n }))\n }\n\n // searchInKnowledgeBase: group chunks by document, relevance compares the\n // best chunk score of each document within the result set.\n const knowledgeHits = computed<DetailHit[] | undefined>(() => {\n const results = output.value?.results\n if (!Array.isArray(results)) {\n return undefined\n }\n interface DocumentGroup {\n id: string\n type: string\n title: string\n url?: string\n similarity: number\n chunks: string[]\n }\n const groups = new Map<string, DocumentGroup>()\n for (const [index, raw] of results.entries()) {\n const result = asRecord(raw)\n if (!result) {\n continue\n }\n const document = asRecord(result.document)\n const source = asRecord(document?.source)\n const id =\n typeof document?.id === 'string' ? document.id : `doc-${index}`\n const similarity =\n typeof result.similarity === 'number' ? result.similarity : 0\n let group = groups.get(id)\n if (!group) {\n group = {\n id,\n type:\n typeof document?.type === 'string' ? document.type : '',\n title:\n pickString(document, 'name') ??\n pickString(source, 'filename', 'url') ??\n $t('messagePart.stepDocument'),\n url: pickString(source, 'url'),\n similarity,\n chunks: [],\n }\n groups.set(id, group)\n }\n group.similarity = Math.max(group.similarity, similarity)\n if (typeof result.content === 'string' && result.content.trim()) {\n group.chunks.push(result.content)\n }\n }\n const list = [...groups.values()]\n const relevances = spreadRelevance(list.map((g) => g.similarity))\n return list.map((group, index) => ({\n key: group.id,\n icon: group.type === 'url' ? 'ri:global-line' : 'ri:file-text-line',\n title: group.title,\n url: group.url,\n meta: $t('messagePart.stepExcerpts', group.chunks.length || 1),\n relevance: relevances[index],\n body: group.chunks.join('\\n\\n· · ·\\n\\n') || undefined,\n }))\n })\n\n // Chunks this turn had already returned come back as references without\n // content (spec retrieval-payload-per-turn, R2). They carry no document\n // name to group by, so they are summarized in one line: without it a\n // search that found only known passages reads as \"no results\".\n const repeatedCount = computed<number>(() => {\n const count = asRecord(output.value?.repeated)?.count\n return typeof count === 'number' ? count : 0\n })\n\n // Two declarations every search tool can attach to its output, and the\n // only ones the model is explicitly told not to read as an answer: a\n // query dropped for exceeding the tool's cap, and a search that ran out\n // of time. Without them a timeout renders as \"no results\", which is the\n // reading whoever opens a chat log would take away too.\n const searchFacts = computed<DetailFact[]>(() => {\n const facts: DetailFact[] = []\n const dropped = asRecord(output.value?.inputTruncated)?.dropped\n if (Array.isArray(dropped) && dropped.length) {\n facts.push({\n icon: 'ri:scissors-cut-line',\n text: $t('messagePart.stepDropped', dropped.length),\n })\n }\n const unavailable = asRecord(output.value?.searchUnavailable)\n if (unavailable) {\n // The corrected-answers tool declares one lookup without naming\n // its query, so an absent list means one search, not none.\n const queries = unavailable.queries\n facts.push({\n icon: 'ri:time-line',\n text: $t(\n 'messagePart.stepTimedOut',\n Array.isArray(queries) ? queries.length : 1,\n ),\n })\n }\n return facts\n })\n\n // retrieveRevisedAnswers: one hit per matched question, the corrected\n // answer is the expandable body.\n const revisedAnswerHits = computed<DetailHit[] | undefined>(() =>\n scoredRecords(output.value?.results)?.map(\n ({ record, relevance }, index) => ({\n key:\n pickString(record, 'revisedAnswerId') ?? `revised-${index}`,\n icon: 'ri:file-edit-line',\n title:\n pickString(record, 'userQuestion') ??\n $t('messagePart.revisedAnswers'),\n relevance,\n body: pickString(record, 'revisedMessage'),\n }),\n ),\n )\n\n // recallUserMemory / saveUserMemory delete candidates: one hit per\n // memory, long facts expand to their full text.\n const memoryHits = (raw: unknown): DetailHit[] | undefined =>\n scoredRecords(raw)?.map(({ record, relevance }, index) => {\n const content = pickString(record, 'content') ?? ''\n return {\n key: pickString(record, 'id') ?? `memory-${index}`,\n icon: 'ri:brain-line',\n title: content,\n meta: pickString(record, 'updatedAt')?.slice(0, 10),\n relevance,\n body: content.length > 120 ? content : undefined,\n }\n })\n\n // Query chips over a list of hits, flagging an explicit empty state so the\n // \"no results\" message shows once the tool has run (hits defined, length 0).\n const hitsDetail = (hits: DetailHit[] | undefined): Detail => ({\n chips: queryChips.value,\n hits,\n showEmpty: hits !== undefined && !hits.length,\n })\n\n // Rich, tool-specific view of the step. Returns {} when the tool has\n // nothing meaningful to show yet (the raw fallback is applied by `detail`).\n const buildDetail = (): Detail => {\n const type = props.part.type\n if (type === 'tool-searchInKnowledgeBase') {\n const knowledge = hitsDetail(knowledgeHits.value)\n if (repeatedCount.value) {\n knowledge.facts = [\n {\n icon: 'ri:history-line',\n text: $t(\n 'messagePart.stepRepeated',\n repeatedCount.value,\n ),\n },\n ]\n knowledge.showEmpty = false\n }\n return knowledge\n }\n if (type === 'tool-retrieveRevisedAnswers') {\n return hitsDetail(revisedAnswerHits.value)\n }\n if (type === 'tool-expandChunkContext') {\n const content = pickString(output.value, 'content')\n if (!content) {\n return {}\n }\n const totalChunks = output.value?.totalChunksReturned\n return {\n passage: {\n title: pickString(output.value, 'documentName'),\n meta:\n typeof totalChunks === 'number'\n ? $t('messagePart.stepExcerpts', totalChunks)\n : undefined,\n content,\n },\n }\n }\n if (type === 'tool-readDocumentFile') {\n const name = pickString(output.value, 'name')\n if (!name) {\n return {}\n }\n const mimeType = pickString(output.value, 'mimeType')\n return {\n facts: [\n {\n icon: 'ri:file-text-line',\n text: mimeType ? `${name} (${mimeType})` : name,\n },\n ],\n }\n }\n if (type === 'tool-getWeather') {\n const location =\n pickString(output.value, 'location') ??\n pickString(input.value, 'locationName') ??\n formatCoordinates(input.value)\n if (!location) {\n return {}\n }\n const startDate = pickString(input.value, 'startDate')\n const endDate = pickString(input.value, 'endDate')\n const dateRange = startDate\n ? endDate && endDate !== startDate\n ? ` · ${startDate} → ${endDate}`\n : ` · ${startDate}`\n : ''\n return {\n facts: [\n {\n icon: 'ri:sun-cloudy-line',\n text: `${location}${dateRange}`,\n },\n ],\n }\n }\n if (type === 'tool-geocode') {\n const from =\n pickString(input.value, 'locationName') ??\n formatCoordinates(input.value)\n const to =\n pickString(\n output.value,\n 'name',\n 'displayName',\n 'locationName',\n 'label',\n ) ?? formatCoordinates(output.value)\n const text =\n from && to && from !== to ? `${from} → ${to}` : (from ?? to)\n if (!text) {\n return {}\n }\n return {\n facts: [\n {\n icon: 'ri:map-pin-line',\n text,\n },\n ],\n }\n }\n if (type === 'tool-recallUserMemory') {\n return hitsDetail(memoryHits(output.value?.memories))\n }\n if (type === 'tool-saveUserMemory') {\n const candidates = memoryHits(output.value?.candidates)\n if (candidates) {\n return hitsDetail(candidates)\n }\n const text =\n pickString(input.value, 'content') ??\n pickString(output.value, 'message', 'error')\n if (!text) {\n return {}\n }\n return {\n facts: [\n {\n icon:\n pickString(input.value, 'action') === 'delete'\n ? 'ri:delete-bin-line'\n : 'ri:save-3-line',\n text,\n },\n ],\n }\n }\n if (WEB_SEARCH_TOOL_TYPES.includes(type)) {\n return {\n chips: queryChips.value,\n rawOutput: rawOutputValue.value,\n }\n }\n return {}\n }\n\n const detail = computed<Detail>(() => {\n const result = buildDetail()\n if (searchFacts.value.length) {\n result.facts = [...searchFacts.value, ...(result.facts ?? [])]\n }\n if (output.value?.searchUnavailable) {\n // \"No results found\" under a search that never answered is the\n // one sentence this fact exists to prevent.\n result.showEmpty = false\n }\n // Nothing meaningful to show for this tool yet (e.g. still running):\n // fall back to the raw payloads so the step body is never empty.\n const hasRichContent =\n result.chips?.length ||\n result.facts?.length ||\n result.passage ||\n result.showEmpty ||\n result.hits?.length\n if (!hasRichContent) {\n result.rawInput = rawInputValue.value\n result.rawOutput ??= rawOutputValue.value\n }\n return result\n })\n\n const expandedHits = reactive(new Set<string>())\n const toggleHit = (key: string) => {\n if (expandedHits.has(key)) {\n expandedHits.delete(key)\n } else {\n expandedHits.add(key)\n }\n }\n</script>\n\n<template>\n <div class=\"pk-chatbot-step-detail\">\n <ul v-if=\"detail.chips?.length\" class=\"pk-chatbot-step-detail__chips\">\n <li\n v-for=\"(chip, chipIndex) in detail.chips\"\n :key=\"`${chipIndex}-${chip}`\"\n class=\"pk-chatbot-step-detail__chip\">\n <VvIcon name=\"ri:search-line\" class=\"shrink-0\" />\n <span class=\"pk-chatbot-step-detail__chip-text\">\n {{ chip }}\n </span>\n </li>\n </ul>\n <div\n v-for=\"(fact, factIndex) in detail.facts\"\n :key=\"`${factIndex}-${fact.text}`\"\n class=\"pk-chatbot-step-detail__fact\">\n <VvIcon :name=\"fact.icon\" class=\"shrink-0\" />\n <span>{{ fact.text }}</span>\n </div>\n <div v-if=\"detail.showEmpty\" class=\"pk-chatbot-step-detail__empty\">\n {{ $t('messagePart.stepNoResults') }}\n </div>\n <ul\n v-else-if=\"detail.hits?.length\"\n class=\"pk-chatbot-step-detail__hits\">\n <li v-for=\"hit in detail.hits\" :key=\"hit.key\">\n <component\n :is=\"hit.body ? 'button' : 'div'\"\n :type=\"hit.body ? 'button' : undefined\"\n class=\"pk-chatbot-step-detail__hit-header\"\n :aria-expanded=\"\n hit.body ? expandedHits.has(hit.key) : undefined\n \"\n @click=\"hit.body ? toggleHit(hit.key) : undefined\">\n <VvIcon\n :name=\"hit.icon\"\n class=\"pk-chatbot-step-detail__hit-icon\" />\n <span class=\"pk-chatbot-step-detail__hit-heading\">\n <span class=\"pk-chatbot-step-detail__hit-title\">\n {{ hit.title }}\n </span>\n <a\n v-if=\"hit.url\"\n :href=\"hit.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-step-detail__link\"\n @click.stop>\n <VvIcon name=\"ri:external-link-line\" />\n </a>\n </span>\n <span\n v-if=\"hit.meta\"\n class=\"pk-chatbot-step-detail__hit-meta\">\n {{ hit.meta }}\n </span>\n <span\n v-if=\"hit.relevance !== undefined\"\n class=\"pk-chatbot-step-detail__relevance\"\n aria-hidden=\"true\">\n <span\n class=\"pk-chatbot-step-detail__relevance-fill\"\n :style=\"{\n width: `${Math.round(hit.relevance * 100)}%`,\n }\" />\n </span>\n <VvIcon\n v-if=\"hit.body\"\n :name=\"\n expandedHits.has(hit.key)\n ? 'ri:arrow-up-s-line'\n : 'ri:arrow-down-s-line'\n \"\n class=\"shrink-0\" />\n </component>\n <div\n v-if=\"hit.body && expandedHits.has(hit.key)\"\n class=\"pk-chatbot-step-detail__hit-body\">\n {{ hit.body }}\n </div>\n </li>\n </ul>\n <div v-if=\"detail.passage\" class=\"pk-chatbot-step-detail__passage\">\n <div class=\"pk-chatbot-step-detail__passage-header\">\n <VvIcon name=\"ri:file-text-line\" class=\"shrink-0\" />\n <span class=\"pk-chatbot-step-detail__hit-heading\">\n <span class=\"pk-chatbot-step-detail__hit-title\">\n {{\n detail.passage.title ??\n $t('messagePart.stepDocument')\n }}\n </span>\n </span>\n <span\n v-if=\"detail.passage.meta\"\n class=\"pk-chatbot-step-detail__hit-meta\">\n {{ detail.passage.meta }}\n </span>\n </div>\n <div class=\"pk-chatbot-step-detail__passage-content\">\n {{ detail.passage.content }}\n </div>\n </div>\n <PkChatbotStepPayload\n v-if=\"hasPayload(detail.rawInput)\"\n :label=\"$t('messagePart.stepInput')\"\n :value=\"detail.rawInput\" />\n <PkChatbotStepPayload\n v-if=\"hasPayload(detail.rawOutput)\"\n :label=\"$t('messagePart.stepOutput')\"\n :value=\"detail.rawOutput\" />\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-step-detail {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-8);\n font-size: var(--text-12);\n color: var(--color-word-3);\n\n &__chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-4);\n }\n\n &__chip {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n max-width: 100%;\n padding: var(--spacing-2) var(--spacing-8);\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded-full);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n }\n\n &__chip-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__fact {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n color: var(--color-word-2);\n }\n\n &__empty {\n color: var(--color-word-4);\n font-style: italic;\n }\n\n &__hits {\n display: flex;\n flex-direction: column;\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface-1);\n overflow: hidden;\n\n > li + li {\n border-top: var(--spacing-px) solid var(--color-surface-3);\n }\n }\n\n &__hit-header {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n width: 100%;\n min-height: var(--spacing-32);\n padding: var(--spacing-4) var(--spacing-8);\n text-align: left;\n\n &:is(button) {\n cursor: pointer;\n transition: background-color 0.2s ease;\n\n &:hover {\n background-color: var(--color-surface-2);\n }\n }\n }\n\n &__hit-icon {\n flex-shrink: 0;\n color: var(--color-word-3);\n }\n\n // Grows to fill the row so meta, relevance and chevron stay aligned;\n // the title inside only shrinks, keeping the link icon next to the\n // title text instead of pushed to the right edge.\n &__hit-heading {\n display: flex;\n align-items: center;\n gap: var(--spacing-4);\n flex: 1 1 0;\n min-width: 0;\n }\n\n &__hit-title {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--color-word-2);\n }\n\n &__hit-meta {\n color: var(--color-word-4);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n &__relevance {\n flex-shrink: 0;\n width: var(--spacing-40);\n height: var(--spacing-4);\n border-radius: var(--rounded-full);\n background-color: var(--color-surface-3);\n overflow: hidden;\n }\n\n &__relevance-fill {\n display: block;\n height: 100%;\n border-radius: inherit;\n background-color: var(--chatbot-main-color, var(--color-word-4));\n }\n\n &__link {\n flex-shrink: 0;\n display: inline-flex;\n color: var(--color-word-4);\n\n &:hover {\n color: var(--color-word-1);\n }\n }\n\n &__hit-body,\n &__passage-content {\n padding: var(--spacing-8);\n max-height: var(--spacing-160);\n overflow: auto;\n white-space: pre-wrap;\n word-break: break-word;\n color: var(--color-word-3);\n }\n\n &__hit-body {\n border-top: var(--spacing-px) solid var(--color-surface-3);\n }\n\n &__passage {\n border: var(--spacing-px) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface-1);\n overflow: hidden;\n }\n\n &__passage-header {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n min-height: var(--spacing-32);\n padding: var(--spacing-4) var(--spacing-8);\n border-bottom: var(--spacing-px) solid var(--color-surface-3);\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCI,IAAMuC,IAAQC,GAIR,EAAE,GAAGC,MAAOC,EAAQ,EACtB,UAAU,SACd,CAAC,GAEKC,KAAY,MACdC,KAAS,OAAOA,KAAU,YAAY,CAAC,MAAM,QAAQA,CAAK,IACnDA,IACD,KAAA,GAEJC,KACF,GACA,GAAGC,MACkB;GACrB,KAAK,IAAMC,KAAOD,GAAM;IACpB,IAAMF,IAAQI,IAASD;IACvB,IAAI,OAAOH,KAAU,YAAYA,EAAM,KAAK,GACxC,OAAOA;GAEf;EAEJ,GAEMK,KACF,MACqB;GACrB,IAAMC,IAAWF,GAAQ,UACnBG,IAAYH,GAAQ;GAC1B,IAAI,OAAOE,KAAa,YAAY,OAAOC,KAAc,UAGzD,OAAO,GAAGD,EAAS,QAAQ,CAAC,EAAE,IAAIC,EAAU,QAAQ,CAAC;EACzD,GAEMC,IAAgBC,QAClB,WAAWd,EAAM,OAAOA,EAAM,KAAK,QAAQ,KAAA,CAC/C,GACMe,IAAiBD,QACnB,YAAYd,EAAM,OAAOA,EAAM,KAAK,SAAS,KAAA,CACjD,GACMgB,IAAQF,QAAeV,EAASS,EAAc,KAAK,CAA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