@inkeep/agents-ui 0.15.3 → 0.15.4
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Ask me anything about \`${c}\`.`:`
|
|
4
4
|
|
|
5
|
-
How can I help?`,p={parts:[{type:"text",text:r.introMessage??`${d}${m}`}],id:Ha,...e,role:"assistant"};return n.jsx(se,{message:p,...i})}),an=a.ikp("div",{_id:"aiChatMessageHeader"}),qe=t=>{const{message:e}=_.useMessage();return n.jsx(an,{"data-role":e.role,...t})},nn=a.ikp("div",{_id:"aiChatMessageLoading",children:"Thinking..."}),We=t=>n.jsx(nn,{...t}),rn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ne=t=>{const{message:e}=_.useMessage();return n.jsx(rn,{"data-role":e.role,...t})},sn=a.ikp(re.Root,{_id:"aiChatMessageAvatarContent"}),Qe=t=>{const{message:e}=_.useMessage(),{baseSettings:i}=b.useInkeepConfig();return n.jsx(sn,{"data-username":u.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},on=a.ikp(re.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ve=h.memo(t=>{const{baseSettings:e}=b.useInkeepConfig(),{message:i}=_.useMessage();return e.userProperties.name?n.jsx(on,{"data-role":i.role,children:u.getInitials(e.userProperties.name),...t}):null}),me=a.ikp(re.Image,{_id:"aiChatMessageAvatarImage"}),$e=h.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=b.useInkeepConfig(),{message:o}=_.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=fa.useColorModeValue(c,m),[p,g]=h.useState(l);h.useEffect(()=>{g(l)},[l]);const v=A=>{A==="error"&&g(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(me,{"data-type":"image",alt:"User avatar","data-role":o.role,src:r.userAvatar,...t}):n.jsx(Pa.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(me,{src:p,alt:"AI assistant avatar","data-type":"image","data-role":o.role,onLoadingStatusChange:C.composeEventHandlers(e,v),...i}):n.jsx(ga.default,{"data-type":"icon","data-role":o.role,...t})}),dn=a.ikp("span",{_id:"aiChatMessageName"}),Ue=t=>{const{message:e}=_.useMessage();return n.jsx(dn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},cn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),Ke=t=>{const{message:e}=_.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageContent"}),ze=t=>{const{message:e}=_.useMessage();return n.jsx(mn,{"data-role":e.role,...t})},ln=a.ikp("div",{_id:"aiChatMessageAttachments"}),Ge=t=>{const{message:e}=_.useMessage(),i=[];return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(ln,{...t})})},hn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),Ye=t=>{const{children:e,...i}=t,r=[];return r?n.jsx(hn,{children:u.maybeRender(e,r),...i}):null},un=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),Je=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(D.AttachmentItemProvider,{attachment:e,children:n.jsx(un,{onClick:C.composeEventHandlers(i,d),...r})})},Cn=a.ikp(T.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),Xe=t=>{const{attachment:e}=D.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Cn,{iconSettings:i,...t}):null},pn=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),Ze=t=>{const{attachment:e}=D.useAttachmentItem();return n.jsx(pn,{children:e.title,...t})},vn=a.ikp(E.Root,{_id:"aiChatMessageAttachmentsPreview"}),et=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(vn,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...i})},tt=a.ikp(E.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),it=a.ikp(E.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),bn=a.ikp(E.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),at=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(bn,{children:e?.title||"Attachment",...t})},nt=a.ikp(E.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),gn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),rt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(gn,{children:e?.content,...t})},st=t=>{const{text:e,componentStyles:i,...r}=t,{aiChatSettings:s}=b.useInkeepConfig(),{shouldOpenLinksInNewTab:o}=s;return n.jsx(Q.Markdown,{children:e,componentStyles:i,shouldOpenLinksInNewTab:o,...r})},ot=({name:t,props:e,componentDef:i})=>{const s=ya.useShadow()?.shadowHost,o=h.useRef(void 0),d=h.useRef(null),c=h.useRef(null),m=h.useRef(!1),[l,p]=h.useState(!1),[g,v]=h.useState(!1),A=h.useRef(i);h.useMemo(()=>{i!==A.current&&(typeof i=="function"&&typeof A.current=="function"?i.toString()!==A.current.toString()&&(A.current=i):A.current=i)},[i]);const B=A.current;return h.useEffect(()=>{o.current||(o.current=`dyn:${t}:${crypto.randomUUID()}`,p(!0))},[t]),h.useLayoutEffect(()=>{if(!B||!s||!l||!o.current)return;const k=o.current,I=document.createElement("div");return I.setAttribute("data-ikp-component",""),I.setAttribute("data-component",t),I.setAttribute("slot",k),d.current=I,m.current=!1,s.appendChild(I),v(!0),()=>{m.current=!0,v(!1),queueMicrotask(()=>{try{c.current&&(c.current.unmount(),c.current=null)}catch(M){console.debug("Ignoring unmount error:",M)}I.parentNode===s&&I.remove(),d.current=null})}},[B,s,l,t]),h.useEffect(()=>{const k=d.current;if(!k||m.current)return;const I=x=>{if(typeof x!="function"||x.length>1)return!1;try{if(typeof x=="function"&&x.constructor===Function){const O=x({});return h.isValidElement(O)}return!1}catch{return!0}};let M;if(I(B))try{const x=B;M=h.createElement(x,e||{})}catch(x){console.error("Error creating React element from component:",x);return}else if(typeof B=="function")M=B(e||{},k,null);else{console.error("Invalid component definition");return}if(h.isValidElement(M)||typeof M=="string"){if(m.current)return;c.current||(c.current=ja.createRoot(k)),!m.current&&c.current&&c.current.render(M);return}c.current&&!m.current&&c.current.render(null)},[i,e,g]),n.jsx("slot",{name:o.current})},Pn=a.ikp("div",{_id:"aiChatMessagePart"}),An=a.ikp("div",{_id:"aiChatMessageToolbar"}),dt=t=>{const{isLoading:e,messages:i}=P.useChat(),{message:r}=_.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(An,{...t})},_n=a.ikp("div",{_id:"aiChatMessageCustomActions"}),ct=t=>{const{children:e,...i}=t,{aiChatSettings:r}=b.useInkeepConfig(),{message:s}=_.useMessage(),{isStreaming:o,messages:d}=P.useChat(),c=d.at(-1)?.id===s?.id,m=s.role==="assistant",l=r.messageActions||[];return c&&o||!m?null:n.jsx(_n,{children:u.maybeRender(e,l),...i})},En=a.ikp("a",{_id:"aiChatMessageCustomAction"}),Fn=a.ikp("button",{_id:"aiChatMessageCustomAction"}),mt=t=>{const{onClick:e,action:i,...r}=t,{message:s}=_.useMessage(),{handleAction:o}=te.useChatAction(i,s.id),{logEvent:d}=ne.useBaseEvents(),{conversationId:c}=P.useChat(),m=()=>{o(),d({eventName:"user_escalation_indicated",properties:{escalationType:"contact_us",conversationId:c}})},l=i.label,p=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(T.BuiltInIconRenderer,{iconSettings:i.icon}),l]});return i.action.type==="open_link"?n.jsx(En,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:C.composeEventHandlers(e,m),children:p,...r}):n.jsx(Fn,{"data-type":i.action.type,onClick:C.composeEventHandlers(e,m),children:p,...r})},kn=a.ikp("button",{_id:"aiChatMessageAction"}),lt=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversationId:o}=P.useChat(),{baseSettings:{onFeedback:d}}=b.useInkeepConfig(),{message:c}=_.useMessage(),{isStreaming:m,messages:l}=P.useChat(),[p,g]=J.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:A,setCurrentFeedback:B,currentFeedback:k}=ee.useMessageFeedback(),{logEvent:I}=ne.useBaseEvents(),[M,x]=Ea.useSettleAction(),O=l.at(-1)?.id===c?.id,z=c.role==="assistant";if(O&&m||!z)return null;const N={copy(){g(u.getMessageContent(c)),I({eventName:"assistant_message_copied",properties:{conversationId:o}})},upvote(){A(c.id).then(()=>{x()})},downvote(){B(c.id)}},G={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},Y={copy:n.jsx(f.CustomIcon,{iconKey:p?"messageCopied":"messageCopy"}),upvote:n.jsx(f.CustomIcon,{iconKey:M?"messageCopied":"thumbsUp"}),downvote:n.jsx(f.CustomIcon,{iconKey:"thumbsDown"})},la={copy:{"data-copied":u.dataAttr(p)},upvote:{"data-upvoted":u.dataAttr(v[c.id]?.type==="positive")},downvote:{"data-downvoted":u.dataAttr(v[c.id]?.type==="negative"),"data-state":k===null?"closed":"open"}};return{copy:!1,upvote:!d,downvote:!d}[e]?null:n.jsx(kn,{"data-action":e,...la[e],children:Y[e],"aria-label":G[e],className:`${r} ${e}`,onClick:C.composeEventHandlers(i,N[e]),...s})},In=a.ikp("div",{_id:"aiChatMessageSources"}),ht=t=>{const{message:e}=_.useMessage();return e.role!=="assistant"||!e.parts.filter(r=>r.type==="data-artifact"&&r.data?.type?.toLowerCase()==="citation")?.length?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),ut=t=>n.jsx(Mn,{children:"Sources",...t}),fn=a.ikp("div",{_id:"aiChatMessageSources__List"}),Ct=t=>{const{message:e}=_.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=b.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.parts.filter(g=>g.type==="data-artifact"&&g.data?.type?.toLowerCase()==="citation");if(!m?.length)return null;const l=new Map,p=m.filter(g=>{const v=g.data.artifactSummary.url;return!v||l.has(v)?!1:(l.set(v,!0),!0)}).map(g=>{const v=g.data,A={id:v?.artifactId,title:v?.artifactSummary?.title||v?.name,url:v?.artifactSummary?.url||"",description:"",breadcrumbs:[],type:v?.artifactSummary?.record_type,contentType:v?.artifactType,tag:v?.artifactType},k=(s??(M=>({...M,shouldOpenInNewTab:d,icon:Ta.getIcon(M)})))(A,"chatSourceItem",{organizationDisplayName:o,tabs:c}),I=k.shouldOpenInNewTab!==void 0?k.shouldOpenInNewTab:d;return{...k,isExternal:I}});return n.jsx(fn,{children:u.maybeRender(i,p),...r})},Sn=a.ikp(Aa.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),pt=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=ne.useBaseEvents(),{conversationId:o}=P.useChat(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversationId:o,link:e}})};return n.jsx(j.SourceItemProvider,{source:e,children:n.jsx(Sn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:C.composeEventHandlers(i,d),...r})})},xn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),vt=t=>{const{source:e}=j.useSourceItem();return e.breadcrumbs?.length?n.jsx(xn,{"data-type":e.type,...t}):null},Bn=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),yn=a.ikp(T.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),bt=t=>{const{source:e}=j.useSourceItem();return n.jsx(yn,{iconSettings:e.icon,"data-type":e.type,...t})},Tn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),gt=t=>{const{source:e}=j.useSourceItem();return n.jsx(Tn,{"data-type":e.type,children:e.title,...t})},jn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),Pt=t=>{const{source:e}=j.useSourceItem();return n.jsx(jn,{"data-type":e.type,...t})},Hn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),At=t=>{const{source:e}=j.useSourceItem(),{children:i,...r}=t,s=h.useMemo(()=>e.description?Ia.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(Hn,{"data-type":e.type,children:u.maybeRender(i,s),...r}):null},wn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),_t=t=>{const{part:e,...i}=t,{source:r}=j.useSourceItem();return typeof e=="string"?e:n.jsx(wn,{"data-type":r.type,children:e.content,"data-highlighted":u.dataAttr(e.highlighted),...i})},Ln=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Et=t=>{const{source:e}=j.useSourceItem();return n.jsx(Ln,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Ft=a.ikp("div",{_id:"aiChatFooter"}),kt=a.ikp("div",{_id:"aiChatInput__Fieldset"}),It=a.ikp("div",{_id:"aiChatInput__Group"}),Dn=a.ikp("textarea",{_id:"aiChatInput"}),Mt=h.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=P.useChat(),{aiChatSettings:p}=b.useInkeepConfig(),g=ie.useComposedRefs(r,l);return Ba.useWidgetAutoFocus("chat",l,m),n.jsx(Dn,{asChild:!0,ref:g,maxLength:99999,placeholder:p.placeholder,value:d,onChange:C.composeEventHandlers(t,s),onKeyDown:C.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(Z,{})})}),Rn=a.ikp("button",{_id:"aiChatInput__SendButton"}),ft=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=P.useChat(),{aiChatSettings:s}=b.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Rn,{onClick:C.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},St=a.ikp(f.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),On=a.ikp("div",{_id:"aiChatAttachmentsBar"}),xt=t=>{const e={supportedInputs:[]};return!e||!e.supportedInputs?.length?null:n.jsx(S.AttachmentsBarProvider,{children:n.jsx(On,{...t})})},qn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Bt=t=>{const{children:e,...i}=t,r=[];return n.jsx(qn,{children:u.maybeRender(e,r),...i})},Wn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),yt=t=>{const{attachment:e,...i}=t;return n.jsx(D.AttachmentItemProvider,{attachment:e,children:n.jsx(Wn,{...i})})},Nn=a.ikp(T.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Tt=t=>{const{attachment:e}=D.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Nn,{iconSettings:i,...t}):null},Qn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),jt=t=>{const{attachment:e}=D.useAttachmentItem();return n.jsx(Qn,{children:e.title,...t})},Vn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Ht=t=>{const{onClick:e,...i}=t,r=()=>{};return n.jsx(Vn,{"aria-label":"Remove attachment",children:n.jsx(f.CustomIcon,{iconKey:"close"}),onClick:C.composeEventHandlers(e,r),...i})},wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Lt=a.ikp(L.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Dt=a.ikp(L.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(f.CustomIcon,{iconKey:"info"})}),oe=a.ikp(L.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Rt=a.ikp(L.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(oe,{}),"Attachments will be kept in context for the entire conversation."]})}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Ot=t=>{const{children:e,...i}=t,r={supportedInputs:[]};return r?.supportedInputs?n.jsx($n,{children:u.maybeRender(e,r.supportedInputs),...i}):null},Un=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),qt=t=>{const{input:e,onClick:i,...r}=t,s={supportedInputs:[]},o=[],d=()=>{},{selectInput:c,onOpen:m}=S.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Un,{children:e.displayName,onClick:C.composeEventHandlers(i,l),...r})},Kn=a.ikp(E.Root,{_id:"aiChatAttachmentsBar__Modal"}),Wt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=S.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(Kn,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...i})},Nt=a.ikp(E.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Qt=a.ikp(E.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Vt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),zn=a.ikp(E.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),$t=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(zn,{children:i,...t})},Gn=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Ut=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(Gn,{children:i,...t}):null},Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Kt=t=>{const{children:e,...i}=t,{selectedInput:r}=S.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(Yn,{asChild:!e,children:e||s,...i}):null},zt=a.ikp(E.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Gt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),Jn=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),Yt=t=>{const{onSubmit:e,...i}=t,{form:r}=S.useAttachmentsBar();return n.jsx(Jn,{onSubmit:C.composeEventHandlers(e,r.onSubmit),...i})},Jt=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),Xn=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),Xt=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(Xn,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},Zn=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),Zt=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(Zn,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":u.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:C.composeEventHandlers(e,r.onChange),...i})},er=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ei=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.title?n.jsx(er,{"aria-live":"polite",children:e.errors.title,...t}):null},ti=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),tr=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),ii=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(tr,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},ir=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ai=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(ir,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":u.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:C.composeEventHandlers(e,r.onChange),...i,children:n.jsx(Z,{maxRows:10})})},ar=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ni=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.content?n.jsx(ar,{"aria-live":"polite",children:e.errors.content,...t}):null},ri=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),si=a.ikp("div",{_id:"aiChatActionBar"}),oi=a.ikp("div",{_id:"aiChat__ChatActions"}),di=a.ikp("div",{_id:"aiChatTagline__Container"}),ci=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),mi=a.ikp(_a.default,{_id:"aiChatTagline__Logo"}),li=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),nr=a.ikp(L.Trigger,{_id:"aiChat__ChatAction"}),U=t=>{const{action:e,onClick:i,className:r,...s}=t,o={},{clear:d,stop:c,isLoading:m,isStreaming:l,messages:p}=P.useChat(),{conversationId:g}=P.useChat(),{aiChatSettings:v}=b.useInkeepConfig(),[A,B]=J.useCopyToClipboard(),[k]=J.useCopyToClipboard();if({help:!1,copy:p.length===0||!v.isCopyChatButtonVisible||m||l,share:p.length===0||!v.isShareButtonVisible||!g||!!o||m||l,clear:p.length===0||v.isViewOnly||m||l,stop:!m&&!l}[e])return null;const O={help:()=>{},copy:()=>{const ce=p.map(N=>{const G=`**${N.role==="assistant"?"AI Assistant":"User"}**`,Y=u.getMessageContent(N);return`${G}
|
|
5
|
+
How can I help?`,p={parts:[{type:"text",text:r.introMessage??`${d}${m}`}],id:Ha,...e,role:"assistant"};return n.jsx(se,{message:p,...i})}),an=a.ikp("div",{_id:"aiChatMessageHeader"}),qe=t=>{const{message:e}=_.useMessage();return n.jsx(an,{"data-role":e.role,...t})},nn=a.ikp("div",{_id:"aiChatMessageLoading",children:"Thinking..."}),We=t=>n.jsx(nn,{...t}),rn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ne=t=>{const{message:e}=_.useMessage();return n.jsx(rn,{"data-role":e.role,...t})},sn=a.ikp(re.Root,{_id:"aiChatMessageAvatarContent"}),Qe=t=>{const{message:e}=_.useMessage(),{baseSettings:i}=b.useInkeepConfig();return n.jsx(sn,{"data-username":u.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},on=a.ikp(re.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ve=h.memo(t=>{const{baseSettings:e}=b.useInkeepConfig(),{message:i}=_.useMessage();return e.userProperties.name?n.jsx(on,{"data-role":i.role,children:u.getInitials(e.userProperties.name),...t}):null}),me=a.ikp(re.Image,{_id:"aiChatMessageAvatarImage"}),$e=h.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=b.useInkeepConfig(),{message:o}=_.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=fa.useColorModeValue(c,m),[p,g]=h.useState(l);h.useEffect(()=>{g(l)},[l]);const v=A=>{A==="error"&&g(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(me,{"data-type":"image",alt:"User avatar","data-role":o.role,src:r.userAvatar,...t}):n.jsx(Pa.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(me,{src:p,alt:"AI assistant avatar","data-type":"image","data-role":o.role,onLoadingStatusChange:C.composeEventHandlers(e,v),...i}):n.jsx(ga.default,{"data-type":"icon","data-role":o.role,...t})}),dn=a.ikp("span",{_id:"aiChatMessageName"}),Ue=t=>{const{message:e}=_.useMessage(),{aiChatSettings:i}=b.useInkeepConfig(),{aiAssistantName:r}=i;return n.jsx(dn,{"data-role":e.role,children:e.role==="user"?"You":r||"AI assistant",...t})},cn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),Ke=t=>{const{message:e}=_.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageContent"}),ze=t=>{const{message:e}=_.useMessage();return n.jsx(mn,{"data-role":e.role,...t})},ln=a.ikp("div",{_id:"aiChatMessageAttachments"}),Ge=t=>{const{message:e}=_.useMessage(),i=[];return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(ln,{...t})})},hn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),Ye=t=>{const{children:e,...i}=t,r=[];return r?n.jsx(hn,{children:u.maybeRender(e,r),...i}):null},un=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),Je=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(D.AttachmentItemProvider,{attachment:e,children:n.jsx(un,{onClick:C.composeEventHandlers(i,d),...r})})},Cn=a.ikp(T.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),Xe=t=>{const{attachment:e}=D.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Cn,{iconSettings:i,...t}):null},pn=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),Ze=t=>{const{attachment:e}=D.useAttachmentItem();return n.jsx(pn,{children:e.title,...t})},vn=a.ikp(E.Root,{_id:"aiChatMessageAttachmentsPreview"}),et=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(vn,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...i})},tt=a.ikp(E.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),it=a.ikp(E.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),bn=a.ikp(E.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),at=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(bn,{children:e?.title||"Attachment",...t})},nt=a.ikp(E.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),gn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),rt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(gn,{children:e?.content,...t})},st=t=>{const{text:e,componentStyles:i,...r}=t,{aiChatSettings:s}=b.useInkeepConfig(),{shouldOpenLinksInNewTab:o}=s;return n.jsx(Q.Markdown,{children:e,componentStyles:i,shouldOpenLinksInNewTab:o,...r})},ot=({name:t,props:e,componentDef:i})=>{const s=ya.useShadow()?.shadowHost,o=h.useRef(void 0),d=h.useRef(null),c=h.useRef(null),m=h.useRef(!1),[l,p]=h.useState(!1),[g,v]=h.useState(!1),A=h.useRef(i);h.useMemo(()=>{i!==A.current&&(typeof i=="function"&&typeof A.current=="function"?i.toString()!==A.current.toString()&&(A.current=i):A.current=i)},[i]);const B=A.current;return h.useEffect(()=>{o.current||(o.current=`dyn:${t}:${crypto.randomUUID()}`,p(!0))},[t]),h.useLayoutEffect(()=>{if(!B||!s||!l||!o.current)return;const k=o.current,I=document.createElement("div");return I.setAttribute("data-ikp-component",""),I.setAttribute("data-component",t),I.setAttribute("slot",k),d.current=I,m.current=!1,s.appendChild(I),v(!0),()=>{m.current=!0,v(!1),queueMicrotask(()=>{try{c.current&&(c.current.unmount(),c.current=null)}catch(M){console.debug("Ignoring unmount error:",M)}I.parentNode===s&&I.remove(),d.current=null})}},[B,s,l,t]),h.useEffect(()=>{const k=d.current;if(!k||m.current)return;const I=x=>{if(typeof x!="function"||x.length>1)return!1;try{if(typeof x=="function"&&x.constructor===Function){const O=x({});return h.isValidElement(O)}return!1}catch{return!0}};let M;if(I(B))try{const x=B;M=h.createElement(x,e||{})}catch(x){console.error("Error creating React element from component:",x);return}else if(typeof B=="function")M=B(e||{},k,null);else{console.error("Invalid component definition");return}if(h.isValidElement(M)||typeof M=="string"){if(m.current)return;c.current||(c.current=ja.createRoot(k)),!m.current&&c.current&&c.current.render(M);return}c.current&&!m.current&&c.current.render(null)},[i,e,g]),n.jsx("slot",{name:o.current})},Pn=a.ikp("div",{_id:"aiChatMessagePart"}),An=a.ikp("div",{_id:"aiChatMessageToolbar"}),dt=t=>{const{isLoading:e,messages:i}=P.useChat(),{message:r}=_.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(An,{...t})},_n=a.ikp("div",{_id:"aiChatMessageCustomActions"}),ct=t=>{const{children:e,...i}=t,{aiChatSettings:r}=b.useInkeepConfig(),{message:s}=_.useMessage(),{isStreaming:o,messages:d}=P.useChat(),c=d.at(-1)?.id===s?.id,m=s.role==="assistant",l=r.messageActions||[];return c&&o||!m?null:n.jsx(_n,{children:u.maybeRender(e,l),...i})},En=a.ikp("a",{_id:"aiChatMessageCustomAction"}),Fn=a.ikp("button",{_id:"aiChatMessageCustomAction"}),mt=t=>{const{onClick:e,action:i,...r}=t,{message:s}=_.useMessage(),{handleAction:o}=te.useChatAction(i,s.id),{logEvent:d}=ne.useBaseEvents(),{conversationId:c}=P.useChat(),m=()=>{o(),d({eventName:"user_escalation_indicated",properties:{escalationType:"contact_us",conversationId:c}})},l=i.label,p=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(T.BuiltInIconRenderer,{iconSettings:i.icon}),l]});return i.action.type==="open_link"?n.jsx(En,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:C.composeEventHandlers(e,m),children:p,...r}):n.jsx(Fn,{"data-type":i.action.type,onClick:C.composeEventHandlers(e,m),children:p,...r})},kn=a.ikp("button",{_id:"aiChatMessageAction"}),lt=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversationId:o}=P.useChat(),{baseSettings:{onFeedback:d}}=b.useInkeepConfig(),{message:c}=_.useMessage(),{isStreaming:m,messages:l}=P.useChat(),[p,g]=J.useCopyToClipboard(),{feedback:v,submitPositiveFeedback:A,setCurrentFeedback:B,currentFeedback:k}=ee.useMessageFeedback(),{logEvent:I}=ne.useBaseEvents(),[M,x]=Ea.useSettleAction(),O=l.at(-1)?.id===c?.id,z=c.role==="assistant";if(O&&m||!z)return null;const N={copy(){g(u.getMessageContent(c)),I({eventName:"assistant_message_copied",properties:{conversationId:o}})},upvote(){A(c.id).then(()=>{x()})},downvote(){B(c.id)}},G={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},Y={copy:n.jsx(f.CustomIcon,{iconKey:p?"messageCopied":"messageCopy"}),upvote:n.jsx(f.CustomIcon,{iconKey:M?"messageCopied":"thumbsUp"}),downvote:n.jsx(f.CustomIcon,{iconKey:"thumbsDown"})},la={copy:{"data-copied":u.dataAttr(p)},upvote:{"data-upvoted":u.dataAttr(v[c.id]?.type==="positive")},downvote:{"data-downvoted":u.dataAttr(v[c.id]?.type==="negative"),"data-state":k===null?"closed":"open"}};return{copy:!1,upvote:!d,downvote:!d}[e]?null:n.jsx(kn,{"data-action":e,...la[e],children:Y[e],"aria-label":G[e],className:`${r} ${e}`,onClick:C.composeEventHandlers(i,N[e]),...s})},In=a.ikp("div",{_id:"aiChatMessageSources"}),ht=t=>{const{message:e}=_.useMessage();return e.role!=="assistant"||!e.parts.filter(r=>r.type==="data-artifact"&&r.data?.type?.toLowerCase()==="citation")?.length?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),ut=t=>n.jsx(Mn,{children:"Sources",...t}),fn=a.ikp("div",{_id:"aiChatMessageSources__List"}),Ct=t=>{const{message:e}=_.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=b.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.parts.filter(g=>g.type==="data-artifact"&&g.data?.type?.toLowerCase()==="citation");if(!m?.length)return null;const l=new Map,p=m.filter(g=>{const v=g.data.artifactSummary.url;return!v||l.has(v)?!1:(l.set(v,!0),!0)}).map(g=>{const v=g.data,A={id:v?.artifactId,title:v?.artifactSummary?.title||v?.name,url:v?.artifactSummary?.url||"",description:"",breadcrumbs:[],type:v?.artifactSummary?.record_type,contentType:v?.artifactType,tag:v?.artifactType},k=(s??(M=>({...M,shouldOpenInNewTab:d,icon:Ta.getIcon(M)})))(A,"chatSourceItem",{organizationDisplayName:o,tabs:c}),I=k.shouldOpenInNewTab!==void 0?k.shouldOpenInNewTab:d;return{...k,isExternal:I}});return n.jsx(fn,{children:u.maybeRender(i,p),...r})},Sn=a.ikp(Aa.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),pt=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=ne.useBaseEvents(),{conversationId:o}=P.useChat(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversationId:o,link:e}})};return n.jsx(j.SourceItemProvider,{source:e,children:n.jsx(Sn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:C.composeEventHandlers(i,d),...r})})},xn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),vt=t=>{const{source:e}=j.useSourceItem();return e.breadcrumbs?.length?n.jsx(xn,{"data-type":e.type,...t}):null},Bn=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),yn=a.ikp(T.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),bt=t=>{const{source:e}=j.useSourceItem();return n.jsx(yn,{iconSettings:e.icon,"data-type":e.type,...t})},Tn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),gt=t=>{const{source:e}=j.useSourceItem();return n.jsx(Tn,{"data-type":e.type,children:e.title,...t})},jn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),Pt=t=>{const{source:e}=j.useSourceItem();return n.jsx(jn,{"data-type":e.type,...t})},Hn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),At=t=>{const{source:e}=j.useSourceItem(),{children:i,...r}=t,s=h.useMemo(()=>e.description?Ia.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(Hn,{"data-type":e.type,children:u.maybeRender(i,s),...r}):null},wn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),_t=t=>{const{part:e,...i}=t,{source:r}=j.useSourceItem();return typeof e=="string"?e:n.jsx(wn,{"data-type":r.type,children:e.content,"data-highlighted":u.dataAttr(e.highlighted),...i})},Ln=a.ikp(f.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Et=t=>{const{source:e}=j.useSourceItem();return n.jsx(Ln,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Ft=a.ikp("div",{_id:"aiChatFooter"}),kt=a.ikp("div",{_id:"aiChatInput__Fieldset"}),It=a.ikp("div",{_id:"aiChatInput__Group"}),Dn=a.ikp("textarea",{_id:"aiChatInput"}),Mt=h.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=P.useChat(),{aiChatSettings:p}=b.useInkeepConfig(),g=ie.useComposedRefs(r,l);return Ba.useWidgetAutoFocus("chat",l,m),n.jsx(Dn,{asChild:!0,ref:g,maxLength:99999,placeholder:p.placeholder,value:d,onChange:C.composeEventHandlers(t,s),onKeyDown:C.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(Z,{})})}),Rn=a.ikp("button",{_id:"aiChatInput__SendButton"}),ft=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=P.useChat(),{aiChatSettings:s}=b.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Rn,{onClick:C.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},St=a.ikp(f.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),On=a.ikp("div",{_id:"aiChatAttachmentsBar"}),xt=t=>{const e={supportedInputs:[]};return!e||!e.supportedInputs?.length?null:n.jsx(S.AttachmentsBarProvider,{children:n.jsx(On,{...t})})},qn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Bt=t=>{const{children:e,...i}=t,r=[];return n.jsx(qn,{children:u.maybeRender(e,r),...i})},Wn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),yt=t=>{const{attachment:e,...i}=t;return n.jsx(D.AttachmentItemProvider,{attachment:e,children:n.jsx(Wn,{...i})})},Nn=a.ikp(T.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Tt=t=>{const{attachment:e}=D.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Nn,{iconSettings:i,...t}):null},Qn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),jt=t=>{const{attachment:e}=D.useAttachmentItem();return n.jsx(Qn,{children:e.title,...t})},Vn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Ht=t=>{const{onClick:e,...i}=t,r=()=>{};return n.jsx(Vn,{"aria-label":"Remove attachment",children:n.jsx(f.CustomIcon,{iconKey:"close"}),onClick:C.composeEventHandlers(e,r),...i})},wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Lt=a.ikp(L.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Dt=a.ikp(L.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(f.CustomIcon,{iconKey:"info"})}),oe=a.ikp(L.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Rt=a.ikp(L.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(oe,{}),"Attachments will be kept in context for the entire conversation."]})}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Ot=t=>{const{children:e,...i}=t,r={supportedInputs:[]};return r?.supportedInputs?n.jsx($n,{children:u.maybeRender(e,r.supportedInputs),...i}):null},Un=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),qt=t=>{const{input:e,onClick:i,...r}=t,s={supportedInputs:[]},o=[],d=()=>{},{selectInput:c,onOpen:m}=S.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Un,{children:e.displayName,onClick:C.composeEventHandlers(i,l),...r})},Kn=a.ikp(E.Root,{_id:"aiChatAttachmentsBar__Modal"}),Wt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=S.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(Kn,{open:s&&d!==null,onOpenChange:C.composeEventHandlers(e,c),...i})},Nt=a.ikp(E.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Qt=a.ikp(E.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Vt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),zn=a.ikp(E.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),$t=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(zn,{children:i,...t})},Gn=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Ut=t=>{const{selectedInput:e}=S.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(Gn,{children:i,...t}):null},Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Kt=t=>{const{children:e,...i}=t,{selectedInput:r}=S.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(Yn,{asChild:!e,children:e||s,...i}):null},zt=a.ikp(E.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(f.CustomIcon,{iconKey:"close"})}),Gt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),Jn=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),Yt=t=>{const{onSubmit:e,...i}=t,{form:r}=S.useAttachmentsBar();return n.jsx(Jn,{onSubmit:C.composeEventHandlers(e,r.onSubmit),...i})},Jt=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),Xn=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),Xt=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(Xn,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},Zn=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),Zt=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(Zn,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":u.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:C.composeEventHandlers(e,r.onChange),...i})},er=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ei=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.title?n.jsx(er,{"aria-live":"polite",children:e.errors.title,...t}):null},ti=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),tr=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),ii=t=>{const{form:e,selectedInput:i}=S.useAttachmentsBar();return n.jsx(tr,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},ir=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ai=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=S.useAttachmentsBar();return n.jsx(ir,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":u.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:C.composeEventHandlers(e,r.onChange),...i,children:n.jsx(Z,{maxRows:10})})},ar=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ni=t=>{const{form:e}=S.useAttachmentsBar();return e.errors.content?n.jsx(ar,{"aria-live":"polite",children:e.errors.content,...t}):null},ri=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),si=a.ikp("div",{_id:"aiChatActionBar"}),oi=a.ikp("div",{_id:"aiChat__ChatActions"}),di=a.ikp("div",{_id:"aiChatTagline__Container"}),ci=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),mi=a.ikp(_a.default,{_id:"aiChatTagline__Logo"}),li=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),nr=a.ikp(L.Trigger,{_id:"aiChat__ChatAction"}),U=t=>{const{action:e,onClick:i,className:r,...s}=t,o={},{clear:d,stop:c,isLoading:m,isStreaming:l,messages:p}=P.useChat(),{conversationId:g}=P.useChat(),{aiChatSettings:v}=b.useInkeepConfig(),[A,B]=J.useCopyToClipboard(),[k]=J.useCopyToClipboard();if({help:!1,copy:p.length===0||!v.isCopyChatButtonVisible||m||l,share:p.length===0||!v.isShareButtonVisible||!g||!!o||m||l,clear:p.length===0||v.isViewOnly||m||l,stop:!m&&!l}[e])return null;const O={help:()=>{},copy:()=>{const ce=p.map(N=>{const G=`**${N.role==="assistant"?"AI Assistant":"User"}**`,Y=u.getMessageContent(N);return`${G}
|
|
6
6
|
|
|
7
7
|
${Y}`}).join(`
|
|
8
8
|
|
|
@@ -354,12 +354,12 @@ const rt = "__intro__", st = a("div", {
|
|
|
354
354
|
), wt = a("span", {
|
|
355
355
|
_id: "aiChatMessageName"
|
|
356
356
|
}), On = (t) => {
|
|
357
|
-
const { message: e } = A();
|
|
357
|
+
const { message: e } = A(), { aiChatSettings: i } = p(), { aiAssistantName: r } = i;
|
|
358
358
|
return /* @__PURE__ */ n(
|
|
359
359
|
wt,
|
|
360
360
|
{
|
|
361
361
|
"data-role": e.role,
|
|
362
|
-
children: e.role === "user" ? "You" : "AI assistant",
|
|
362
|
+
children: e.role === "user" ? "You" : r || "AI assistant",
|
|
363
363
|
...t
|
|
364
364
|
}
|
|
365
365
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.3",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
|
|
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
|
|
|
5
5
|
const a = d(void 0), P = ({ children: e }) => {
|
|
6
6
|
const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion: "0.15.
|
|
8
|
+
widgetLibraryVersion: "0.15.3",
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|