gci-chatbot-ai 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gci-chatbot-ai.js +856 -859
- package/dist/gci-chatbot-ai.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -80,4 +80,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
80
80
|
*
|
|
81
81
|
* This source code is licensed under the ISC license.
|
|
82
82
|
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/const dl=Cn("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),pl={class:"z-[1000] w-fit flex flex-col items-end relative gci-chatbot"},fl={class:"flex items-center justify-between"},gl={key:0,class:"chat-empty-state"},ml={class:"chat-empty-heading"},hl={class:"chat-empty-greeting"},Il={key:0,class:"flex justify-end"},yl={class:"message-user"},vl={key:1,class:"message-assistant"},Ml={key:1,src:xn,alt:"",class:"loading-message"},_l=["disabled"],Nl={class:"chat-actions"},bl={class:"tooltip bg-tooltip-chatbot"},Al={class:"px-[9px] py-[3px] flex-center w-full flex-1"},zl={class:"tooltip-label-bot"},wl=g.defineComponent({__name:"ChatbotComponent",props:{clientId:{type:String,default:""},endpoint:{type:String,default:""},token:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,n=g.ref(""),o=g.ref(!1),s=g.ref(null),i=g.ref(!1),a=g.ref(0),u=g.ref(!0),c=["Ask me anything you're curious about, and I will help you understand it clearly.","Have questions? I’m here to help make things easier.","Need clarity? Let me explain it in simple terms.","I can assist you with anything you're unsure about.","Don't hesitate—I'm just a question away!"],l=new sl({transport:new jn({api:"https://ai-chat-backend.dev02.dtsmart.dev/api/chat",body:{client_id:r.clientId,mcp_token:r.token}})}),d=async _=>{try{if(!n.value.trim())return;const m=n.value.trim();n.value="",i.value=!0,_.preventDefault(),await l.sendMessage({text:m})}catch(m){console.error(m)}finally{i.value=!1}},y=()=>{o.value=!o.value},h=()=>{o.value=!1,l.messages=[]};return g.watch(()=>l.messages,async()=>{var _;await g.nextTick(),(_=s.value)==null||_.scrollTo({top:s.value.scrollHeight,behavior:"smooth"})},{deep:!0}),g.onMounted(()=>{setInterval(()=>{u.value=!1,setTimeout(()=>{a.value=(a.value+1)%(c==null?void 0:c.length),u.value=!0},300)},6e3)}),(_,m)=>{var v;return g.openBlock(),g.createElementBlock(g.Fragment,null,[o.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"bg-[#ffffff00] absolute w-full h-full",onClick:m[0]||(m[0]=b=>o.value=!1)})):g.createCommentVNode("",!0),g.createElementVNode("div",pl,[g.createElementVNode("div",{class:g.normalizeClass(["ai-card chat-popup transition-all duration-7",{"opacity-0":!o.value,"opacity-100":o.value}])},[g.createElementVNode("div",fl,[m[2]||(m[2]=g.createElementVNode("p",{class:"ai-hello"},"Hi, I’m Boko AI",-1)),g.createElementVNode("button",{class:"ai-close",onClick:h},[g.createVNode(g.unref(dl))])]),g.createElementVNode("div",{ref_key:"scrollRef",ref:s,class:"chat-popup-message"},[g.unref(l).messages.length===0?(g.openBlock(),g.createElementBlock("div",gl,[g.createElementVNode("div",ml,[g.createElementVNode("p",hl," Hello "+g.toDisplayString(e.clientId),1),m[3]||(m[3]=g.createElementVNode("p",{class:"chat-empty-title"}," How Can I Help You Today ? ",-1))]),m[4]||(m[4]=g.createElementVNode("p",{class:"chat-empty-description"}," I’m Boko, your friendly assistant. ",-1)),m[5]||(m[5]=g.createElementVNode("p",{class:"chat-empty-description"}," Here to help — anytime you’re ready! ",-1))])):g.createCommentVNode("",!0),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(l).messages,(b,z)=>(g.openBlock(),g.createElementBlock("div",{key:b.id??z,class:"mb-3"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(b==null?void 0:b.parts,(p,T)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:`${b.id}-${p.type}-${T}`},[(p==null?void 0:p.type)==="text"?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[b.role==="user"?(g.openBlock(),g.createElementBlock("div",Il,[g.createElementVNode("div",yl,[g.createElementVNode("div",null,g.toDisplayString(p==null?void 0:p.text),1)])])):(g.openBlock(),g.createElementBlock("div",vl,[g.createElementVNode("div",null,g.toDisplayString(p==null?void 0:p.text),1)]))],64)):g.createCommentVNode("",!0)],64))),128))]))),128)),i.value?(g.openBlock(),g.createElementBlock("img",Ml)):g.createCommentVNode("",!0)],512),g.createElementVNode("form",{onSubmit:d,class:"ai-input-wrap"},[g.withDirectives(g.createElementVNode("input",{class:"ai-input","onUpdate:modelValue":m[1]||(m[1]=b=>n.value=b),placeholder:"Ask me anything…"},null,512),[[g.vModelText,n.value]]),g.createElementVNode("button",{class:"ai-send",disabled:!n.value||((v=n.value)==null?void 0:v.length)==0||i.value},[g.createVNode(g.unref(ll),{class:"w-5 h-5 text-white"})],8,_l)],32)],2),g.
|
|
83
|
+
*/const dl=Cn("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),pl={class:"z-[1000] w-fit flex flex-col items-end relative gci-chatbot"},fl={class:"flex items-center justify-between"},gl={key:0,class:"chat-empty-state"},ml={class:"chat-empty-heading"},hl={class:"chat-empty-greeting"},Il={key:0,class:"flex justify-end"},yl={class:"message-user"},vl={key:1,class:"message-assistant"},Ml={key:1,src:xn,alt:"",class:"loading-message"},_l=["disabled"],Nl={class:"chat-actions"},bl={class:"tooltip bg-tooltip-chatbot"},Al={class:"px-[9px] py-[3px] flex-center w-full flex-1"},zl={class:"tooltip-label-bot"},wl=g.defineComponent({__name:"ChatbotComponent",props:{clientId:{type:String,default:""},endpoint:{type:String,default:""},token:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,n=g.ref(""),o=g.ref(!1),s=g.ref(null),i=g.ref(!1),a=g.ref(0),u=g.ref(!0),c=["Ask me anything you're curious about, and I will help you understand it clearly.","Have questions? I’m here to help make things easier.","Need clarity? Let me explain it in simple terms.","I can assist you with anything you're unsure about.","Don't hesitate—I'm just a question away!"],l=new sl({transport:new jn({api:"https://ai-chat-backend.dev02.dtsmart.dev/api/chat",body:{client_id:r.clientId,mcp_token:r.token}})}),d=async _=>{try{if(!n.value.trim())return;const m=n.value.trim();n.value="",i.value=!0,_.preventDefault(),await l.sendMessage({text:m})}catch(m){console.error(m)}finally{i.value=!1}},y=()=>{o.value=!o.value},h=()=>{o.value=!1,l.messages=[]};return g.watch(()=>l.messages,async()=>{var _;await g.nextTick(),(_=s.value)==null||_.scrollTo({top:s.value.scrollHeight,behavior:"smooth"})},{deep:!0}),g.onMounted(()=>{setInterval(()=>{u.value=!1,setTimeout(()=>{a.value=(a.value+1)%(c==null?void 0:c.length),u.value=!0},300)},6e3)}),(_,m)=>{var v;return g.openBlock(),g.createElementBlock(g.Fragment,null,[o.value?(g.openBlock(),g.createElementBlock("div",{key:0,class:"bg-[#ffffff00] absolute w-full h-full",onClick:m[0]||(m[0]=b=>o.value=!1)})):g.createCommentVNode("",!0),g.createElementVNode("div",pl,[g.createElementVNode("div",{class:g.normalizeClass(["ai-card chat-popup transition-all duration-7",{"opacity-0":!o.value,"opacity-100":o.value}])},[g.createElementVNode("div",fl,[m[2]||(m[2]=g.createElementVNode("p",{class:"ai-hello"},"Hi, I’m Boko AI",-1)),g.createElementVNode("button",{class:"ai-close",onClick:h},[g.createVNode(g.unref(dl))])]),g.createElementVNode("div",{ref_key:"scrollRef",ref:s,class:"chat-popup-message"},[g.unref(l).messages.length===0?(g.openBlock(),g.createElementBlock("div",gl,[g.createElementVNode("div",ml,[g.createElementVNode("p",hl," Hello "+g.toDisplayString(e.clientId),1),m[3]||(m[3]=g.createElementVNode("p",{class:"chat-empty-title"}," How Can I Help You Today ? ",-1))]),m[4]||(m[4]=g.createElementVNode("p",{class:"chat-empty-description"}," I’m Boko, your friendly assistant. ",-1)),m[5]||(m[5]=g.createElementVNode("p",{class:"chat-empty-description"}," Here to help — anytime you’re ready! ",-1))])):g.createCommentVNode("",!0),(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(g.unref(l).messages,(b,z)=>(g.openBlock(),g.createElementBlock("div",{key:b.id??z,class:"mb-3"},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(b==null?void 0:b.parts,(p,T)=>(g.openBlock(),g.createElementBlock(g.Fragment,{key:`${b.id}-${p.type}-${T}`},[(p==null?void 0:p.type)==="text"?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[b.role==="user"?(g.openBlock(),g.createElementBlock("div",Il,[g.createElementVNode("div",yl,[g.createElementVNode("div",null,g.toDisplayString(p==null?void 0:p.text),1)])])):(g.openBlock(),g.createElementBlock("div",vl,[g.createElementVNode("div",null,g.toDisplayString(p==null?void 0:p.text),1)]))],64)):g.createCommentVNode("",!0)],64))),128))]))),128)),i.value?(g.openBlock(),g.createElementBlock("img",Ml)):g.createCommentVNode("",!0)],512),g.createElementVNode("form",{onSubmit:d,class:"ai-input-wrap"},[g.withDirectives(g.createElementVNode("input",{class:"ai-input","onUpdate:modelValue":m[1]||(m[1]=b=>n.value=b),placeholder:"Ask me anything…"},null,512),[[g.vModelText,n.value]]),g.createElementVNode("button",{class:"ai-send",disabled:!n.value||((v=n.value)==null?void 0:v.length)==0||i.value},[g.createVNode(g.unref(ll),{class:"w-5 h-5 text-white"})],8,_l)],32)],2),g.createVNode(g.Transition,{name:"fade-slide"},{default:g.withCtx(()=>[g.createElementVNode("div",Nl,[g.createElementVNode("div",{onClick:y,class:"chat-float"},[...m[6]||(m[6]=[g.createElementVNode("img",{src:Zn,alt:""},null,-1)])]),g.withDirectives(g.createElementVNode("div",{class:"content",onClick:y},[g.createElementVNode("div",bl,[m[7]||(m[7]=g.createElementVNode("span",{class:"tooltip-arrow"},[g.createElementVNode("svg",{width:"15",height:"23",viewBox:"0 0 15 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M14.5547 22.3335V0.000163078L0 9.19624L14.5547 22.3335Z",fill:"currentColor"})])],-1)),m[8]||(m[8]=g.createElementVNode("div",{class:"tooltip-header"},[g.createElementVNode("div",{class:"flex justify-start items-center"},[g.createElementVNode("p",{class:"tooltip-label"},"DigiAI"),g.createElementVNode("span",null,[g.createElementVNode("img",{src:Pn,alt:""})])]),g.createElementVNode("div",{class:"flex justify-start items-center"},[g.createElementVNode("p",{class:"tooltip-label"},"Try Now"),g.createElementVNode("span",null,[g.createElementVNode("svg",{width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[g.createElementVNode("path",{d:"M5.25003 3.82617L8.75 7.32617L5.25 10.8262",stroke:"#9970E2","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})])])])],-1)),g.createElementVNode("div",Al,[g.createElementVNode("p",zl,g.toDisplayString(c[a.value]),1)])])],512),[[g.vShow,u.value&&!o.value]])])]),_:1})])],64)}}});oe.ChatbotComponent=wl,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
|