n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 3.68 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.16.1`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`3b1e6515-2ec6-4a2a-b6ec-af5d2b048686`,e._sentryDebugIdIdentifier=`sentry-dbid-3b1e6515-2ec6-4a2a-b6ec-af5d2b048686`)})()}catch{}import{S as e,gt as t}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{at as n}from"./core-Bz5WjPxS.js";import{ct as r}from"./src-XqE2yCpG.js";import{$n as i,Ot as a,Qn as o,Wn as s,hr as c,r as l,s as u}from"./users.store-xP93bV7X.js";import{Hc as d,Xo as f}from"./constants-DuQbSl-q.js";import{T as p}from"./useRootStore-XEREVjMN.js";import{An as m,t as h}from"./settings.store-CAFiYCMH.js";import{t as g}from"./assistant.store-C47L2JfA.js";function _(e,t){return typeof e==`string`&&t.includes(e)}var v=p(m.CHAT_PANEL,()=>{let p=l(),m=r(),v=s(),y=h(),b=u(),x=c(),S=n(),C=null,w=e(()=>x.isFeatureEnabled(d.name)&&y.isAiAssistantEnabled&&a().isAIBuilderEnabled);function T(e){return e===`assistant`&&w.value?`builder`:e}let E=e(()=>v.activeMode===`assistant`),D=e(()=>v.activeMode===`builder`),O=e(()=>y.isAiAssistantOrBuilderEnabled&&f.includes(m.name));async function k(e){if(!y.isAiAssistantOrBuilderEnabled)return;let t=e?.mode?T(e.mode):void 0,n=e?.showCoachmark??!0;t&&(v.activeMode=t),v.showCoachmark=n;let r=v.activeMode===`assistant`?o:i,s=m?.name;if(!_(s,r)){A();return}if(v.isOpen=!0,v.activeMode===`builder`){let e=a();e.streaming||(e.fetchBuilderCredits(),e.loadSessions())}else if(v.activeMode===`assistant`){let e=g();e.chatMessages=e.chatMessages.map(e=>({...e,read:!0}))}C&&clearTimeout(C),C=setTimeout(()=>{C=null,p.appGridDimensions={...p.appGridDimensions,width:window.innerWidth-v.width}},175)}function A(){C&&=(clearTimeout(C),null),v.isOpen=!1,v.showCoachmark=!1,setTimeout(()=>{p.appGridDimensions={...p.appGridDimensions,width:window.innerWidth};let e=g();e.isSessionEnded&&e.resetAssistantChat(b.workflowId)},200)}async function j(e){v.isOpen?A():await k(e)}function M(e){let t=T(e),n=t===`assistant`?o:i,r=m?.name;if(!_(r,n)){A();return}v.activeMode=t,v.showCoachmark=!1}function N(e){let t=Math.min(Math.max(e,380),425);v.width=t,v.isOpen&&(p.appGridDimensions={...p.appGridDimensions,width:window.innerWidth-t})}async function P(e){if(w.value){let t=S.baseText(`aiAssistant.builder.credentialHelpMessage`,{interpolate:{credentialName:e.displayName}});await k({mode:`builder`}),await a().sendChatMessage({text:t,helpMessage:!0});return}await g().initCredHelp(b.workflowId,e),await k({mode:`assistant`})}async function F(e){if(w.value){let t=S.baseText(`aiAssistant.builder.errorHelpMessage`,{interpolate:{nodeName:e.node.name,errorMessage:e.error.message}});await k({mode:`builder`}),await a().sendChatMessage({text:t,helpMessage:!0});return}await g().initErrorHelper(b.workflowId,e),await k({mode:`assistant`})}return t(()=>m?.name,e=>{if(!e)return;let t=a();if(!v.isOpen&&t.streaming&&_(e,i)){k({mode:`builder`});return}v.isOpen&&(_(e,v.activeMode===`assistant`?o:i)?_(e,i)&&!t.streaming&&t.resetBuilderChat():A())}),{isOpen:e(()=>v.isOpen),width:e(()=>v.width),activeMode:e(()=>v.activeMode),showCoachmark:e(()=>v.showCoachmark),isAssistantModeActive:E,isBuilderModeActive:D,canShowAiButtonOnCanvas:O,open:k,close:A,toggle:j,switchMode:M,updateWidth:N,openWithCredHelp:P,openWithErrorHelper:F,DEFAULT_CHAT_WIDTH:400,MIN_CHAT_WIDTH:380,MAX_CHAT_WIDTH:425}});export{v as t};
//# sourceMappingURL=chatPanel.store-D4PUJTF0.js.map