n8n-editor-ui 1.83.2 → 1.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/assets/{AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-COOCXFFe.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-BefsLZo6.js} +1 -1
  2. package/dist/assets/{AuthView-C7UxnH6d.js → AuthView-Bwnmj61F.js} +2 -2
  3. package/dist/assets/{CanvasChat-CSLR5tKe.css → CanvasChatSwitch-BcSDHC-c.css} +546 -33
  4. package/dist/assets/{CanvasChat-CmjR9yPV.js → CanvasChatSwitch-Dgc1t6ax.js} +1047 -550
  5. package/dist/assets/{ChangePasswordView-ah8H7l7b.js → ChangePasswordView-Ojbow8CX.js} +3 -3
  6. package/dist/assets/CollectionParameter-2r_LuiyO.js +4 -0
  7. package/dist/assets/CommitMonoVariable-ytizKI8U.woff2 +0 -0
  8. package/dist/assets/{CredentialsView-DqcTSsjv.js → CredentialsView-DhEvPiu_.js} +19 -9
  9. package/dist/assets/{ErrorView-DG7aEbhz.js → ErrorView-RGryGbpa.js} +1 -1
  10. package/dist/assets/{ConcurrentExecutionsHeader-CEBmSYNK.css → ExecutionsTime-BOPJEomw.css} +63 -63
  11. package/dist/assets/{ConcurrentExecutionsHeader-tdwilNra.js → ExecutionsTime.vue_vue_type_script_setup_true_lang-Iwq0aeRX.js} +114 -114
  12. package/dist/assets/ExecutionsView-CL7Ei3Em.js +943 -0
  13. package/dist/assets/{ExecutionsView-CB1tvZfo.css → ExecutionsView-JCKikuIS.css} +60 -188
  14. package/dist/assets/{FileSaver.min-D9u6MONp.js → FileSaver.min-C4OYrSWg.js} +1 -1
  15. package/dist/assets/{FixedCollectionParameter-CLjLHGyL.js → FixedCollectionParameter-CJ4s-1jy.js} +1 -1
  16. package/dist/assets/{ForgotMyPasswordView-DDtUSUcw.js → ForgotMyPasswordView-7tFMaf89.js} +3 -3
  17. package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
  18. package/dist/assets/InterVariable-Italic-FCBEiFp6.woff2 +0 -0
  19. package/dist/assets/{Logo-CBvZEey7.js → Logo-BW8jOa0h.js} +8 -19
  20. package/dist/assets/{ProjectHeader-BZ6b6lat.css → Logo-DLBj1gMw.css} +23 -17
  21. package/dist/assets/{MainHeader-PgJurmwZ.js → MainHeader-BUWCKbvC.js} +47 -22
  22. package/dist/assets/{MainHeader-CX-ZfeKE.css → MainHeader-CWA2JfVJ.css} +22 -22
  23. package/dist/assets/{MainSidebar-DsyUXL2c.js → MainSidebar-BeZfQeco.js} +75 -42
  24. package/dist/assets/{MainSidebar-BRAjTL7J.css → MainSidebar-CKMiDGvH.css} +13 -12
  25. package/dist/assets/{NodeCreation-CiSTfSrv.js → NodeCreation-DIg39Pbx.js} +5 -5
  26. package/dist/assets/{NodeCreator-16svYK-i.js → NodeCreator-BwYjrEUk.js} +10 -11
  27. package/dist/assets/{NodeCreator-DDiuO5S0.css → NodeCreator-D9fmPdS2.css} +12 -12
  28. package/dist/assets/{NodeDetailsView-CVVfk-zW.css → NodeDetailsView-C1z3N5z_.css} +46 -46
  29. package/dist/assets/{NodeDetailsView-D5ZKTnOO.js → NodeDetailsView-WuroVzlr.js} +93 -85
  30. package/dist/assets/{NodeView-CVxHVGxF.js → NodeView-CmjajouX.js} +63 -28
  31. package/dist/assets/{ProjectCardBadge-DKJ8uRN7.js → ProjectCardBadge-cIqYJxKe.js} +1 -1
  32. package/dist/assets/ProjectHeader-B-a6_GH6.css +285 -0
  33. package/dist/assets/{ProjectHeader-BY3TAX3C.js → ProjectHeader-BGrFY-5v.js} +66 -27
  34. package/dist/assets/{ProjectSettings-B3FxW1ze.js → ProjectSettings-D10vay6-.js} +2 -3
  35. package/dist/assets/{PushConnectionTracker.vue_vue_type_script_setup_true_lang-CzwYeMCe.js → PushConnectionTracker.vue_vue_type_script_setup_true_lang-DJAYslHT.js} +2 -2
  36. package/dist/assets/{ResourcesListLayout-DbPhtDij.js → ResourcesListLayout-C6v8Zm5q.js} +25 -21
  37. package/dist/assets/{ResourcesListLayout-Brs7VKUf.css → ResourcesListLayout-CWgWhtKq.css} +43 -33
  38. package/dist/assets/{RunDataAi-DJ-PSs_k.css → RunDataAi-CN9FrT9c.css} +2 -2
  39. package/dist/assets/{RunDataAi-Cq_XIdUj.js → RunDataAi-dhPBStdr.js} +25 -20
  40. package/dist/assets/{RunDataJson-BYaB0x1O.js → RunDataJson-kGRhUGn3.js} +12 -12
  41. package/dist/assets/{RunDataJsonActions-CU0K3JKo.js → RunDataJsonActions-BTljOq8V.js} +2 -2
  42. package/dist/assets/{RunDataSearch-Cx3Q6SS-.js → RunDataSearch-mVQhE8PH.js} +1 -1
  43. package/dist/assets/{RunDataTable-thC_K8V5.js → RunDataTable-CFoDiExh.js} +2 -2
  44. package/dist/assets/{SamlOnboarding-kqju2Vdw.js → SamlOnboarding-dDZHHNp4.js} +3 -3
  45. package/dist/assets/{SettingsApiView-DZWY9nyk.js → SettingsApiView-C9hbuZ42.js} +2 -3
  46. package/dist/assets/{SettingsCommunityNodesView-BLPF2nGe.js → SettingsCommunityNodesView-0wzih2lc.js} +5 -5
  47. package/dist/assets/{SettingsExternalSecrets-giVhhOpK.js → SettingsExternalSecrets-BCDoBPTc.js} +1 -1
  48. package/dist/assets/{SettingsLdapView-CcLGbweG.js → SettingsLdapView-CBCprymb.js} +1 -1
  49. package/dist/assets/{SettingsLogStreamingView-T4v-UDVv.js → SettingsLogStreamingView-CMQQQdcB.js} +2 -2
  50. package/dist/assets/{SettingsPersonalView-C1vojEEm.js → SettingsPersonalView-DtAM5Qmb.js} +1 -1
  51. package/dist/assets/{SettingsSourceControl-mTHmVIMw.js → SettingsSourceControl-CysMFVZs.js} +1 -1
  52. package/dist/assets/{SettingsSso-BBoPSBvR.js → SettingsSso-B0PZUvVx.js} +7 -7
  53. package/dist/assets/{SettingsSso-BjoJZ2DU.css → SettingsSso-DyrGnPdA.css} +10 -10
  54. package/dist/assets/{SettingsUsageAndPlan-CT1Jb0GH.js → SettingsUsageAndPlan-2QUTEbXv.js} +8 -3
  55. package/dist/assets/{SettingsUsageAndPlan-Cul4YcIk.css → SettingsUsageAndPlan-b3WY2Ea_.css} +3 -3
  56. package/dist/assets/{SettingsUsersView-Cak1x7Pc.js → SettingsUsersView-C16e4GB4.js} +1 -1
  57. package/dist/assets/{SettingsView-DCkltMay.js → SettingsView-B-BQ6FGS.js} +1 -1
  58. package/dist/assets/{SetupView-DJmIQyS0.js → SetupView-Kx3RATQz.js} +3 -3
  59. package/dist/assets/{SetupWorkflowCredentialsButton-DCfwCYAd.js → SetupWorkflowCredentialsButton-BQ2_-L-1.js} +1 -1
  60. package/dist/assets/{SetupWorkflowFromTemplateView-k_iBV2jh.js → SetupWorkflowFromTemplateView-D_E17TKc.js} +3 -3
  61. package/dist/assets/{SigninView-BnsteSQ9.js → SigninView-d0aJ1Mkg.js} +3 -3
  62. package/dist/assets/{SignoutView-CyCh9bOx.js → SignoutView-CvyFrh7y.js} +1 -1
  63. package/dist/assets/{SignupView-BsFwHPbF.js → SignupView-CnlD_UrJ.js} +3 -3
  64. package/dist/assets/{TemplateDetails-D_qS2oXP.js → TemplateDetails-DRuh9UqO.js} +3 -3
  65. package/dist/assets/{TemplateList-Bsr77oun.js → TemplateList-gpWBWX3r.js} +1 -1
  66. package/dist/assets/{TemplatesCollectionView-DOx2xwGE.js → TemplatesCollectionView-Y6-pxrOD.js} +5 -5
  67. package/dist/assets/{TemplatesSearchView-C6YmB2wy.js → TemplatesSearchView-DP8XRZ62.js} +3 -3
  68. package/dist/assets/{TemplatesView-DQBwrteM.js → TemplatesView-B3vanV3h.js} +1 -1
  69. package/dist/assets/{TemplatesWorkflowView-C2iuRHel.js → TemplatesWorkflowView-CIB9qsVC.js} +5 -5
  70. package/dist/assets/{TestDefinitionEditView-JONL00pA.css → TestDefinitionEditView-BXhOuJrU.css} +128 -116
  71. package/dist/assets/{TestDefinitionEditView-BhFe0nl4.js → TestDefinitionEditView-BkhmS3l4.js} +243 -252
  72. package/dist/assets/{TestDefinitionListView-xb_7O8DU.js → TestDefinitionListView-tvjwd9Ts.js} +1 -1
  73. package/dist/assets/{TestDefinitionNewView-DfTA2Tx8.js → TestDefinitionNewView-DOGHwct6.js} +13 -4
  74. package/dist/assets/{TestDefinitionRootView-CaoWSLan.js → TestDefinitionRootView-B-QvwldV.js} +1 -1
  75. package/dist/assets/{VariablesView-CbTLdNwU.css → VariablesView-ATWfdJsE.css} +7 -11
  76. package/dist/assets/{VariablesView-B2ttHbBo.js → VariablesView-CoBnz2nF.js} +6 -6
  77. package/dist/assets/{WorkerView-CzDTwlX2.js → WorkerView-CsTZzlRj.js} +7 -7
  78. package/dist/assets/{WorkflowActivator-mNogYc60.js → WorkflowActivator-DeLhupjy.js} +2 -2
  79. package/dist/assets/{WorkflowExecutionsInfoAccordion-CNoXKDkU.js → WorkflowExecutionsInfoAccordion-WRdvo2wq.js} +1 -1
  80. package/dist/assets/{WorkflowExecutionsLandingPage-XS-H1Pwn.js → WorkflowExecutionsLandingPage-DP8mgG6I.js} +2 -2
  81. package/dist/assets/{WorkflowExecutionsPreview-BMqpqyNP.js → WorkflowExecutionsPreview-BmG1Fptg.js} +270 -136
  82. package/dist/assets/{WorkflowExecutionsPreview-BDVLuC1z.css → WorkflowExecutionsPreview-CHu6M3Dh.css} +70 -38
  83. package/dist/assets/{WorkflowExecutionsView-BLj64NZs.js → WorkflowExecutionsView-DmN-exp3.js} +6 -7
  84. package/dist/assets/{WorkflowHistory-CFqqM71F.js → WorkflowHistory-CdEr7dbB.js} +3 -3
  85. package/dist/assets/{WorkflowOnboardingView-8o-XsXJA.js → WorkflowOnboardingView-D45YjFmk.js} +1 -1
  86. package/dist/assets/{WorkflowPreview-B05e6atY.js → WorkflowPreview-x0_AdULu.js} +1 -1
  87. package/dist/assets/{WorkflowsView-D6AZEJR8.js → WorkflowsView-BhcJ-MjE.js} +726 -341
  88. package/dist/assets/{WorkflowsView-JN0Hvhvt.css → WorkflowsView-r9qJOUEb.css} +64 -43
  89. package/dist/assets/{easyAiWorkflowUtils-DCq6uUmq.js → easyAiWorkflowUtils-NXaV8dgZ.js} +5 -5
  90. package/dist/assets/{global-link-actions-DhVbzPXz.js → global-link-actions-DgZH3fz2.js} +1 -1
  91. package/dist/assets/{import-curl-CpQ9LTub.js → import-curl-DUv4B2nO.js} +1 -1
  92. package/dist/assets/{index-ntAcmC2q.js → index-CDluwnbb.js} +4962 -3420
  93. package/dist/assets/{index-D534l065.css → index-CgXKy7t-.css} +2783 -2112
  94. package/dist/assets/{index-wbgX3Vnk.js → index-DAyhXitv.js} +1 -1
  95. package/dist/assets/{pickBy-DAl85H93.js → pickBy-D-hOoXP_.js} +1 -1
  96. package/dist/assets/{polyfills-C7eMRNFe.js → polyfills-CLZ4X0Ad.js} +2342 -1944
  97. package/dist/assets/{pushConnection.store-Cs7MLBaJ.js → pushConnection.store-Dl_VgTY2.js} +1 -1
  98. package/dist/assets/{templateActions-C6kwBsE2.js → templateActions-B4AFVixD.js} +1 -1
  99. package/dist/assets/{typescript.worker-DP34mIHW.js → typescript.worker-Bt3bByTc.js} +1158 -695
  100. package/dist/assets/{useBeforeUnload-Cr9E4FVX.js → useBeforeUnload-DS-CCd-3.js} +1 -1
  101. package/dist/assets/{useCanvasMapping-CkNBF2SE.css → useCanvasMapping-CJcAsQmx.css} +585 -585
  102. package/dist/assets/{useCanvasMapping-DwbUSpab.js → useCanvasMapping-DnPGwCm3.js} +10390 -10379
  103. package/dist/assets/{useCanvasOperations-Ch4-PXXM.js → useCanvasOperations-CY1OrN2X.js} +472 -185
  104. package/dist/assets/useClearExecutionButtonVisible-CjX9PqMR.js +23 -0
  105. package/dist/assets/{useExecutionDebugging-WtMBcJA-.js → useExecutionDebugging-BN-lQ24h.js} +1 -1
  106. package/dist/assets/{useExecutionHelpers-DYVB2XNC.js → useExecutionHelpers-wN0DRQB-.js} +1 -1
  107. package/dist/assets/{useImportCurlCommand-B6a2t4kf.js → useImportCurlCommand-DgTeVIgh.js} +13 -20
  108. package/dist/assets/useOverview-BBgWJdVL.js +161 -0
  109. package/dist/assets/{Logo-DJLTXpXC.css → useOverview-DcRuPjLJ.css} +97 -30
  110. package/dist/assets/{usePushConnection-BvuDmDSY.js → usePushConnection-F1s4Muc0.js} +5 -4
  111. package/dist/assets/{useRunWorkflow-BjW-TsKk.js → useRunWorkflow-RBDuKZVj.js} +13 -13
  112. package/dist/assets/{useTestDefinitionForm-uexL_DkW.js → useTestDefinitionForm-DX1gvhBC.js} +1 -1
  113. package/dist/assets/{useWorkflowActivate-BAjo-kUC.js → useWorkflowActivate-DsRC3mvG.js} +1 -1
  114. package/dist/index.html +3 -3
  115. package/package.json +1 -1
  116. package/dist/assets/CollectionParameter-Dk76idMw.js +0 -4
  117. package/dist/assets/ExecutionsView-zqdNLgx1.js +0 -983
  118. package/dist/assets/ProjectCreateResource-5lC9x1Ht.js +0 -56
  119. package/dist/assets/ProjectCreateResource-eYdTamXR.css +0 -139
  120. package/dist/assets/open-sans-latin-400-normal-kLvSbl7y.woff +0 -0
  121. package/dist/assets/open-sans-latin-400-normal-sjvN8RAh.woff2 +0 -0
  122. package/dist/assets/open-sans-latin-600-normal-BYc6TgXR.woff2 +0 -0
  123. package/dist/assets/open-sans-latin-600-normal-CJ2UE_uF.woff +0 -0
  124. package/dist/assets/open-sans-latin-700-normal-DMXgkrz3.woff +0 -0
  125. package/dist/assets/open-sans-latin-700-normal-DXyImmHa.woff2 +0 -0
  126. package/dist/assets/usePinnedData-CvnROquX.js +0 -274
