@blueking/ai-blueking 0.3.25-beta.0 → 0.3.25
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.
|
@@ -21251,8 +21251,6 @@ const V_ = {
|
|
|
21251
21251
|
{ deep: !0 }
|
|
21252
21252
|
)), this.setInputMessage = (o) => {
|
|
21253
21253
|
n.component.exposed.setInputMessage(o);
|
|
21254
|
-
}, this.quickActions = (o, i) => {
|
|
21255
|
-
n.component.exposed.quickActions(o, i);
|
|
21256
21254
|
};
|
|
21257
21255
|
},
|
|
21258
21256
|
mounted() {
|
|
@@ -354,4 +354,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
354
354
|
<i class="ai-blueking-icon ai-blueking-cc-jump-link"></i>
|
|
355
355
|
</a>
|
|
356
356
|
`}),e+="</section>",e};class Ule{constructor(e,n,r,i,o){zs(this,"controllerMap");zs(this,"handleEnd");zs(this,"handleError");zs(this,"handleReceiveMessage");zs(this,"handleStart");zs(this,"url");this.url=e,this.handleStart=n,this.handleReceiveMessage=r,this.handleEnd=i,this.handleError=o,this.controllerMap={}}stop(e){var n,r;return(r=(n=this.controllerMap[e])==null?void 0:n.abort)==null||r.call(n),this.handleEnd(e)}async stream(e,n,r){const i=new AbortController;this.controllerMap[n]=i,fetch(this.url,{method:"post",signal:i.signal,headers:{"Content-Type":"application/json",...r},mode:"cors",credentials:"include",body:JSON.stringify(e)}).then(async o=>{const l=o.body.pipeThrough(new window.TextDecoderStream).getReader();let s="";for(;;)try{const{value:u,done:d}=await l.read();if(!o.ok){this.handleError(u||o.statusText,o.status,n);break}if(d){this.handleEnd(n);break}s+=u,s.toString().split(`
|
|
357
|
-
`).forEach(_=>{const g=_.replace("data:","").trim();if(T4(g)){const{event:m,content:E,cover:S,documents:h,result:v,code:O,message:C}=JSON.parse(g);if(v===!1||o.status!==200){this.handleError(C,O,n);return}switch(m){case"text":this.handleReceiveMessage(E,n);break;case"reference_doc":const k=kle(h);this.handleReceiveMessage(k,n);break;case"done":this.handleEnd(n,S?E:"");break;case"error":this.handleError(C,O,n);break}}else s=_})}catch(u){(u==null?void 0:u.code)!==20&&this.handleError(u.message,u.code,n);break}}).catch(o=>{(o==null?void 0:o.code)!==20&&this.handleError(o.message,o.code,n)}),await this.handleStart(n)}}d6({prefix:"ai-blueking"});const Fle={name:"AiBlueking",render(t){return t("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:JI,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>Bp,type:Array},enablePopup:{default:!0,type:Boolean}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const t=document.querySelector(".ai-blueking-messages");(t==null?void 0:t.scrollTop)+(t==null?void 0:t.clientHeight)+100>=(t==null?void 0:t.scrollHeight)&&(t.scrollTop=t.scrollHeight)},10)},deep:!0}},created(){const t=this.$emit.bind(this);let e=null,n=null;const r=this;this.app=Fp({render(){return e=this,n=Zt(Ple,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,enablePopup:r.enablePopup,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onStop(){t("stop",...arguments)},onScrollLoad(){t("scroll-load",...arguments)},onAiClick(){t("ai-click",...arguments)},onChangePrompt(){t("change-prompt",...arguments)},"onUpdate:model"(){t("update:model",...arguments)},"onUpdate:isShow"(){t("update:isShow",...arguments),t("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(i=>this.$watch(i,()=>{e.$forceUpdate()},{deep:!0})),this.setInputMessage=i=>{n.component.exposed.setInputMessage(i)}
|
|
357
|
+
`).forEach(_=>{const g=_.replace("data:","").trim();if(T4(g)){const{event:m,content:E,cover:S,documents:h,result:v,code:O,message:C}=JSON.parse(g);if(v===!1||o.status!==200){this.handleError(C,O,n);return}switch(m){case"text":this.handleReceiveMessage(E,n);break;case"reference_doc":const k=kle(h);this.handleReceiveMessage(k,n);break;case"done":this.handleEnd(n,S?E:"");break;case"error":this.handleError(C,O,n);break}}else s=_})}catch(u){(u==null?void 0:u.code)!==20&&this.handleError(u.message,u.code,n);break}}).catch(o=>{(o==null?void 0:o.code)!==20&&this.handleError(o.message,o.code,n)}),await this.handleStart(n)}}d6({prefix:"ai-blueking"});const Fle={name:"AiBlueking",render(t){return t("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:JI,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>Bp,type:Array},enablePopup:{default:!0,type:Boolean}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const t=document.querySelector(".ai-blueking-messages");(t==null?void 0:t.scrollTop)+(t==null?void 0:t.clientHeight)+100>=(t==null?void 0:t.scrollHeight)&&(t.scrollTop=t.scrollHeight)},10)},deep:!0}},created(){const t=this.$emit.bind(this);let e=null,n=null;const r=this;this.app=Fp({render(){return e=this,n=Zt(Ple,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,enablePopup:r.enablePopup,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onStop(){t("stop",...arguments)},onScrollLoad(){t("scroll-load",...arguments)},onAiClick(){t("ai-click",...arguments)},onChangePrompt(){t("change-prompt",...arguments)},"onUpdate:model"(){t("update:model",...arguments)},"onUpdate:isShow"(){t("update:isShow",...arguments),t("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(i=>this.$watch(i,()=>{e.$forceUpdate()},{deep:!0})),this.setInputMessage=i=>{n.component.exposed.setInputMessage(i)}},mounted(){var t;(t=this.app)==null||t.mount(this.$el)},beforeDestroy(){var t;this.unWatchStack.forEach(e=>e==null?void 0:e()),(t=this.app)==null||t.unmount()}};return zr.ChatHelper=Ule,zr.MessageStatus=Cd,zr.RoleType=JT,zr.default=Fle,Object.defineProperties(zr,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),zr}({});
|
|
@@ -273,4 +273,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
273
273
|
<i class="ai-blueking-icon ai-blueking-cc-jump-link"></i>
|
|
274
274
|
</a>
|
|
275
275
|
`}),t+="</section>",t};class o9{constructor(t,n,r,o,i){Pr(this,"controllerMap");Pr(this,"handleEnd");Pr(this,"handleError");Pr(this,"handleReceiveMessage");Pr(this,"handleStart");Pr(this,"url");this.url=t,this.handleStart=n,this.handleReceiveMessage=r,this.handleEnd=o,this.handleError=i,this.controllerMap={}}stop(t){var n,r;return(r=(n=this.controllerMap[t])==null?void 0:n.abort)==null||r.call(n),this.handleEnd(t)}async stream(t,n,r){const o=new AbortController;this.controllerMap[n]=o,fetch(this.url,{method:"post",signal:o.signal,headers:{"Content-Type":"application/json",...r},mode:"cors",credentials:"include",body:JSON.stringify(t)}).then(async i=>{const l=i.body.pipeThrough(new window.TextDecoderStream).getReader();let a="";for(;;)try{const{value:s,done:c}=await l.read();if(!i.ok){this.handleError(s||i.statusText,i.status,n);break}if(c){this.handleEnd(n);break}a+=s,a.toString().split(`
|
|
276
|
-
`).forEach(d=>{const v=d.replace("data:","").trim();if(cm(v)){const{event:f,content:b,cover:g,documents:k,result:h,code:E,message:T}=JSON.parse(v);if(h===!1||i.status!==200){this.handleError(T,E,n);return}switch(f){case"text":this.handleReceiveMessage(b,n);break;case"reference_doc":const G=r9(k);this.handleReceiveMessage(G,n);break;case"done":this.handleEnd(n,g?b:"");break;case"error":this.handleError(T,E,n);break}}else a=d})}catch(s){(s==null?void 0:s.code)!==20&&this.handleError(s.message,s.code,n);break}}).catch(i=>{(i==null?void 0:i.code)!==20&&this.handleError(i.message,i.code,n)}),await this.handleStart(n)}}XM({prefix:"ai-blueking"});const i9={name:"AiBlueking",render(e){return e("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:Vu,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>xa,type:Array},enablePopup:{default:!0,type:Boolean}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const e=document.querySelector(".ai-blueking-messages");(e==null?void 0:e.scrollTop)+(e==null?void 0:e.clientHeight)+100>=(e==null?void 0:e.scrollHeight)&&(e.scrollTop=e.scrollHeight)},10)},deep:!0}},created(){const e=this.$emit.bind(this);let t=null,n=null;const r=this;this.app=p.createApp({render(){return t=this,n=p.h(n9,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,enablePopup:r.enablePopup,onClear(){e("clear",...arguments)},onClose(){e("close",...arguments)},onSend(){e("send",...arguments)},onChoosePrompt(){e("choose-prompt",...arguments)},onStop(){e("stop",...arguments)},onScrollLoad(){e("scroll-load",...arguments)},onAiClick(){e("ai-click",...arguments)},onChangePrompt(){e("change-prompt",...arguments)},"onUpdate:model"(){e("update:model",...arguments)},"onUpdate:isShow"(){e("update:isShow",...arguments),e("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(o=>this.$watch(o,()=>{t.$forceUpdate()},{deep:!0})),this.setInputMessage=o=>{n.component.exposed.setInputMessage(o)}
|
|
276
|
+
`).forEach(d=>{const v=d.replace("data:","").trim();if(cm(v)){const{event:f,content:b,cover:g,documents:k,result:h,code:E,message:T}=JSON.parse(v);if(h===!1||i.status!==200){this.handleError(T,E,n);return}switch(f){case"text":this.handleReceiveMessage(b,n);break;case"reference_doc":const G=r9(k);this.handleReceiveMessage(G,n);break;case"done":this.handleEnd(n,g?b:"");break;case"error":this.handleError(T,E,n);break}}else a=d})}catch(s){(s==null?void 0:s.code)!==20&&this.handleError(s.message,s.code,n);break}}).catch(i=>{(i==null?void 0:i.code)!==20&&this.handleError(i.message,i.code,n)}),await this.handleStart(n)}}XM({prefix:"ai-blueking"});const i9={name:"AiBlueking",render(e){return e("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:Vu,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>xa,type:Array},enablePopup:{default:!0,type:Boolean}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const e=document.querySelector(".ai-blueking-messages");(e==null?void 0:e.scrollTop)+(e==null?void 0:e.clientHeight)+100>=(e==null?void 0:e.scrollHeight)&&(e.scrollTop=e.scrollHeight)},10)},deep:!0}},created(){const e=this.$emit.bind(this);let t=null,n=null;const r=this;this.app=p.createApp({render(){return t=this,n=p.h(n9,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,enablePopup:r.enablePopup,onClear(){e("clear",...arguments)},onClose(){e("close",...arguments)},onSend(){e("send",...arguments)},onChoosePrompt(){e("choose-prompt",...arguments)},onStop(){e("stop",...arguments)},onScrollLoad(){e("scroll-load",...arguments)},onAiClick(){e("ai-click",...arguments)},onChangePrompt(){e("change-prompt",...arguments)},"onUpdate:model"(){e("update:model",...arguments)},"onUpdate:isShow"(){e("update:isShow",...arguments),e("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(o=>this.$watch(o,()=>{t.$forceUpdate()},{deep:!0})),this.setInputMessage=o=>{n.component.exposed.setInputMessage(o)}},mounted(){var e;(e=this.app)==null||e.mount(this.$el)},beforeDestroy(){var e;this.unWatchStack.forEach(t=>t==null?void 0:t()),(e=this.app)==null||e.unmount()}};lt.ChatHelper=o9,lt.MessageStatus=ya,lt.RoleType=Su,lt.default=i9,Object.defineProperties(lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|