@@ -1,44 +1,10 @@
1
- import { aX as inject, aY as isRef, c as openBlock, h as createElementBlock, j as createBaseVNode, d as defineComponent, q as computed, i as createVNode, l as unref, t as toDisplayString, J as withModifiers, e as createBlock, f as createCommentVNode, _ as _export_sfc, aZ as toRefs, r as ref, o as onMounted, v as renderSlot, a_ as normalizeProps, a$ as guardReactiveProps, b0 as mergeProps, b1 as resolveDynamicComponent, b2 as VueMarkdown, F as Fragment, B as renderList, n as normalizeClass, b3 as markdownLink, b4 as useFileDialog, b5 as onUnmounted, ax as withDirectives, b6 as vModelText, H as withKeys, C as normalizeStyle, w as withCtx, I as watch, m as resolveComponent, k as createTextVNode, b7 as useClipboard, a as useToast, aT as createSlots, g as useI18n$1, af as MODAL_CONFIRM, al as useMessage, b8 as CHAT_TRIGGER_NODE_TYPE, b9 as MANUAL_CHAT_TRIGGER_NODE_TYPE, ba as CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE, bb as AI_SUBCATEGORY, bc as AI_CATEGORY_AGENTS, bd as AI_CATEGORY_CHAINS, be as AI_CODE_NODE_TYPE, bf as getNodeInputs, bg as getConnectionTypes, bh as getNodeOutputs, bi as NodeConnectionType, bj as isEmpty, bk as get, bl as v4, bm as last, bn as CHAT_TRIGGER_NODE_TYPE$1, aJ as useStorage, bo as watchEffect, y as onBeforeUnmount, K as useDebounce, U as useWorkflowsStore, a0 as useCanvasStore, bp as useNodeTypesStore, bq as useNodeHelpers, b as useRouter, V as VIEWS, br as provide } from "./index-ntAcmC2q.js";
2
- import { H as HighlightJS, R as RunDataAi } from "./RunDataAi-Cq_XIdUj.js";
3
- import { u as usePinnedData } from "./usePinnedData-CvnROquX.js";
4
- import { u as useRunWorkflow } from "./useRunWorkflow-BjW-TsKk.js";
5
- import "./useExecutionHelpers-DYVB2XNC.js";
6
- import "./pushConnection.store-Cs7MLBaJ.js";
7
- const ChatSymbol = "Chat";
8
- const ChatOptionsSymbol = "ChatOptions";
9
- function createEventBus() {
10
- const handlers = /* @__PURE__ */ new Map();
11
- function off(eventName, fn) {
12
- const eventFns = handlers.get(eventName);
13
- if (eventFns) {
14
- eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
15
- }
16
- }
17
- function on(eventName, fn) {
18
- let eventFns = handlers.get(eventName);
19
- if (!eventFns) {
20
- eventFns = [fn];
21
- } else {
22
- eventFns.push(fn);
23
- }
24
- handlers.set(eventName, eventFns);
25
- return () => off(eventName, fn);
26
- }
27
- function emit(eventName, event) {
28
- const eventFns = handlers.get(eventName);
29
- if (eventFns) {
30
- eventFns.slice().forEach(async (handler) => {
31
- await handler(event);
32
- });
33
- }
34
- }
35
- return {
36
- on,
37
- off,
38
- emit
39
- };
40
- }
41
- const chatEventBus = createEventBus();
1
+ import { aY as inject, aZ as isRef, i as createElementBlock, g as openBlock, k as createBaseVNode, d as defineComponent, q as computed, j as createVNode, e as createBlock, f as createCommentVNode, m as unref, t as toDisplayString, J as withModifiers, _ as _export_sfc, a_ as toRefs, r as ref, o as onMounted, n as normalizeClass, x as renderSlot, a$ as normalizeProps, b0 as guardReactiveProps, b1 as resolveDynamicComponent, b2 as mergeProps, b3 as VueMarkdown, F as Fragment, D as renderList, b4 as markdownLink, b5 as useFileDialog, b6 as onUnmounted, B as normalizeStyle, aB as withDirectives, b7 as vModelText, H as withKeys, w as withCtx, I as watch, h as resolveComponent, l as createTextVNode, b8 as useClipboard, a as useToast, c as useI18n$1, aR as N8nTooltip, b9 as N8nButton, aT as _sfc_main$e, aV as createSlots, aK as useStorage, ba as watchEffect, y as onBeforeUnmount, K as useDebounce, bb as provide, bc as useProvideTooltipAppendTo, bd as IsInPiPWindowSymbol, be as NodeConnectionTypes, bf as get, bg as last, bh as isEmpty, aj as useMessage, ak as MODAL_CONFIRM, bi as v4, bj as MANUAL_CHAT_TRIGGER_NODE_TYPE, bk as CHAT_TRIGGER_NODE_TYPE, bl as CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE, bm as AI_SUBCATEGORY, bn as AI_CATEGORY_AGENTS, bo as AI_CATEGORY_CHAINS, bp as AI_CODE_NODE_TYPE, bq as getNodeInputs, br as getConnectionTypes, bs as getNodeOutputs, bt as CHAT_TRIGGER_NODE_TYPE$1, T as useWorkflowsStore, bu as useNodeTypesStore, a1 as useCanvasStore, b as useRouter, bv as useNodeHelpers, V as VIEWS, bw as useTemplateRef, bx as N8nResizeWrapper, ah as useTelemetry, by as N8nText, bz as useStyles, p as useSettingsStore } from "./index-CDluwnbb.js";
2
+ import { H as HighlightJS, R as RunDataAi } from "./RunDataAi-dhPBStdr.js";
3
+ import { u as usePinnedData } from "./useCanvasOperations-CY1OrN2X.js";
4
+ import { u as useRunWorkflow } from "./useRunWorkflow-RBDuKZVj.js";
5
+ import { u as useClearExecutionButtonVisible } from "./useClearExecutionButtonVisible-CjX9PqMR.js";
6
+ import "./useExecutionHelpers-wN0DRQB-.js";
7
+ import "./pushConnection.store-Dl_VgTY2.js";
42
8
  function bash(hljs) {
43
9
  const regex = hljs.regex;
44
10
  const VAR = {};
@@ -2528,6 +2494,8 @@ function xml(hljs) {
2528
2494
  ]
2529
2495
  };
2530
2496
  }
2497
+ const ChatSymbol = "Chat";
2498
+ const ChatOptionsSymbol = "ChatOptions";
2531
2499
  function useChat() {
2532
2500
  return inject(ChatSymbol);
2533
2501
  }
@@ -2637,7 +2605,7 @@ function render$2(_ctx, _cache) {
2637
2605
  }
2638
2606
  const IconPreview = { name: "mdi-openInNew", render: render$2 };
2639
2607
  const _hoisted_1$7 = { class: "chat-file-name" };
2640
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2608
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2641
2609
  __name: "ChatFile",
2642
2610
  props: {
2643
2611
  file: {},
@@ -2687,16 +2655,16 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2687
2655
  };
2688
2656
  }
2689
2657
  });
2690
- const ChatFile = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-70b9370d"]]);
2658
+ const ChatFile = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-70b9370d"]]);
2691
2659
  const _hoisted_1$6 = {
2692
2660
  key: 0,
2693
2661
  class: "chat-message-actions"
2694
2662
  };
2695
- const _hoisted_2$2 = {
2663
+ const _hoisted_2$3 = {
2696
2664
  key: 2,
2697
2665
  class: "chat-message-files"
2698
2666
  };
2699
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2667
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2700
2668
  __name: "Message",
2701
2669
  props: {
2702
2670
  message: {}
@@ -2785,7 +2753,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2785
2753
  options: markdownOptions,
2786
2754
  plugins: [linksNewTabPlugin]
2787
2755
  }, null, 8, ["source", "plugins"])),
2788
- (unref(message).files ?? []).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
2756
+ (unref(message).files ?? []).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
2789
2757
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(message).files ?? [], (file) => {
2790
2758
  return openBlock(), createElementBlock("div", {
2791
2759
  key: file.name,
@@ -2832,12 +2800,45 @@ function render(_ctx, _cache) {
2832
2800
  ]));
2833
2801
  }
2834
2802
  const IconSend = { name: "mdi-send", render };
2803
+ function createEventBus() {
2804
+ const handlers = /* @__PURE__ */ new Map();
2805
+ function off(eventName, fn) {
2806
+ const eventFns = handlers.get(eventName);
2807
+ if (eventFns) {
2808
+ eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
2809
+ }
2810
+ }
2811
+ function on(eventName, fn) {
2812
+ let eventFns = handlers.get(eventName);
2813
+ if (!eventFns) {
2814
+ eventFns = [fn];
2815
+ } else {
2816
+ eventFns.push(fn);
2817
+ }
2818
+ handlers.set(eventName, eventFns);
2819
+ return () => off(eventName, fn);
2820
+ }
2821
+ function emit(eventName, event) {
2822
+ const eventFns = handlers.get(eventName);
2823
+ if (eventFns) {
2824
+ eventFns.slice().forEach(async (handler) => {
2825
+ await handler(event);
2826
+ });
2827
+ }
2828
+ }
2829
+ return {
2830
+ on,
2831
+ off,
2832
+ emit
2833
+ };
2834
+ }
2835
+ const chatEventBus = createEventBus();
2835
2836
  const _hoisted_1$3 = { class: "chat-inputs" };
2836
- const _hoisted_2$1 = {
2837
+ const _hoisted_2$2 = {
2837
2838
  key: 0,
2838
2839
  class: "chat-input-left-panel"
2839
2840
  };
2840
- const _hoisted_3 = ["disabled", "placeholder"];
2841
+ const _hoisted_3$1 = ["disabled", "placeholder"];
2841
2842
  const _hoisted_4 = { class: "chat-inputs-controls" };
2842
2843
  const _hoisted_5 = ["disabled"];
2843
2844
  const _hoisted_6 = ["disabled"];
@@ -2845,7 +2846,7 @@ const _hoisted_7 = {
2845
2846
  key: 0,
2846
2847
  class: "chat-files"
2847
2848
  };
2848
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2849
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2849
2850
  __name: "Input",
2850
2851
  props: {
2851
2852
  placeholder: { default: "inputPlaceholder" }
@@ -2993,7 +2994,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2993
2994
  onKeydown: withModifiers(onKeyDown, ["stop"])
2994
2995
  }, [
2995
2996
  createBaseVNode("div", _hoisted_1$3, [
2996
- _ctx.$slots.leftPanel ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
2997
+ _ctx.$slots.leftPanel ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
2997
2998
  renderSlot(_ctx.$slots, "leftPanel", {}, void 0, true)
2998
2999
  ])) : createCommentVNode("", true),
2999
3000
  withDirectives(createBaseVNode("textarea", {
@@ -3007,7 +3008,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3007
3008
  onInput: adjustHeight,
3008
3009
  onMousedown: adjustHeight,
3009
3010
  onFocus: adjustHeight
3010
- }, null, 40, _hoisted_3), [
3011
+ }, null, 40, _hoisted_3$1), [
3011
3012
  [vModelText, input.value]
3012
3013
  ]),
3013
3014
  createBaseVNode("div", _hoisted_4, [
@@ -3050,8 +3051,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3050
3051
  };
3051
3052
  }
3052
3053
  });
3053
- const ChatInput = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-9f775274"]]);
3054
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3054
+ const ChatInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-9f775274"]]);
3055
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3055
3056
  __name: "MessageTyping",
3056
3057
  props: {
3057
3058
  animation: { default: "bouncing" }
@@ -3076,7 +3077,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3076
3077
  messageContainer.value?.scrollToView();
3077
3078
  });
3078
3079
  return (_ctx, _cache) => {
3079
- return openBlock(), createBlock(unref(_sfc_main$8), {
3080
+ return openBlock(), createBlock(unref(_sfc_main$c), {
3080
3081
  ref_key: "messageContainer",
3081
3082
  ref: messageContainer,
3082
3083
  class: normalizeClass(classes.value),
@@ -3095,11 +3096,20 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3095
3096
  };
3096
3097
  }
3097
3098
  });
3098
- const _hoisted_1$2 = { class: "chat-messages-list" };
3099
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3099
+ const _hoisted_1$2 = {
3100
+ key: 0,
3101
+ class: "empty-container"
3102
+ };
3103
+ const _hoisted_2$1 = { class: "empty" };
3104
+ const _hoisted_3 = {
3105
+ key: 1,
3106
+ class: "chat-messages-list"
3107
+ };
3108
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3100
3109
  __name: "MessagesList",
3101
3110
  props: {
3102
- messages: {}
3111
+ messages: {},
3112
+ emptyText: {}
3103
3113
  },
3104
3114
  setup(__props) {
3105
3115
  const chatStore = useChat();
@@ -3115,15 +3125,35 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3115
3125
  }
3116
3126
  );
3117
3127
  return (_ctx, _cache) => {
3118
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
3128
+ const _component_N8nIcon = resolveComponent("N8nIcon");
3129
+ const _component_N8nText = resolveComponent("N8nText");
3130
+ return _ctx.emptyText && unref(initialMessages).length === 0 && _ctx.messages.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
3131
+ createBaseVNode("div", _hoisted_2$1, [
3132
+ createVNode(_component_N8nIcon, {
3133
+ icon: "comment",
3134
+ size: "large",
3135
+ class: "emptyIcon"
3136
+ }),
3137
+ createVNode(_component_N8nText, {
3138
+ tag: "p",
3139
+ size: "medium",
3140
+ color: "text-base"
3141
+ }, {
3142
+ default: withCtx(() => [
3143
+ createTextVNode(toDisplayString(_ctx.emptyText), 1)
3144
+ ]),
3145
+ _: 1
3146
+ })
3147
+ ])
3148
+ ])) : (openBlock(), createElementBlock("div", _hoisted_3, [
3119
3149
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(initialMessages), (initialMessage) => {
3120
- return openBlock(), createBlock(_sfc_main$8, {
3150
+ return openBlock(), createBlock(_sfc_main$c, {
3121
3151
  key: initialMessage.id,
3122
3152
  message: initialMessage
3123
3153
  }, null, 8, ["message"]);
3124
3154
  }), 128)),
3125
3155
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.messages, (message) => {
3126
- return openBlock(), createBlock(_sfc_main$8, {
3156
+ return openBlock(), createBlock(_sfc_main$c, {
3127
3157
  key: message.id,
3128
3158
  ref_for: true,
3129
3159
  ref_key: "messageComponents",
@@ -3136,12 +3166,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3136
3166
  _: 2
3137
3167
  }, 1032, ["message"]);
3138
3168
  }), 128)),
3139
- unref(waitingForResponse) ? (openBlock(), createBlock(_sfc_main$6, { key: 0 })) : createCommentVNode("", true)
3140
- ]);
3169
+ unref(waitingForResponse) ? (openBlock(), createBlock(_sfc_main$a, { key: 0 })) : createCommentVNode("", true)
3170
+ ]));
3141
3171
  };
3142
3172
  }
3143
3173
  });
3144
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3174
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3145
3175
  __name: "MessageOptionTooltip",
3146
3176
  props: {
3147
3177
  placement: {
@@ -3176,17 +3206,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3176
3206
  };
3177
3207
  }
3178
3208
  });
3179
- const container$2 = "_container_pqtqf_123";
3209
+ const container$5 = "_container_pqtqf_123";
3180
3210
  const icon$1 = "_icon_pqtqf_129";
3181
- const style0$4 = {
3182
- container: container$2,
3211
+ const style0$7 = {
3212
+ container: container$5,
3183
3213
  icon: icon$1
3184
3214
  };
3185
- const cssModules$4 = {
3186
- "$style": style0$4
3215
+ const cssModules$7 = {
3216
+ "$style": style0$7
3187
3217
  };
3188
- const MessageOptionTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__cssModules", cssModules$4]]);
3189
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3218
+ const MessageOptionTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__cssModules", cssModules$7]]);
3219
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3190
3220
  __name: "MessageOptionAction",
3191
3221
  props: {
3192
3222
  label: {
@@ -3227,34 +3257,77 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3227
3257
  };
3228
3258
  }
3229
3259
  });
3230
- const container$1 = "_container_u1r1u_123";
3260
+ const container$4 = "_container_u1r1u_123";
3231
3261
  const icon = "_icon_u1r1u_129";
3232
- const style0$3 = {
3233
- container: container$1,
3262
+ const style0$6 = {
3263
+ container: container$4,
3234
3264
  icon
3235
3265
  };
3236
- const cssModules$3 = {
3237
- "$style": style0$3
3266
+ const cssModules$6 = {
3267
+ "$style": style0$6
3268
+ };
3269
+ const MessageOptionAction = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__cssModules", cssModules$6]]);
3270
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3271
+ __name: "PanelHeader",
3272
+ props: {
3273
+ title: {}
3274
+ },
3275
+ emits: ["click"],
3276
+ setup(__props, { emit: __emit }) {
3277
+ const emit = __emit;
3278
+ return (_ctx, _cache) => {
3279
+ return openBlock(), createElementBlock("header", {
3280
+ class: normalizeClass(_ctx.$style.container),
3281
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("click"))
3282
+ }, [
3283
+ createBaseVNode("span", {
3284
+ class: normalizeClass(_ctx.$style.title)
3285
+ }, toDisplayString(_ctx.title), 3),
3286
+ createBaseVNode("div", {
3287
+ class: normalizeClass(_ctx.$style.actions)
3288
+ }, [
3289
+ renderSlot(_ctx.$slots, "actions")
3290
+ ], 2)
3291
+ ], 2);
3292
+ };
3293
+ }
3294
+ });
3295
+ const container$3 = "_container_oxcgo_123";
3296
+ const title = "_title_oxcgo_145";
3297
+ const actions$1 = "_actions_oxcgo_151";
3298
+ const style0$5 = {
3299
+ container: container$3,
3300
+ title,
3301
+ actions: actions$1
3238
3302
  };
3239
- const MessageOptionAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__cssModules", cssModules$3]]);
3303
+ const cssModules$5 = {
3304
+ "$style": style0$5
3305
+ };
3306
+ const PanelHeader = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__cssModules", cssModules$5]]);
3240
3307
  const _hoisted_1$1 = ["onClick"];
3241
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3308
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3242
3309
  __name: "ChatMessagesPanel",
3243
3310
  props: {
3244
3311
  pastChatMessages: {},
3245
3312
  messages: {},
3246
3313
  sessionId: {},
3247
- showCloseButton: { type: Boolean }
3314
+ showCloseButton: { type: Boolean },
3315
+ isOpen: { type: Boolean, default: true },
3316
+ isNewLogsEnabled: { type: Boolean, default: false }
3248
3317
  },
3249
- emits: ["displayExecution", "sendMessage", "refreshSession", "close"],
3318
+ emits: ["displayExecution", "sendMessage", "refreshSession", "close", "clickHeader"],
3250
3319
  setup(__props, { emit: __emit }) {
3251
3320
  const props = __props;
3252
3321
  const emit = __emit;
3253
- const messageComposable = useMessage();
3254
3322
  const clipboard = useClipboard();
3255
3323
  const locale = useI18n$1();
3256
3324
  const toast = useToast();
3257
3325
  const previousMessageIndex = ref(0);
3326
+ const sessionIdText = computed(
3327
+ () => locale.baseText("chat.window.session.id", {
3328
+ interpolate: { id: `${props.sessionId.slice(0, 5)}...` }
3329
+ })
3330
+ );
3258
3331
  const inputPlaceholder = computed(() => {
3259
3332
  if (props.messages.length > 0) {
3260
3333
  return locale.baseText("chat.window.chat.placeholder");
@@ -3274,23 +3347,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3274
3347
  previousMessageIndex.value = 0;
3275
3348
  emit("sendMessage", message);
3276
3349
  }
3277
- async function onRefreshSession() {
3278
- if (props.messages.length === 0) {
3279
- emit("refreshSession");
3280
- return;
3281
- }
3282
- const confirmResult = await messageComposable.confirm(
3283
- locale.baseText("chat.window.session.reset.warning"),
3284
- {
3285
- title: locale.baseText("chat.window.session.reset.title"),
3286
- type: "warning",
3287
- confirmButtonText: locale.baseText("chat.window.session.reset.confirm"),
3288
- showClose: true
3289
- }
3290
- );
3291
- if (confirmResult === MODAL_CONFIRM) {
3292
- emit("refreshSession");
3293
- }
3350
+ function onRefreshSession() {
3351
+ emit("refreshSession");
3294
3352
  }
3295
3353
  function onArrowKeyDown({ currentInputValue, key }) {
3296
3354
  const pastMessages = props.pastChatMessages;
@@ -3319,8 +3377,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3319
3377
  previousMessageIndex.value = 0;
3320
3378
  }
3321
3379
  }
3322
- function copySessionId() {
3323
- void clipboard.copy(props.sessionId);
3380
+ async function copySessionId() {
3381
+ await clipboard.copy(props.sessionId);
3324
3382
  toast.showMessage({
3325
3383
  title: locale.baseText("generic.copiedToClipboard"),
3326
3384
  message: "",
@@ -3328,14 +3386,60 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3328
3386
  });
3329
3387
  }
3330
3388
  return (_ctx, _cache) => {
3331
- const _component_n8n_tooltip = resolveComponent("n8n-tooltip");
3332
- const _component_n8n_icon_button = resolveComponent("n8n-icon-button");
3333
- const _component_n8n_button = resolveComponent("n8n-button");
3334
3389
  return openBlock(), createElementBlock("div", {
3335
3390
  class: normalizeClass(_ctx.$style.chat),
3336
3391
  "data-test-id": "workflow-lm-chat-dialog"
3337
3392
  }, [
3338
- createBaseVNode("header", {
3393
+ _ctx.isNewLogsEnabled ? (openBlock(), createBlock(PanelHeader, {
3394
+ key: 0,
3395
+ title: unref(locale).baseText("chat.window.title"),
3396
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("clickHeader"))
3397
+ }, {
3398
+ actions: withCtx(() => [
3399
+ unref(clipboard).isSupported.value ? (openBlock(), createBlock(unref(N8nTooltip), { key: 0 }, {
3400
+ content: withCtx(() => [
3401
+ createTextVNode(toDisplayString(_ctx.sessionId) + " ", 1),
3402
+ _cache[5] || (_cache[5] = createBaseVNode("br", null, null, -1)),
3403
+ createTextVNode(" " + toDisplayString(unref(locale).baseText("chat.window.session.id.copy")), 1)
3404
+ ]),
3405
+ default: withCtx(() => [
3406
+ createVNode(unref(N8nButton), {
3407
+ "data-test-id": "chat-session-id",
3408
+ type: "secondary",
3409
+ size: "mini",
3410
+ onClick: withModifiers(copySessionId, ["stop"])
3411
+ }, {
3412
+ default: withCtx(() => [
3413
+ createTextVNode(toDisplayString(sessionIdText.value), 1)
3414
+ ]),
3415
+ _: 1
3416
+ })
3417
+ ]),
3418
+ _: 1
3419
+ })) : createCommentVNode("", true),
3420
+ _ctx.messages.length > 0 ? (openBlock(), createBlock(unref(N8nTooltip), {
3421
+ key: 1,
3422
+ content: unref(locale).baseText("chat.window.session.resetSession")
3423
+ }, {
3424
+ default: withCtx(() => [
3425
+ createVNode(unref(_sfc_main$e), {
3426
+ class: normalizeClass(_ctx.$style.headerButton),
3427
+ "data-test-id": "refresh-session-button",
3428
+ outline: "",
3429
+ type: "secondary",
3430
+ size: "small",
3431
+ "icon-size": "medium",
3432
+ icon: "undo",
3433
+ title: unref(locale).baseText("chat.window.session.reset"),
3434
+ onClick: withModifiers(onRefreshSession, ["stop"])
3435
+ }, null, 8, ["class", "title"])
3436
+ ]),
3437
+ _: 1
3438
+ }, 8, ["content"])) : createCommentVNode("", true)
3439
+ ]),
3440
+ _: 1
3441
+ }, 8, ["title"])) : (openBlock(), createElementBlock("header", {
3442
+ key: 1,
3339
3443
  class: normalizeClass(_ctx.$style.chatHeader)
3340
3444
  }, [
3341
3445
  createBaseVNode("span", {
@@ -3345,46 +3449,48 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3345
3449
  class: normalizeClass(_ctx.$style.session)
3346
3450
  }, [
3347
3451
  createBaseVNode("span", null, toDisplayString(unref(locale).baseText("chat.window.session.title")), 1),
3348
- createVNode(_component_n8n_tooltip, { placement: "left" }, {
3452
+ createVNode(unref(N8nTooltip), { placement: "left" }, {
3349
3453
  content: withCtx(() => [
3350
3454
  createTextVNode(toDisplayString(_ctx.sessionId), 1)
3351
3455
  ]),
3352
3456
  default: withCtx(() => [
3353
3457
  createBaseVNode("span", {
3354
- class: normalizeClass(_ctx.$style.sessionId),
3458
+ class: normalizeClass([_ctx.$style.sessionId, unref(clipboard).isSupported.value ? _ctx.$style.copyable : ""]),
3355
3459
  "data-test-id": "chat-session-id",
3356
- onClick: copySessionId
3460
+ onClick: _cache[1] || (_cache[1] = ($event) => unref(clipboard).isSupported.value ? copySessionId() : null)
3357
3461
  }, toDisplayString(_ctx.sessionId), 3)
3358
3462
  ]),
3359
3463
  _: 1
3360
3464
  }),
3361
- createVNode(_component_n8n_icon_button, {
3465
+ createVNode(unref(_sfc_main$e), {
3362
3466
  class: normalizeClass(_ctx.$style.headerButton),
3363
3467
  "data-test-id": "refresh-session-button",
3364
3468
  outline: "",
3365
3469
  type: "secondary",
3366
3470
  size: "mini",
3367
3471
  icon: "undo",
3368
- title: unref(locale).baseText("chat.window.session.reset.confirm"),
3472
+ title: unref(locale).baseText("chat.window.session.reset"),
3369
3473
  onClick: onRefreshSession
3370
3474
  }, null, 8, ["class", "title"]),
3371
- _ctx.showCloseButton ? (openBlock(), createBlock(_component_n8n_icon_button, {
3475
+ _ctx.showCloseButton ? (openBlock(), createBlock(unref(_sfc_main$e), {
3372
3476
  key: 0,
3373
3477
  class: normalizeClass(_ctx.$style.headerButton),
3374
3478
  outline: "",
3375
3479
  type: "secondary",
3376
3480
  size: "mini",
3377
3481
  icon: "times",
3378
- onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
3482
+ onClick: _cache[2] || (_cache[2] = ($event) => emit("close"))
3379
3483
  }, null, 8, ["class"])) : createCommentVNode("", true)
3380
3484
  ], 2)
3381
- ], 2),
3382
- createBaseVNode("main", {
3485
+ ], 2)),
3486
+ _ctx.isOpen ? (openBlock(), createElementBlock("main", {
3487
+ key: 2,
3383
3488
  class: normalizeClass(_ctx.$style.chatBody)
3384
3489
  }, [
3385
- createVNode(_sfc_main$5, {
3490
+ createVNode(_sfc_main$9, {
3386
3491
  messages: _ctx.messages,
3387
- class: normalizeClass(_ctx.$style.messages)
3492
+ class: normalizeClass(_ctx.$style.messages),
3493
+ "empty-text": _ctx.isNewLogsEnabled ? unref(locale).baseText("chat.window.chat.emptyChatMessage.v2") : void 0
3388
3494
  }, {
3389
3495
  beforeMessage: withCtx(({ message }) => [
3390
3496
  message.sender === "bot" && !message.id.includes("preload") ? (openBlock(), createBlock(MessageOptionTooltip, {
@@ -3419,9 +3525,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3419
3525
  }, null, 8, ["label", "onClick"])) : createCommentVNode("", true)
3420
3526
  ]),
3421
3527
  _: 1
3422
- }, 8, ["messages", "class"])
3423
- ], 2),
3424
- createBaseVNode("div", {
3528
+ }, 8, ["messages", "class", "empty-text"])
3529
+ ], 2)) : createCommentVNode("", true),
3530
+ _ctx.isOpen ? (openBlock(), createElementBlock("div", {
3531
+ key: 3,
3425
3532
  class: normalizeClass(_ctx.$style.messagesInput)
3426
3533
  }, [
3427
3534
  createVNode(ChatInput, {
@@ -3435,71 +3542,70 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3435
3542
  createBaseVNode("div", {
3436
3543
  class: normalizeClass(_ctx.$style.messagesHistory)
3437
3544
  }, [
3438
- createVNode(_component_n8n_button, {
3545
+ createVNode(unref(N8nButton), {
3439
3546
  title: "Navigate to previous message",
3440
3547
  icon: "chevron-up",
3441
3548
  type: "tertiary",
3442
3549
  text: "",
3443
3550
  size: "mini",
3444
- onClick: _cache[1] || (_cache[1] = ($event) => onArrowKeyDown({ currentInputValue: "", key: "ArrowUp" }))
3551
+ onClick: _cache[3] || (_cache[3] = ($event) => onArrowKeyDown({ currentInputValue: "", key: "ArrowUp" }))
3445
3552
  }),
3446
- createVNode(_component_n8n_button, {
3553
+ createVNode(unref(N8nButton), {
3447
3554
  title: "Navigate to next message",
3448
3555
  icon: "chevron-down",
3449
3556
  type: "tertiary",
3450
3557
  text: "",
3451
3558
  size: "mini",
3452
- onClick: _cache[2] || (_cache[2] = ($event) => onArrowKeyDown({ currentInputValue: "", key: "ArrowDown" }))
3559
+ onClick: _cache[4] || (_cache[4] = ($event) => onArrowKeyDown({ currentInputValue: "", key: "ArrowDown" }))
3453
3560
  })
3454
3561
  ], 2)
3455
3562
  ]),
3456
3563
  key: "0"
3457
3564
  } : void 0
3458
3565
  ]), 1032, ["placeholder"])
3459
- ], 2)
3566
+ ], 2)) : createCommentVNode("", true)
3460
3567
  ], 2);
3461
3568
  };
3462
3569
  }
3463
3570
  });
3464
- const chat$1 = "_chat_16ciy_123";
3465
- const chatHeader = "_chatHeader_16ciy_148";
3466
- const chatTitle = "_chatTitle_16ciy_161";
3467
- const session = "_session_16ciy_165";
3468
- const sessionId = "_sessionId_16ciy_173";
3469
- const headerButton = "_headerButton_16ciy_181";
3470
- const chatBody = "_chatBody_16ciy_186";
3471
- const messages = "_messages_16ciy_192";
3472
- const messagesInput = "_messagesInput_16ciy_203";
3473
- const style0$2 = {
3474
- chat: chat$1,
3571
+ const chat$2 = "_chat_fs224_123";
3572
+ const chatHeader = "_chatHeader_fs224_148";
3573
+ const chatTitle = "_chatTitle_fs224_161";
3574
+ const session = "_session_fs224_165";
3575
+ const sessionId = "_sessionId_fs224_173";
3576
+ const copyable = "_copyable_fs224_179";
3577
+ const headerButton = "_headerButton_fs224_183";
3578
+ const chatBody = "_chatBody_fs224_188";
3579
+ const messages = "_messages_fs224_197";
3580
+ const messagesInput = "_messagesInput_fs224_208";
3581
+ const style0$4 = {
3582
+ chat: chat$2,
3475
3583
  chatHeader,
3476
3584
  chatTitle,
3477
3585
  session,
3478
3586
  sessionId,
3587
+ copyable,
3479
3588
  headerButton,
3480
3589
  chatBody,
3481
3590
  messages,
3482
3591
  messagesInput
3483
3592
  };
3484
- const cssModules$2 = {
3485
- "$style": style0$2
3593
+ const cssModules$4 = {
3594
+ "$style": style0$4
3486
3595
  };
3487
- const ChatMessagesPanel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__cssModules", cssModules$2]]);
3596
+ const ChatMessagesPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__cssModules", cssModules$4]]);
3488
3597
  const _hoisted_1 = { class: "meta" };
3489
3598
  const _hoisted_2 = { key: 0 };
3490
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3599
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3491
3600
  __name: "ChatLogsPanel",
3492
3601
  props: {
3493
3602
  node: {},
3494
3603
  slim: { type: Boolean },
3495
3604
  workflow: {}
3496
3605
  },
3497
- emits: ["close"],
3498
- setup(__props, { emit: __emit }) {
3499
- const emit = __emit;
3606
+ setup(__props) {
3500
3607
  const locale = useI18n$1();
3501
3608
  return (_ctx, _cache) => {
3502
- const _component_n8n_icon_button = resolveComponent("n8n-icon-button");
3503
3609
  return openBlock(), createElementBlock("div", {
3504
3610
  class: normalizeClass(_ctx.$style.logsWrapper),
3505
3611
  "data-test-id": "lm-chat-logs"
@@ -3511,14 +3617,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3511
3617
  createTextVNode(toDisplayString(unref(locale).baseText("chat.window.logs")) + " ", 1),
3512
3618
  _ctx.node ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref(locale).baseText("chat.window.logsFromNode", { interpolate: { nodeName: _ctx.node.name } })), 1)) : createCommentVNode("", true)
3513
3619
  ]),
3514
- createVNode(_component_n8n_icon_button, {
3515
- class: normalizeClass(_ctx.$style.close),
3516
- outline: "",
3517
- icon: "times",
3518
- type: "secondary",
3519
- size: "mini",
3520
- onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
3521
- }, null, 8, ["class"])
3620
+ createBaseVNode("div", {
3621
+ class: normalizeClass(_ctx.$style.actions)
3622
+ }, [
3623
+ renderSlot(_ctx.$slots, "actions")
3624
+ ], 2)
3522
3625
  ], 2),
3523
3626
  createBaseVNode("div", {
3524
3627
  class: normalizeClass(_ctx.$style.logs)
@@ -3535,89 +3638,175 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3535
3638
  };
3536
3639
  }
3537
3640
  });
3538
- const logsHeader = "_logsHeader_km5h4_123";
3539
- const close = "_close_km5h4_136";
3540
- const logsWrapper = "_logsWrapper_km5h4_143";
3541
- const logsTitle = "_logsTitle_km5h4_152";
3542
- const logs$1 = "_logs_km5h4_123";
3543
- const style0$1 = {
3641
+ const logsHeader = "_logsHeader_1n9n2_123";
3642
+ const logsWrapper = "_logsWrapper_1n9n2_140";
3643
+ const logsTitle = "_logsTitle_1n9n2_149";
3644
+ const logs$1 = "_logs_1n9n2_123";
3645
+ const actions = "_actions_1n9n2_159";
3646
+ const style0$3 = {
3544
3647
  logsHeader,
3545
- close,
3546
3648
  logsWrapper,
3547
3649
  logsTitle,
3548
- logs: logs$1
3650
+ logs: logs$1,
3651
+ actions
3549
3652
  };
3550
- const cssModules$1 = {
3551
- "$style": style0$1
3653
+ const cssModules$3 = {
3654
+ "$style": style0$3
3552
3655
  };
3553
- const ChatLogsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__cssModules", cssModules$1]]);
3554
- function useChatTrigger({
3555
- getNodeByName,
3556
- getNodeType,
3557
- canvasNodes,
3558
- workflow
3559
- }) {
3560
- const chatTriggerName = ref(null);
3561
- const connectedNode = ref(null);
3562
- const chatTriggerNode = computed(
3563
- () => chatTriggerName.value ? getNodeByName(chatTriggerName.value) : null
3564
- );
3565
- const allowFileUploads = computed(() => {
3566
- return chatTriggerNode.value?.parameters?.options?.allowFileUploads === true;
3567
- });
3568
- const allowedFilesMimeTypes = computed(() => {
3569
- return chatTriggerNode.value?.parameters?.options?.allowedFilesMimeTypes?.toString() ?? "";
3656
+ const ChatLogsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__cssModules", cssModules$3]]);
3657
+ const LOCAL_STORAGE_PANEL_HEIGHT = "N8N_CANVAS_CHAT_HEIGHT";
3658
+ const LOCAL_STORAGE_PANEL_WIDTH = "N8N_CANVAS_CHAT_WIDTH";
3659
+ const MAX_WIDTH_PERCENTAGE = 0.8;
3660
+ const MIN_WIDTH_PERCENTAGE = 0.3;
3661
+ const MIN_HEIGHT_PERCENTAGE = 0.3;
3662
+ const MAX_HEIGHT_PERCENTAGE = 0.75;
3663
+ function useResize(container2) {
3664
+ const storage = {
3665
+ height: useStorage(LOCAL_STORAGE_PANEL_HEIGHT),
3666
+ width: useStorage(LOCAL_STORAGE_PANEL_WIDTH)
3667
+ };
3668
+ const dimensions = {
3669
+ container: ref(0),
3670
+ // Container width
3671
+ minHeight: ref(0),
3672
+ maxHeight: ref(0),
3673
+ chat: ref(0),
3674
+ // Chat panel width
3675
+ logs: ref(0),
3676
+ height: ref(0)
3677
+ };
3678
+ const rootStyles = computed(() => ({
3679
+ "--panel-height": `${dimensions.height.value}px`,
3680
+ "--chat-width": `${dimensions.chat.value}px`
3681
+ }));
3682
+ const panelToContainerRatio = computed(() => {
3683
+ const chatRatio = dimensions.chat.value / dimensions.container.value;
3684
+ const containerRatio = dimensions.container.value / window.screen.width;
3685
+ return {
3686
+ chat: chatRatio.toFixed(2),
3687
+ logs: (1 - chatRatio).toFixed(2),
3688
+ container: containerRatio.toFixed(2)
3689
+ };
3570
3690
  });
3571
- function setChatTriggerNode() {
3572
- const triggerNode = unref(canvasNodes).find(
3573
- (node) => [CHAT_TRIGGER_NODE_TYPE, MANUAL_CHAT_TRIGGER_NODE_TYPE].includes(node.type)
3691
+ function onResize(newHeight) {
3692
+ const { minHeight, maxHeight } = dimensions;
3693
+ dimensions.height.value = Math.min(Math.max(newHeight, minHeight.value), maxHeight.value);
3694
+ }
3695
+ function onResizeDebounced(data) {
3696
+ void useDebounce().callDebounced(onResize, { debounceTime: 10, trailing: true }, data.height);
3697
+ }
3698
+ function onResizeChat(width) {
3699
+ const containerWidth = dimensions.container.value;
3700
+ const maxWidth = containerWidth * MAX_WIDTH_PERCENTAGE;
3701
+ const minWidth = containerWidth * MIN_WIDTH_PERCENTAGE;
3702
+ dimensions.chat.value = Math.min(Math.max(width, minWidth), maxWidth);
3703
+ dimensions.logs.value = dimensions.container.value - dimensions.chat.value;
3704
+ }
3705
+ function onResizeChatDebounced(data) {
3706
+ void useDebounce().callDebounced(
3707
+ onResizeChat,
3708
+ { debounceTime: 10, trailing: true },
3709
+ data.width
3574
3710
  );
3575
- if (!triggerNode) {
3576
- return;
3577
- }
3578
- chatTriggerName.value = triggerNode.name;
3579
3711
  }
3580
- function setConnectedNode() {
3581
- const triggerNode = chatTriggerNode.value;
3582
- if (!triggerNode) {
3583
- return;
3584
- }
3585
- const chatChildren = workflow.value.getChildNodes(triggerNode.name);
3586
- const chatRootNode = chatChildren.reverse().map((nodeName) => getNodeByName(nodeName)).filter((n) => n !== null).reverse().find((storeNode) => {
3587
- if (storeNode.type === CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE) return false;
3588
- const nodeType = getNodeType(storeNode.type, storeNode.typeVersion);
3589
- if (!nodeType) return false;
3590
- const isAgent = nodeType.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(AI_CATEGORY_AGENTS);
3591
- const isChain = nodeType.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(AI_CATEGORY_CHAINS);
3592
- let isCustomChainOrAgent = false;
3593
- if (nodeType.name === AI_CODE_NODE_TYPE) {
3594
- const inputs = getNodeInputs(workflow.value, storeNode, nodeType);
3595
- const inputTypes = getConnectionTypes(inputs);
3596
- const outputs = getNodeOutputs(workflow.value, storeNode, nodeType);
3597
- const outputTypes = getConnectionTypes(outputs);
3598
- if (inputTypes.includes(NodeConnectionType.AiLanguageModel) && inputTypes.includes(NodeConnectionType.Main) && outputTypes.includes(NodeConnectionType.Main)) {
3599
- isCustomChainOrAgent = true;
3600
- }
3601
- }
3602
- if (!isAgent && !isChain && !isCustomChainOrAgent) return false;
3603
- const parentNodes = workflow.value.getParentNodes(storeNode.name);
3604
- const isChatChild = parentNodes.some(
3605
- (parentNodeName) => parentNodeName === triggerNode.name
3606
- );
3607
- const result = Boolean(isChatChild && (isAgent || isChain || isCustomChainOrAgent));
3608
- return result;
3609
- });
3610
- connectedNode.value = chatRootNode ?? null;
3712
+ function restorePersistedDimensions() {
3713
+ const persistedHeight = parseInt(storage.height.value ?? "0", 10);
3714
+ const persistedWidth = parseInt(storage.width.value ?? "0", 10);
3715
+ if (persistedHeight) onResize(persistedHeight);
3716
+ if (persistedWidth) onResizeChat(persistedWidth);
3717
+ }
3718
+ function onWindowResize() {
3719
+ if (!container2.value) return;
3720
+ dimensions.container.value = container2.value.getBoundingClientRect().width;
3721
+ onResizeChat(dimensions.chat.value);
3722
+ dimensions.minHeight.value = window.innerHeight * MIN_HEIGHT_PERCENTAGE;
3723
+ dimensions.maxHeight.value = window.innerHeight * MAX_HEIGHT_PERCENTAGE;
3724
+ onResize(dimensions.height.value);
3611
3725
  }
3726
+ watchEffect(() => {
3727
+ const { chat: chat2, height } = dimensions;
3728
+ if (chat2.value > 0) storage.width.value = chat2.value.toString();
3729
+ if (height.value > 0) storage.height.value = height.value.toString();
3730
+ });
3731
+ watchEffect(() => {
3732
+ if (container2.value) {
3733
+ onWindowResize();
3734
+ restorePersistedDimensions();
3735
+ }
3736
+ });
3737
+ onMounted(() => window.addEventListener("resize", onWindowResize));
3738
+ onBeforeUnmount(() => window.removeEventListener("resize", onWindowResize));
3612
3739
  return {
3613
- allowFileUploads,
3614
- allowedFilesMimeTypes,
3615
- chatTriggerNode,
3616
- connectedNode: computed(() => connectedNode.value),
3617
- setChatTriggerNode,
3618
- setConnectedNode
3740
+ height: dimensions.height,
3741
+ chatWidth: dimensions.chat,
3742
+ logsWidth: dimensions.logs,
3743
+ rootStyles,
3744
+ onWindowResize,
3745
+ onResizeDebounced,
3746
+ onResizeChatDebounced,
3747
+ panelToContainerRatio
3619
3748
  };
3620
3749
  }
3750
+ function usePiPWindow({
3751
+ container: container2,
3752
+ content: content2,
3753
+ initialHeight,
3754
+ initialWidth,
3755
+ shouldPopOut,
3756
+ onRequestClose
3757
+ }) {
3758
+ const pipWindow = ref();
3759
+ const isUnmounting = ref(false);
3760
+ const canPopOut = computed(() => !!window.documentPictureInPicture);
3761
+ const isPoppedOut = computed(() => !!pipWindow.value);
3762
+ const tooltipContainer = computed(
3763
+ () => isPoppedOut.value ? content2.value ?? void 0 : void 0
3764
+ );
3765
+ provide(IsInPiPWindowSymbol, isPoppedOut);
3766
+ useProvideTooltipAppendTo(tooltipContainer);
3767
+ async function showPip() {
3768
+ if (!content2.value) {
3769
+ return;
3770
+ }
3771
+ pipWindow.value = pipWindow.value ?? await window.documentPictureInPicture?.requestWindow({
3772
+ width: initialWidth,
3773
+ height: initialHeight,
3774
+ disallowReturnToOpener: true
3775
+ });
3776
+ [...document.styleSheets].forEach((styleSheet) => {
3777
+ try {
3778
+ const cssRules = [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
3779
+ const style = document.createElement("style");
3780
+ style.textContent = cssRules;
3781
+ pipWindow.value?.document.head.appendChild(style);
3782
+ } catch (e) {
3783
+ const link = document.createElement("link");
3784
+ link.rel = "stylesheet";
3785
+ link.type = styleSheet.type;
3786
+ link.media = styleSheet.media;
3787
+ link.href = styleSheet.href;
3788
+ pipWindow.value?.document.head.appendChild(link);
3789
+ }
3790
+ });
3791
+ pipWindow.value?.document.body.append(content2.value);
3792
+ pipWindow.value?.addEventListener("pagehide", () => !isUnmounting.value && onRequestClose());
3793
+ }
3794
+ function hidePiP() {
3795
+ pipWindow.value?.close();
3796
+ pipWindow.value = void 0;
3797
+ if (content2.value) {
3798
+ container2.value?.appendChild(content2.value);
3799
+ }
3800
+ }
3801
+ watch(shouldPopOut, (value) => value ? requestAnimationFrame(showPip) : hidePiP(), {
3802
+ immediate: true
3803
+ });
3804
+ onBeforeUnmount(() => {
3805
+ isUnmounting.value = true;
3806
+ pipWindow.value?.close();
3807
+ });
3808
+ return { canPopOut, isPoppedOut, pipWindow };
3809
+ }
3621
3810
  function useChatMessaging({
3622
3811
  chatTrigger,
3623
3812
  connectedNode,
@@ -3682,7 +3871,7 @@ function useChatMessaging({
3682
3871
  if (triggerNode.type === MANUAL_CHAT_TRIGGER_NODE_TYPE && triggerNode.typeVersion < 1.1) {
3683
3872
  inputKey = "input";
3684
3873
  }
3685
- if (triggerNode.type === CHAT_TRIGGER_NODE_TYPE$1) {
3874
+ if (triggerNode.type === CHAT_TRIGGER_NODE_TYPE) {
3686
3875
  inputKey = "chatInput";
3687
3876
  }
3688
3877
  const inputPayload = {
@@ -3788,12 +3977,14 @@ function useChatMessaging({
3788
3977
  }
3789
3978
  function getChatMessages() {
3790
3979
  if (!connectedNode.value) return [];
3791
- const connectedMemoryInputs = workflow.value.connectionsByDestinationNode?.[connectedNode.value.name]?.[NodeConnectionType.AiMemory];
3980
+ const connectedMemoryInputs = workflow.value.connectionsByDestinationNode?.[connectedNode.value.name]?.[NodeConnectionTypes.AiMemory];
3792
3981
  if (!connectedMemoryInputs) return [];
3793
3982
  const memoryConnection = (connectedMemoryInputs ?? []).find((i) => (i ?? []).length > 0)?.[0];
3794
3983
  if (!memoryConnection) return [];
3795
3984
  const nodeResultData = getWorkflowResultDataByNodeName(memoryConnection.node);
3796
- const memoryOutputData = (nodeResultData ?? []).map((data) => get(data, ["data", NodeConnectionType.AiMemory, 0, 0, "json"])).find((data) => data && data.action === "saveContext");
3985
+ const memoryOutputData = (nodeResultData ?? []).map(
3986
+ (data) => get(data, ["data", NodeConnectionTypes.AiMemory, 0, 0, "json"])
3987
+ ).find((data) => data && data.action === "saveContext");
3797
3988
  return (memoryOutputData?.chatHistory ?? []).map((message, index) => {
3798
3989
  return {
3799
3990
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -3811,151 +4002,245 @@ function useChatMessaging({
3811
4002
  getChatMessages
3812
4003
  };
3813
4004
  }
3814
- const LOCAL_STORAGE_PANEL_HEIGHT = "N8N_CANVAS_CHAT_HEIGHT";
3815
- const LOCAL_STORAGE_PANEL_WIDTH = "N8N_CANVAS_CHAT_WIDTH";
3816
- const MAX_WIDTH_PERCENTAGE = 0.8;
3817
- const MIN_WIDTH_PERCENTAGE = 0.3;
3818
- const MIN_HEIGHT_PERCENTAGE = 0.3;
3819
- const MAX_HEIGHT_PERCENTAGE = 0.75;
3820
- function useResize(container2) {
3821
- const storage = {
3822
- height: useStorage(LOCAL_STORAGE_PANEL_HEIGHT),
3823
- width: useStorage(LOCAL_STORAGE_PANEL_WIDTH)
3824
- };
3825
- const dimensions = {
3826
- container: ref(0),
3827
- // Container width
3828
- minHeight: ref(0),
3829
- maxHeight: ref(0),
3830
- chat: ref(0),
3831
- // Chat panel width
3832
- logs: ref(0),
3833
- height: ref(0)
3834
- };
3835
- const rootStyles = computed(() => ({
3836
- "--panel-height": `${dimensions.height.value}px`,
3837
- "--chat-width": `${dimensions.chat.value}px`
3838
- }));
3839
- const panelToContainerRatio = computed(() => {
3840
- const chatRatio = dimensions.chat.value / dimensions.container.value;
3841
- const containerRatio = dimensions.container.value / window.screen.width;
3842
- return {
3843
- chat: chatRatio.toFixed(2),
3844
- logs: (1 - chatRatio).toFixed(2),
3845
- container: containerRatio.toFixed(2)
3846
- };
4005
+ function useChatTrigger({
4006
+ getNodeByName,
4007
+ getNodeType,
4008
+ canvasNodes,
4009
+ workflow
4010
+ }) {
4011
+ const chatTriggerName = ref(null);
4012
+ const connectedNode = ref(null);
4013
+ const chatTriggerNode = computed(
4014
+ () => chatTriggerName.value ? getNodeByName(chatTriggerName.value) : null
4015
+ );
4016
+ const allowFileUploads = computed(() => {
4017
+ return chatTriggerNode.value?.parameters?.options?.allowFileUploads === true;
3847
4018
  });
3848
- function onResize(newHeight) {
3849
- const { minHeight, maxHeight } = dimensions;
3850
- dimensions.height.value = Math.min(Math.max(newHeight, minHeight.value), maxHeight.value);
3851
- }
3852
- function onResizeDebounced(data) {
3853
- void useDebounce().callDebounced(onResize, { debounceTime: 10, trailing: true }, data.height);
3854
- }
3855
- function onResizeChat(width) {
3856
- const containerWidth = dimensions.container.value;
3857
- const maxWidth = containerWidth * MAX_WIDTH_PERCENTAGE;
3858
- const minWidth = containerWidth * MIN_WIDTH_PERCENTAGE;
3859
- dimensions.chat.value = Math.min(Math.max(width, minWidth), maxWidth);
3860
- dimensions.logs.value = dimensions.container.value - dimensions.chat.value;
3861
- }
3862
- function onResizeChatDebounced(data) {
3863
- void useDebounce().callDebounced(
3864
- onResizeChat,
3865
- { debounceTime: 10, trailing: true },
3866
- data.width
4019
+ const allowedFilesMimeTypes = computed(() => {
4020
+ return chatTriggerNode.value?.parameters?.options?.allowedFilesMimeTypes?.toString() ?? "";
4021
+ });
4022
+ function setChatTriggerNode() {
4023
+ const triggerNode = unref(canvasNodes).find(
4024
+ (node) => [CHAT_TRIGGER_NODE_TYPE$1, MANUAL_CHAT_TRIGGER_NODE_TYPE].includes(node.type)
3867
4025
  );
4026
+ if (!triggerNode) {
4027
+ return;
4028
+ }
4029
+ chatTriggerName.value = triggerNode.name;
3868
4030
  }
3869
- function restorePersistedDimensions() {
3870
- const persistedHeight = parseInt(storage.height.value ?? "0", 10);
3871
- const persistedWidth = parseInt(storage.width.value ?? "0", 10);
3872
- if (persistedHeight) onResize(persistedHeight);
3873
- if (persistedWidth) onResizeChat(persistedWidth);
4031
+ function setConnectedNode() {
4032
+ const triggerNode = chatTriggerNode.value;
4033
+ if (!triggerNode) {
4034
+ return;
4035
+ }
4036
+ const chatChildren = workflow.value.getChildNodes(triggerNode.name);
4037
+ const chatRootNode = chatChildren.reverse().map((nodeName) => getNodeByName(nodeName)).filter((n) => n !== null).reverse().find((storeNode) => {
4038
+ if (storeNode.type === CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE) return false;
4039
+ const nodeType = getNodeType(storeNode.type, storeNode.typeVersion);
4040
+ if (!nodeType) return false;
4041
+ const isAgent = nodeType.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(AI_CATEGORY_AGENTS);
4042
+ const isChain = nodeType.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(AI_CATEGORY_CHAINS);
4043
+ let isCustomChainOrAgent = false;
4044
+ if (nodeType.name === AI_CODE_NODE_TYPE) {
4045
+ const inputs = getNodeInputs(workflow.value, storeNode, nodeType);
4046
+ const inputTypes = getConnectionTypes(inputs);
4047
+ const outputs = getNodeOutputs(workflow.value, storeNode, nodeType);
4048
+ const outputTypes = getConnectionTypes(outputs);
4049
+ if (inputTypes.includes(NodeConnectionTypes.AiLanguageModel) && inputTypes.includes(NodeConnectionTypes.Main) && outputTypes.includes(NodeConnectionTypes.Main)) {
4050
+ isCustomChainOrAgent = true;
4051
+ }
4052
+ }
4053
+ if (!isAgent && !isChain && !isCustomChainOrAgent) return false;
4054
+ const parentNodes = workflow.value.getParentNodes(storeNode.name);
4055
+ const isChatChild = parentNodes.some(
4056
+ (parentNodeName) => parentNodeName === triggerNode.name
4057
+ );
4058
+ const result = Boolean(isChatChild && (isAgent || isChain || isCustomChainOrAgent));
4059
+ return result;
4060
+ });
4061
+ connectedNode.value = chatRootNode ?? null;
3874
4062
  }
3875
- function onWindowResize() {
3876
- if (!container2.value) return;
3877
- dimensions.container.value = container2.value.getBoundingClientRect().width;
3878
- onResizeChat(dimensions.chat.value);
3879
- dimensions.minHeight.value = window.innerHeight * MIN_HEIGHT_PERCENTAGE;
3880
- dimensions.maxHeight.value = window.innerHeight * MAX_HEIGHT_PERCENTAGE;
3881
- onResize(dimensions.height.value);
4063
+ return {
4064
+ allowFileUploads,
4065
+ allowedFilesMimeTypes,
4066
+ chatTriggerNode,
4067
+ connectedNode: computed(() => connectedNode.value),
4068
+ setChatTriggerNode,
4069
+ setConnectedNode
4070
+ };
4071
+ }
4072
+ function useChatState(isDisabled, onWindowResize) {
4073
+ const workflowsStore = useWorkflowsStore();
4074
+ const nodeTypesStore = useNodeTypesStore();
4075
+ const canvasStore = useCanvasStore();
4076
+ const router = useRouter();
4077
+ const nodeHelpers = useNodeHelpers();
4078
+ const { runWorkflow } = useRunWorkflow({ router });
4079
+ const messages2 = ref([]);
4080
+ const currentSessionId = ref(v4().replace(/-/g, ""));
4081
+ const canvasNodes = computed(() => workflowsStore.allNodes);
4082
+ const allConnections = computed(() => workflowsStore.allConnections);
4083
+ const chatPanelState = computed(() => workflowsStore.chatPanelState);
4084
+ const workflow = computed(() => workflowsStore.getCurrentWorkflow());
4085
+ const {
4086
+ chatTriggerNode,
4087
+ connectedNode,
4088
+ allowFileUploads,
4089
+ allowedFilesMimeTypes,
4090
+ setChatTriggerNode,
4091
+ setConnectedNode
4092
+ } = useChatTrigger({
4093
+ workflow,
4094
+ canvasNodes,
4095
+ getNodeByName: workflowsStore.getNodeByName,
4096
+ getNodeType: nodeTypesStore.getNodeType
4097
+ });
4098
+ const { sendMessage, getChatMessages, isLoading } = useChatMessaging({
4099
+ chatTrigger: chatTriggerNode,
4100
+ connectedNode,
4101
+ messages: messages2,
4102
+ sessionId: currentSessionId,
4103
+ workflow,
4104
+ executionResultData: computed(() => workflowsStore.getWorkflowExecution?.data?.resultData),
4105
+ getWorkflowResultDataByNodeName: workflowsStore.getWorkflowResultDataByNodeName,
4106
+ onRunChatWorkflow
4107
+ });
4108
+ function createChatConfig(params) {
4109
+ const chatConfig2 = {
4110
+ messages: params.messages,
4111
+ sendMessage: params.sendMessage,
4112
+ initialMessages: ref([]),
4113
+ currentSessionId: params.currentSessionId,
4114
+ waitingForResponse: params.isLoading
4115
+ };
4116
+ const chatOptions2 = {
4117
+ i18n: {
4118
+ en: {
4119
+ title: "",
4120
+ footer: "",
4121
+ subtitle: "",
4122
+ inputPlaceholder: params.locale.baseText("chat.window.chat.placeholder"),
4123
+ getStarted: "",
4124
+ closeButtonTooltip: ""
4125
+ }
4126
+ },
4127
+ webhookUrl: "",
4128
+ mode: "window",
4129
+ showWindowCloseButton: true,
4130
+ disabled: params.isDisabled,
4131
+ allowFileUploads: params.allowFileUploads,
4132
+ allowedFilesMimeTypes
4133
+ };
4134
+ return { chatConfig: chatConfig2, chatOptions: chatOptions2 };
3882
4135
  }
3883
- watchEffect(() => {
3884
- const { chat: chat2, height } = dimensions;
3885
- if (chat2.value > 0) storage.width.value = chat2.value.toString();
3886
- if (height.value > 0) storage.height.value = height.value.toString();
4136
+ const { chatConfig, chatOptions } = createChatConfig({
4137
+ messages: messages2,
4138
+ sendMessage,
4139
+ currentSessionId,
4140
+ isLoading,
4141
+ isDisabled,
4142
+ allowFileUploads,
4143
+ locale: useI18n$1()
3887
4144
  });
3888
- watchEffect(() => {
3889
- if (container2.value) {
3890
- onWindowResize();
3891
- restorePersistedDimensions();
4145
+ provide(ChatSymbol, chatConfig);
4146
+ provide(ChatOptionsSymbol, chatOptions);
4147
+ watch(
4148
+ () => chatPanelState.value,
4149
+ (state) => {
4150
+ if (state !== "closed") {
4151
+ setChatTriggerNode();
4152
+ setConnectedNode();
4153
+ if (messages2.value.length === 0) {
4154
+ messages2.value = getChatMessages();
4155
+ }
4156
+ setTimeout(() => {
4157
+ onWindowResize();
4158
+ chatEventBus.emit("focusInput");
4159
+ }, 0);
4160
+ }
4161
+ },
4162
+ { immediate: true }
4163
+ );
4164
+ watch(
4165
+ () => allConnections.value,
4166
+ () => {
4167
+ if (canvasStore.isLoading) return;
4168
+ setTimeout(() => {
4169
+ if (!chatTriggerNode.value) {
4170
+ setChatTriggerNode();
4171
+ }
4172
+ setConnectedNode();
4173
+ }, 0);
4174
+ },
4175
+ { deep: true }
4176
+ );
4177
+ async function createExecutionPromise() {
4178
+ return await new Promise((resolve) => {
4179
+ const resolveIfFinished = (isRunning) => {
4180
+ if (!isRunning) {
4181
+ unwatch();
4182
+ resolve();
4183
+ }
4184
+ };
4185
+ const unwatch = watch(() => workflowsStore.isWorkflowRunning, resolveIfFinished);
4186
+ resolveIfFinished(workflowsStore.isWorkflowRunning);
4187
+ });
4188
+ }
4189
+ async function onRunChatWorkflow(payload) {
4190
+ const runWorkflowOptions = {
4191
+ triggerNode: payload.triggerNode,
4192
+ nodeData: payload.nodeData,
4193
+ source: payload.source
4194
+ };
4195
+ if (workflowsStore.chatPartialExecutionDestinationNode) {
4196
+ runWorkflowOptions.destinationNode = workflowsStore.chatPartialExecutionDestinationNode;
4197
+ workflowsStore.chatPartialExecutionDestinationNode = null;
3892
4198
  }
3893
- });
3894
- onMounted(() => window.addEventListener("resize", onWindowResize));
3895
- onBeforeUnmount(() => window.removeEventListener("resize", onWindowResize));
4199
+ const response = await runWorkflow(runWorkflowOptions);
4200
+ if (response) {
4201
+ await createExecutionPromise();
4202
+ workflowsStore.appendChatMessage(payload.message);
4203
+ return response;
4204
+ }
4205
+ return;
4206
+ }
4207
+ function refreshSession() {
4208
+ workflowsStore.setWorkflowExecutionData(null);
4209
+ nodeHelpers.updateNodesExecutionIssues();
4210
+ messages2.value = [];
4211
+ currentSessionId.value = v4().replace(/-/g, "");
4212
+ }
4213
+ function displayExecution(executionId) {
4214
+ const route = router.resolve({
4215
+ name: VIEWS.EXECUTION_PREVIEW,
4216
+ params: { name: workflow.value.id, executionId }
4217
+ });
4218
+ window.open(route.href, "_blank");
4219
+ }
3896
4220
  return {
3897
- height: dimensions.height,
3898
- chatWidth: dimensions.chat,
3899
- logsWidth: dimensions.logs,
3900
- rootStyles,
3901
- onWindowResize,
3902
- onResizeDebounced,
3903
- onResizeChatDebounced,
3904
- panelToContainerRatio
4221
+ currentSessionId,
4222
+ messages: messages2,
4223
+ chatTriggerNode,
4224
+ connectedNode,
4225
+ sendMessage,
4226
+ refreshSession,
4227
+ displayExecution
3905
4228
  };
3906
4229
  }
3907
- const _sfc_main = /* @__PURE__ */ defineComponent({
4230
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3908
4231
  __name: "CanvasChat",
3909
4232
  setup(__props, { expose: __expose }) {
3910
4233
  const workflowsStore = useWorkflowsStore();
3911
4234
  const canvasStore = useCanvasStore();
3912
- const nodeTypesStore = useNodeTypesStore();
3913
- const nodeHelpers = useNodeHelpers();
3914
- const router = useRouter();
3915
- const messages2 = ref([]);
3916
- const currentSessionId = ref(v4().replace(/-/g, ""));
3917
4235
  const isDisabled = ref(false);
3918
4236
  const container2 = ref();
4237
+ const pipContainer = useTemplateRef("pipContainer");
4238
+ const pipContent2 = useTemplateRef("pipContent");
3919
4239
  const workflow = computed(() => workflowsStore.getCurrentWorkflow());
3920
- const allConnections = computed(() => workflowsStore.allConnections);
3921
- const isChatOpen = computed(() => {
3922
- const result = workflowsStore.isChatPanelOpen;
3923
- return result;
3924
- });
3925
- const canvasNodes = computed(() => workflowsStore.allNodes);
3926
- const isLogsOpen = computed(() => workflowsStore.isLogsPanelOpen);
4240
+ const chatPanelState = computed(() => workflowsStore.chatPanelState);
3927
4241
  const previousChatMessages = computed(() => workflowsStore.getPastChatMessages);
3928
4242
  const resultData = computed(() => workflowsStore.getWorkflowRunData);
3929
- __expose({
3930
- messages: messages2,
3931
- currentSessionId,
3932
- isDisabled,
3933
- workflow
3934
- });
3935
- const { runWorkflow } = useRunWorkflow({ router });
3936
- const {
3937
- chatTriggerNode,
3938
- connectedNode,
3939
- allowFileUploads,
3940
- allowedFilesMimeTypes,
3941
- setChatTriggerNode,
3942
- setConnectedNode
3943
- } = useChatTrigger({
3944
- workflow,
3945
- canvasNodes,
3946
- getNodeByName: workflowsStore.getNodeByName,
3947
- getNodeType: nodeTypesStore.getNodeType
3948
- });
3949
- const { sendMessage, getChatMessages, isLoading } = useChatMessaging({
3950
- chatTrigger: chatTriggerNode,
3951
- connectedNode,
3952
- messages: messages2,
3953
- sessionId: currentSessionId,
3954
- workflow,
3955
- executionResultData: computed(() => workflowsStore.getWorkflowExecution?.data?.resultData),
3956
- getWorkflowResultDataByNodeName: workflowsStore.getWorkflowResultDataByNodeName,
3957
- onRunChatWorkflow
3958
- });
4243
+ const telemetry = useTelemetry();
3959
4244
  const {
3960
4245
  height,
3961
4246
  chatWidth,
@@ -3965,229 +4250,441 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3965
4250
  onResizeChatDebounced,
3966
4251
  onWindowResize
3967
4252
  } = useResize(container2);
3968
- function createChatConfig(params) {
3969
- const chatConfig2 = {
3970
- messages: params.messages,
3971
- sendMessage: params.sendMessage,
3972
- initialMessages: ref([]),
3973
- currentSessionId: params.currentSessionId,
3974
- waitingForResponse: params.isLoading
3975
- };
3976
- const chatOptions2 = {
3977
- i18n: {
3978
- en: {
3979
- title: "",
3980
- footer: "",
3981
- subtitle: "",
3982
- inputPlaceholder: params.locale.baseText("chat.window.chat.placeholder"),
3983
- getStarted: "",
3984
- closeButtonTooltip: ""
3985
- }
3986
- },
3987
- webhookUrl: "",
3988
- mode: "window",
3989
- showWindowCloseButton: true,
3990
- disabled: params.isDisabled,
3991
- allowFileUploads: params.allowFileUploads,
3992
- allowedFilesMimeTypes
3993
- };
3994
- return { chatConfig: chatConfig2, chatOptions: chatOptions2 };
3995
- }
3996
- function displayExecution(params) {
3997
- const route = params.router.resolve({
3998
- name: VIEWS.EXECUTION_PREVIEW,
3999
- params: { name: params.workflowId, executionId: params.executionId }
4000
- });
4001
- window.open(route.href, "_blank");
4002
- }
4003
- function refreshSession(params) {
4004
- workflowsStore.setWorkflowExecutionData(null);
4005
- nodeHelpers.updateNodesExecutionIssues();
4006
- params.messages.value = [];
4007
- params.currentSessionId.value = v4().replace(/-/g, "");
4008
- }
4009
- const handleDisplayExecution = (executionId) => {
4010
- displayExecution({
4011
- router,
4012
- workflowId: workflow.value.id,
4013
- executionId
4014
- });
4015
- };
4016
- const handleRefreshSession = () => {
4017
- refreshSession({
4018
- messages: messages2,
4019
- currentSessionId
4020
- });
4021
- };
4022
- const closePanel = () => {
4023
- workflowsStore.setPanelOpen("chat", false);
4024
- };
4025
- async function createExecutionPromise() {
4026
- return await new Promise((resolve) => {
4027
- const resolveIfFinished = (isRunning) => {
4028
- if (!isRunning) {
4029
- unwatch();
4030
- resolve();
4031
- }
4032
- };
4033
- const unwatch = watch(() => workflowsStore.isWorkflowRunning, resolveIfFinished);
4034
- resolveIfFinished(workflowsStore.isWorkflowRunning);
4035
- });
4036
- }
4037
- async function onRunChatWorkflow(payload) {
4038
- const runWorkflowOptions = {
4039
- triggerNode: payload.triggerNode,
4040
- nodeData: payload.nodeData,
4041
- source: payload.source
4042
- };
4043
- if (workflowsStore.chatPartialExecutionDestinationNode) {
4044
- runWorkflowOptions.destinationNode = workflowsStore.chatPartialExecutionDestinationNode;
4045
- workflowsStore.chatPartialExecutionDestinationNode = null;
4046
- }
4047
- const response = await runWorkflow(runWorkflowOptions);
4048
- if (response) {
4049
- await createExecutionPromise();
4050
- workflowsStore.appendChatMessage(payload.message);
4051
- return response;
4253
+ const { canPopOut, isPoppedOut, pipWindow } = usePiPWindow({
4254
+ initialHeight: 400,
4255
+ initialWidth: window.document.body.offsetWidth * 0.8,
4256
+ container: pipContainer,
4257
+ content: pipContent2,
4258
+ shouldPopOut: computed(() => chatPanelState.value === "floating"),
4259
+ onRequestClose: () => {
4260
+ if (chatPanelState.value === "closed") {
4261
+ return;
4262
+ }
4263
+ telemetry.track("User toggled log view", { new_state: "attached" });
4264
+ workflowsStore.setPanelState("attached");
4052
4265
  }
4053
- return;
4054
- }
4055
- const { chatConfig, chatOptions } = createChatConfig({
4266
+ });
4267
+ const {
4268
+ currentSessionId,
4056
4269
  messages: messages2,
4270
+ chatTriggerNode,
4271
+ connectedNode,
4057
4272
  sendMessage,
4273
+ refreshSession,
4274
+ displayExecution
4275
+ } = useChatState(isDisabled, onWindowResize);
4276
+ __expose({
4277
+ messages: messages2,
4058
4278
  currentSessionId,
4059
- isLoading,
4060
4279
  isDisabled,
4061
- allowFileUploads,
4062
- locale: useI18n$1()
4280
+ workflow
4063
4281
  });
4064
- provide(ChatSymbol, chatConfig);
4065
- provide(ChatOptionsSymbol, chatOptions);
4066
- watch(
4067
- () => isChatOpen.value,
4068
- (isOpen) => {
4069
- if (isOpen) {
4070
- setChatTriggerNode();
4071
- setConnectedNode();
4072
- if (messages2.value.length === 0) {
4073
- messages2.value = getChatMessages();
4074
- }
4075
- setTimeout(() => {
4076
- onWindowResize();
4077
- chatEventBus.emit("focusInput");
4078
- }, 0);
4079
- }
4080
- },
4081
- { immediate: true }
4082
- );
4083
- watch(
4084
- () => allConnections.value,
4085
- () => {
4086
- if (canvasStore.isLoading) return;
4087
- setTimeout(() => {
4088
- if (!chatTriggerNode.value) {
4089
- setChatTriggerNode();
4090
- }
4091
- setConnectedNode();
4092
- }, 0);
4093
- },
4094
- { deep: true }
4095
- );
4282
+ const closePanel = () => {
4283
+ workflowsStore.setPanelState("closed");
4284
+ };
4285
+ function onPopOut() {
4286
+ telemetry.track("User toggled log view", { new_state: "floating" });
4287
+ workflowsStore.setPanelState("floating");
4288
+ }
4096
4289
  watchEffect(() => {
4097
- canvasStore.setPanelHeight(isChatOpen.value || isLogsOpen.value ? height.value : 0);
4290
+ canvasStore.setPanelHeight(chatPanelState.value === "attached" ? height.value : 0);
4098
4291
  });
4099
4292
  return (_ctx, _cache) => {
4100
- const _component_n8n_resize_wrapper = resolveComponent("n8n-resize-wrapper");
4101
- const _component_N8nResizeWrapper = resolveComponent("N8nResizeWrapper");
4102
- return unref(chatTriggerNode) ? (openBlock(), createBlock(_component_N8nResizeWrapper, {
4103
- key: 0,
4104
- "is-resizing-enabled": isChatOpen.value || isLogsOpen.value,
4105
- "supported-directions": ["top"],
4106
- class: normalizeClass([_ctx.$style.resizeWrapper, !isChatOpen.value && !isLogsOpen.value && _ctx.$style.empty]),
4107
- height: unref(height),
4108
- style: normalizeStyle(unref(rootStyles)),
4109
- onResize: unref(onResizeDebounced)
4110
- }, {
4111
- default: withCtx(() => [
4112
- createBaseVNode("div", {
4113
- ref_key: "container",
4114
- ref: container2,
4115
- class: normalizeClass([_ctx.$style.container, "ignore-key-press-canvas"]),
4116
- tabindex: "0"
4117
- }, [
4118
- isChatOpen.value || isLogsOpen.value ? (openBlock(), createElementBlock("div", {
4119
- key: 0,
4120
- class: normalizeClass(_ctx.$style.chatResizer)
4121
- }, [
4122
- isChatOpen.value ? (openBlock(), createBlock(_component_n8n_resize_wrapper, {
4123
- key: 0,
4124
- "supported-directions": ["right"],
4125
- width: unref(chatWidth),
4126
- class: normalizeClass(_ctx.$style.chat),
4127
- onResize: unref(onResizeChatDebounced)
4128
- }, {
4129
- default: withCtx(() => [
4130
- createBaseVNode("div", {
4131
- class: normalizeClass(_ctx.$style.inner)
4293
+ const _component_n8n_icon_button = resolveComponent("n8n-icon-button");
4294
+ return openBlock(), createElementBlock("div", {
4295
+ ref_key: "pipContainer",
4296
+ ref: pipContainer
4297
+ }, [
4298
+ createBaseVNode("div", {
4299
+ ref_key: "pipContent",
4300
+ ref: pipContent2,
4301
+ class: normalizeClass(_ctx.$style.pipContent)
4302
+ }, [
4303
+ unref(chatTriggerNode) ? (openBlock(), createBlock(unref(N8nResizeWrapper), {
4304
+ key: 0,
4305
+ "is-resizing-enabled": !unref(isPoppedOut) && chatPanelState.value === "attached",
4306
+ "supported-directions": ["top"],
4307
+ class: normalizeClass([_ctx.$style.resizeWrapper, chatPanelState.value === "closed" && _ctx.$style.empty]),
4308
+ height: unref(height),
4309
+ style: normalizeStyle(unref(rootStyles)),
4310
+ onResize: unref(onResizeDebounced)
4311
+ }, {
4312
+ default: withCtx(() => [
4313
+ createBaseVNode("div", {
4314
+ ref_key: "container",
4315
+ ref: container2,
4316
+ class: normalizeClass([_ctx.$style.container, "ignore-key-press-canvas"]),
4317
+ tabindex: "0"
4318
+ }, [
4319
+ chatPanelState.value !== "closed" ? (openBlock(), createElementBlock("div", {
4320
+ key: 0,
4321
+ class: normalizeClass(_ctx.$style.chatResizer)
4322
+ }, [
4323
+ createVNode(unref(N8nResizeWrapper), {
4324
+ "supported-directions": ["right"],
4325
+ width: unref(chatWidth),
4326
+ class: normalizeClass(_ctx.$style.chat),
4327
+ window: unref(pipWindow),
4328
+ onResize: unref(onResizeChatDebounced)
4329
+ }, {
4330
+ default: withCtx(() => [
4331
+ createBaseVNode("div", {
4332
+ class: normalizeClass(_ctx.$style.inner)
4333
+ }, [
4334
+ createVNode(ChatMessagesPanel, {
4335
+ "data-test-id": "canvas-chat",
4336
+ messages: unref(messages2),
4337
+ "session-id": unref(currentSessionId),
4338
+ "past-chat-messages": previousChatMessages.value,
4339
+ "show-close-button": !unref(isPoppedOut) && !unref(connectedNode),
4340
+ onClose: closePanel,
4341
+ onRefreshSession: unref(refreshSession),
4342
+ onDisplayExecution: unref(displayExecution),
4343
+ onSendMessage: unref(sendMessage)
4344
+ }, null, 8, ["messages", "session-id", "past-chat-messages", "show-close-button", "onRefreshSession", "onDisplayExecution", "onSendMessage"])
4345
+ ], 2)
4346
+ ]),
4347
+ _: 1
4348
+ }, 8, ["width", "class", "window", "onResize"]),
4349
+ unref(connectedNode) ? (openBlock(), createElementBlock("div", {
4350
+ key: 0,
4351
+ class: normalizeClass(_ctx.$style.logs)
4132
4352
  }, [
4353
+ (openBlock(), createBlock(ChatLogsPanel, {
4354
+ key: `${resultData.value?.length ?? unref(messages2)?.length}`,
4355
+ workflow: workflow.value,
4356
+ "data-test-id": "canvas-chat-logs",
4357
+ node: unref(connectedNode),
4358
+ slim: unref(logsWidth) < 700
4359
+ }, {
4360
+ actions: withCtx(() => [
4361
+ unref(canPopOut) && !unref(isPoppedOut) ? (openBlock(), createBlock(_component_n8n_icon_button, {
4362
+ key: 0,
4363
+ icon: "pop-out",
4364
+ type: "secondary",
4365
+ size: "medium",
4366
+ onClick: onPopOut
4367
+ })) : createCommentVNode("", true),
4368
+ !unref(isPoppedOut) ? (openBlock(), createBlock(_component_n8n_icon_button, {
4369
+ key: 1,
4370
+ outline: "",
4371
+ icon: "times",
4372
+ type: "secondary",
4373
+ size: "medium",
4374
+ onClick: closePanel
4375
+ })) : createCommentVNode("", true)
4376
+ ]),
4377
+ _: 1
4378
+ }, 8, ["workflow", "node", "slim"]))
4379
+ ], 2)) : createCommentVNode("", true)
4380
+ ], 2)) : createCommentVNode("", true)
4381
+ ], 2)
4382
+ ]),
4383
+ _: 1
4384
+ }, 8, ["is-resizing-enabled", "class", "height", "style", "onResize"])) : createCommentVNode("", true)
4385
+ ], 2)
4386
+ ], 512);
4387
+ };
4388
+ }
4389
+ });
4390
+ const resizeWrapper$1 = "_resizeWrapper_1aajp_124";
4391
+ const pipContent$1 = "_pipContent_1aajp_129";
4392
+ const empty$1 = "_empty_1aajp_140";
4393
+ const container$2 = "_container_1aajp_146";
4394
+ const chatResizer = "_chatResizer_1aajp_154";
4395
+ const footer = "_footer_1aajp_161";
4396
+ const chat$1 = "_chat_1aajp_154";
4397
+ const inner = "_inner_1aajp_180";
4398
+ const logs = "_logs_1aajp_188";
4399
+ const style0$2 = {
4400
+ resizeWrapper: resizeWrapper$1,
4401
+ pipContent: pipContent$1,
4402
+ empty: empty$1,
4403
+ container: container$2,
4404
+ chatResizer,
4405
+ footer,
4406
+ chat: chat$1,
4407
+ inner,
4408
+ logs
4409
+ };
4410
+ const cssModules$2 = {
4411
+ "$style": style0$2
4412
+ };
4413
+ const __unplugin_components_0 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__cssModules", cssModules$2]]);
4414
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4415
+ __name: "LogsOverviewPanel",
4416
+ props: {
4417
+ isOpen: { type: Boolean }
4418
+ },
4419
+ emits: ["clickHeader"],
4420
+ setup(__props, { emit: __emit }) {
4421
+ const emit = __emit;
4422
+ const locale = useI18n$1();
4423
+ const workflowsStore = useWorkflowsStore();
4424
+ const nodeHelpers = useNodeHelpers();
4425
+ const isClearExecutionButtonVisible = useClearExecutionButtonVisible();
4426
+ function onClearExecutionData() {
4427
+ workflowsStore.setWorkflowExecutionData(null);
4428
+ nodeHelpers.updateNodesExecutionIssues();
4429
+ }
4430
+ return (_ctx, _cache) => {
4431
+ return openBlock(), createElementBlock("div", {
4432
+ class: normalizeClass(_ctx.$style.container)
4433
+ }, [
4434
+ createVNode(PanelHeader, {
4435
+ title: unref(locale).baseText("logs.overview.header.title"),
4436
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("clickHeader"))
4437
+ }, {
4438
+ actions: withCtx(() => [
4439
+ unref(isClearExecutionButtonVisible) ? (openBlock(), createBlock(unref(N8nTooltip), {
4440
+ key: 0,
4441
+ content: unref(locale).baseText("logs.overview.header.actions.clearExecution.tooltip")
4442
+ }, {
4443
+ default: withCtx(() => [
4444
+ createVNode(unref(N8nButton), {
4445
+ size: "mini",
4446
+ type: "secondary",
4447
+ icon: "trash",
4448
+ "icon-size": "medium",
4449
+ onClick: withModifiers(onClearExecutionData, ["stop"])
4450
+ }, {
4451
+ default: withCtx(() => [
4452
+ createTextVNode(toDisplayString(unref(locale).baseText("logs.overview.header.actions.clearExecution")), 1)
4453
+ ]),
4454
+ _: 1
4455
+ })
4456
+ ]),
4457
+ _: 1
4458
+ }, 8, ["content"])) : createCommentVNode("", true),
4459
+ renderSlot(_ctx.$slots, "actions")
4460
+ ]),
4461
+ _: 3
4462
+ }, 8, ["title"]),
4463
+ _ctx.isOpen ? (openBlock(), createElementBlock("div", {
4464
+ key: 0,
4465
+ class: normalizeClass([_ctx.$style.content, _ctx.$style.empty])
4466
+ }, [
4467
+ createVNode(unref(N8nText), {
4468
+ tag: "p",
4469
+ size: "medium",
4470
+ color: "text-base",
4471
+ class: normalizeClass(_ctx.$style.emptyText)
4472
+ }, {
4473
+ default: withCtx(() => [
4474
+ createTextVNode(toDisplayString(unref(locale).baseText("logs.overview.body.empty.message")), 1)
4475
+ ]),
4476
+ _: 1
4477
+ }, 8, ["class"])
4478
+ ], 2)) : createCommentVNode("", true)
4479
+ ], 2);
4480
+ };
4481
+ }
4482
+ });
4483
+ const container$1 = "_container_wrmwc_123";
4484
+ const content = "_content_wrmwc_131";
4485
+ const empty = "_empty_wrmwc_135";
4486
+ const emptyText = "_emptyText_wrmwc_141";
4487
+ const style0$1 = {
4488
+ container: container$1,
4489
+ content,
4490
+ empty,
4491
+ emptyText
4492
+ };
4493
+ const cssModules$1 = {
4494
+ "$style": style0$1
4495
+ };
4496
+ const LogsOverviewPanel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__cssModules", cssModules$1]]);
4497
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4498
+ __name: "LogsPanel",
4499
+ setup(__props) {
4500
+ const workflowsStore = useWorkflowsStore();
4501
+ const canvasStore = useCanvasStore();
4502
+ const panelState = computed(() => workflowsStore.chatPanelState);
4503
+ const container2 = ref();
4504
+ const pipContainer = useTemplateRef("pipContainer");
4505
+ const pipContent2 = useTemplateRef("pipContent");
4506
+ const previousChatMessages = computed(() => workflowsStore.getPastChatMessages);
4507
+ const hasChat = computed(
4508
+ () => workflowsStore.workflowTriggerNodes.some(
4509
+ (node) => [CHAT_TRIGGER_NODE_TYPE$1, MANUAL_CHAT_TRIGGER_NODE_TYPE].includes(node.type)
4510
+ )
4511
+ );
4512
+ const locales = useI18n$1();
4513
+ const telemetry = useTelemetry();
4514
+ const { rootStyles, height, chatWidth, onWindowResize, onResizeDebounced, onResizeChatDebounced } = useResize(container2);
4515
+ const { currentSessionId, messages: messages2, sendMessage, refreshSession, displayExecution } = useChatState(
4516
+ ref(false),
4517
+ onWindowResize
4518
+ );
4519
+ const appStyles = useStyles();
4520
+ const tooltipZIndex = computed(() => appStyles.APP_Z_INDEXES.ASK_ASSISTANT_FLOATING_BUTTON + 100);
4521
+ const { canPopOut, isPoppedOut, pipWindow } = usePiPWindow({
4522
+ initialHeight: 400,
4523
+ initialWidth: window.document.body.offsetWidth * 0.8,
4524
+ container: pipContainer,
4525
+ content: pipContent2,
4526
+ shouldPopOut: computed(() => panelState.value === "floating"),
4527
+ onRequestClose: () => {
4528
+ if (panelState.value === "closed") {
4529
+ return;
4530
+ }
4531
+ telemetry.track("User toggled log view", { new_state: "attached" });
4532
+ workflowsStore.setPanelState("attached");
4533
+ }
4534
+ });
4535
+ function handleToggleOpen() {
4536
+ if (panelState.value === "closed") {
4537
+ telemetry.track("User toggled log view", { new_state: "attached" });
4538
+ workflowsStore.setPanelState("attached");
4539
+ } else {
4540
+ telemetry.track("User toggled log view", { new_state: "collapsed" });
4541
+ workflowsStore.setPanelState("closed");
4542
+ }
4543
+ }
4544
+ function handleClickHeader() {
4545
+ if (panelState.value === "closed") {
4546
+ telemetry.track("User toggled log view", { new_state: "attached" });
4547
+ workflowsStore.setPanelState("attached");
4548
+ }
4549
+ }
4550
+ function onPopOut() {
4551
+ telemetry.track("User toggled log view", { new_state: "floating" });
4552
+ workflowsStore.setPanelState("floating");
4553
+ }
4554
+ watch([panelState, height], ([state, h]) => {
4555
+ canvasStore.setPanelHeight(
4556
+ state === "floating" ? 0 : state === "attached" ? h : 32
4557
+ );
4558
+ });
4559
+ return (_ctx, _cache) => {
4560
+ return openBlock(), createElementBlock("div", {
4561
+ ref_key: "pipContainer",
4562
+ ref: pipContainer
4563
+ }, [
4564
+ createBaseVNode("div", {
4565
+ ref_key: "pipContent",
4566
+ ref: pipContent2,
4567
+ class: normalizeClass(_ctx.$style.pipContent)
4568
+ }, [
4569
+ createVNode(unref(N8nResizeWrapper), {
4570
+ height: unref(height),
4571
+ "supported-directions": ["top"],
4572
+ "is-resizing-enabled": panelState.value === "attached",
4573
+ style: normalizeStyle(unref(rootStyles)),
4574
+ class: normalizeClass([_ctx.$style.resizeWrapper, panelState.value === "closed" ? "" : _ctx.$style.isOpen]),
4575
+ onResize: unref(onResizeDebounced)
4576
+ }, {
4577
+ default: withCtx(() => [
4578
+ createBaseVNode("div", {
4579
+ ref_key: "container",
4580
+ ref: container2,
4581
+ class: normalizeClass(_ctx.$style.container)
4582
+ }, [
4583
+ hasChat.value ? (openBlock(), createBlock(unref(N8nResizeWrapper), {
4584
+ key: 0,
4585
+ "supported-directions": ["right"],
4586
+ "is-resizing-enabled": panelState.value !== "closed",
4587
+ width: unref(chatWidth),
4588
+ class: normalizeClass(_ctx.$style.chat),
4589
+ window: unref(pipWindow),
4590
+ onResize: unref(onResizeChatDebounced)
4591
+ }, {
4592
+ default: withCtx(() => [
4133
4593
  createVNode(ChatMessagesPanel, {
4134
4594
  "data-test-id": "canvas-chat",
4135
- messages: messages2.value,
4136
- "session-id": currentSessionId.value,
4595
+ "is-open": panelState.value !== "closed",
4596
+ messages: unref(messages2),
4597
+ "session-id": unref(currentSessionId),
4137
4598
  "past-chat-messages": previousChatMessages.value,
4138
- "show-close-button": !unref(connectedNode),
4139
- onClose: closePanel,
4140
- onRefreshSession: handleRefreshSession,
4141
- onDisplayExecution: handleDisplayExecution,
4142
- onSendMessage: unref(sendMessage)
4143
- }, null, 8, ["messages", "session-id", "past-chat-messages", "show-close-button", "onSendMessage"])
4144
- ], 2)
4145
- ]),
4146
- _: 1
4147
- }, 8, ["width", "class", "onResize"])) : createCommentVNode("", true),
4148
- isLogsOpen.value && unref(connectedNode) ? (openBlock(), createElementBlock("div", {
4149
- key: 1,
4150
- class: normalizeClass(_ctx.$style.logs)
4151
- }, [
4152
- (openBlock(), createBlock(ChatLogsPanel, {
4153
- key: `${resultData.value?.length ?? messages2.value?.length}`,
4154
- workflow: workflow.value,
4155
- "data-test-id": "canvas-chat-logs",
4156
- node: unref(connectedNode),
4157
- slim: unref(logsWidth) < 700,
4158
- onClose: closePanel
4159
- }, null, 8, ["workflow", "node", "slim"]))
4160
- ], 2)) : createCommentVNode("", true)
4161
- ], 2)) : createCommentVNode("", true)
4162
- ], 2)
4163
- ]),
4164
- _: 1
4165
- }, 8, ["is-resizing-enabled", "class", "height", "style", "onResize"])) : createCommentVNode("", true);
4599
+ "show-close-button": false,
4600
+ "is-new-logs-enabled": true,
4601
+ onClose: handleToggleOpen,
4602
+ onRefreshSession: unref(refreshSession),
4603
+ onDisplayExecution: unref(displayExecution),
4604
+ onSendMessage: unref(sendMessage),
4605
+ onClickHeader: handleClickHeader
4606
+ }, null, 8, ["is-open", "messages", "session-id", "past-chat-messages", "onRefreshSession", "onDisplayExecution", "onSendMessage"])
4607
+ ]),
4608
+ _: 1
4609
+ }, 8, ["is-resizing-enabled", "width", "class", "window", "onResize"])) : createCommentVNode("", true),
4610
+ createVNode(LogsOverviewPanel, {
4611
+ "is-open": panelState.value !== "closed",
4612
+ onClickHeader: handleClickHeader
4613
+ }, {
4614
+ actions: withCtx(() => [
4615
+ unref(canPopOut) && !unref(isPoppedOut) ? (openBlock(), createBlock(unref(N8nTooltip), {
4616
+ key: 0,
4617
+ "z-index": tooltipZIndex.value,
4618
+ content: unref(locales).baseText("runData.panel.actions.popOut")
4619
+ }, {
4620
+ default: withCtx(() => [
4621
+ createVNode(unref(_sfc_main$e), {
4622
+ icon: "pop-out",
4623
+ type: "secondary",
4624
+ size: "small",
4625
+ "icon-size": "medium",
4626
+ onClick: onPopOut
4627
+ })
4628
+ ]),
4629
+ _: 1
4630
+ }, 8, ["z-index", "content"])) : createCommentVNode("", true),
4631
+ panelState.value !== "floating" ? (openBlock(), createBlock(unref(N8nTooltip), {
4632
+ key: 1,
4633
+ "z-index": tooltipZIndex.value,
4634
+ content: unref(locales).baseText(
4635
+ panelState.value === "attached" ? "runData.panel.actions.collapse" : "runData.panel.actions.open"
4636
+ )
4637
+ }, {
4638
+ default: withCtx(() => [
4639
+ createVNode(unref(_sfc_main$e), {
4640
+ type: "secondary",
4641
+ size: "small",
4642
+ "icon-size": "medium",
4643
+ icon: panelState.value === "attached" ? "chevron-down" : "chevron-up",
4644
+ style: { "color": "var(--color-text-base)" },
4645
+ onClick: withModifiers(handleToggleOpen, ["stop"])
4646
+ }, null, 8, ["icon"])
4647
+ ]),
4648
+ _: 1
4649
+ }, 8, ["z-index", "content"])) : createCommentVNode("", true)
4650
+ ]),
4651
+ _: 1
4652
+ }, 8, ["is-open"])
4653
+ ], 2)
4654
+ ]),
4655
+ _: 1
4656
+ }, 8, ["height", "is-resizing-enabled", "style", "class", "onResize"])
4657
+ ], 2)
4658
+ ], 512);
4166
4659
  };
4167
4660
  }
4168
4661
  });
4169
- const resizeWrapper = "_resizeWrapper_1tz98_123";
4170
- const empty = "_empty_1tz98_130";
4171
- const container = "_container_1tz98_136";
4172
- const chatResizer = "_chatResizer_1tz98_144";
4173
- const footer = "_footer_1tz98_151";
4174
- const chat = "_chat_1tz98_144";
4175
- const inner = "_inner_1tz98_170";
4176
- const logs = "_logs_1tz98_178";
4662
+ const resizeWrapper = "_resizeWrapper_1brak_124";
4663
+ const pipContent = "_pipContent_1brak_129";
4664
+ const isOpen = "_isOpen_1brak_145";
4665
+ const container = "_container_1brak_152";
4666
+ const chat = "_chat_1brak_160";
4177
4667
  const style0 = {
4178
4668
  resizeWrapper,
4179
- empty,
4669
+ pipContent,
4670
+ isOpen,
4180
4671
  container,
4181
- chatResizer,
4182
- footer,
4183
- chat,
4184
- inner,
4185
- logs
4672
+ chat
4186
4673
  };
4187
4674
  const cssModules = {
4188
4675
  "$style": style0
4189
4676
  };
4190
- const CanvasChat = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
4677
+ const LogsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__cssModules", cssModules]]);
4678
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4679
+ __name: "CanvasChatSwitch",
4680
+ setup(__props) {
4681
+ const { isNewLogsEnabled } = useSettingsStore();
4682
+ return (_ctx, _cache) => {
4683
+ const _component_CanvasChat = __unplugin_components_0;
4684
+ return unref(isNewLogsEnabled) ? (openBlock(), createBlock(LogsPanel, { key: 0 })) : (openBlock(), createBlock(_component_CanvasChat, { key: 1 }));
4685
+ };
4686
+ }
4687
+ });
4191
4688
  export {
4192
- CanvasChat as default
4689
+ _sfc_main as default
4193
4690
  };