@szjy/ai-coms 0.1.5 → 0.1.7

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/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E["szjy-ai-coms"]={},E.Vue))})(this,function(E,e){"use strict";const Y="/images/ai-round.png",Z="/images/ai-sqrt.png",G="/images/bars-loading.svg";function $(n){return n.startsWith("http://")||n.startsWith("https://")?n:`${location.protocol}//${location.host}${n}`}async function ee(n,r,s,l=""){const o=$(l),t=new URL(`${o}/v1/chat/completions`),c=new Request(t,{method:"post",headers:{"Content-Type":"application/json",Authorization:"Bearer app-oLZVFFdYyJX2QK3rdOLWsC2u"},body:JSON.stringify({model:"dify",stream:!0,inputs:{token:r},messages:[{role:"system",content:"你是一个专业的AI助手,请用中文回答问题。"},{role:"user",content:n}]})});return fetch(c)}async function te(n){const r=new URL("http://localhost:11434/api/chat"),s={};Object.keys(s).forEach(o=>{r.searchParams.append(o,s[o])});const l=new Request(r,{mode:"cors",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"llama3",stream:!0,messages:[{role:"system",content:"全程使用中文回答问题。"},{role:"user",content:n}]})});return fetch(l)}async function ne(n,r){const s=new URL(`${location.origin}/spark/v1/chat/completions`),l={};Object.keys(l).forEach(t=>{s.searchParams.append(t,l[t])});const o=new Request(s,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"generalv4.0Ultra",stream:!0,messages:[{role:"user",content:n}]})});return fetch(o)}async function re(n,r){const s=new URL(`${location.origin}/siliconflow/v1/chat/completions`),l={};Object.keys(l).forEach(t=>{s.searchParams.append(t,l[t])});const o=new Request(s,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"Qwen/Qwen1.5-110B-Chat",stream:!0,messages:[{role:"user",content:n}]})});return fetch(o)}async function oe(n,r){const s=new URL(`${location.origin}/moonshot/v1/chat/completions`),l={};Object.keys(l).forEach(t=>{s.searchParams.append(t,l[t])});const o=new Request(s,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"moonshot-v1-8k",stream:!0,messages:[{role:"system",content:"你是 Kimi,由 Moonshot AI 提供的人工智能助手,你更擅长中文和英文的对话。你会为用户提供安全,有帮助,准确的回答。同时,你会拒绝一切涉及恐怖主义,种族歧视,黄色暴力等问题的回答。Moonshot AI 为专有名词,不可翻译成其他语言。"},{role:"user",content:n}]})});return fetch(o)}async function ae(n,r){const s=new URL(`${location.origin}/dashscope/compatible-mode/v1/chat/completions`),l={};Object.keys(l).forEach(t=>{s.searchParams.append(t,l[t])});const o=new Request(s,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"qwq-32b-preview",stream:!0,messages:[{role:"system",content:"全程使用中文回答问题"},{role:"user",content:n}]})});return fetch(o)}async function se(n,r,s,l=""){const o=$(l),t=new URL(`${o}/support/${s}/a`),c={};Object.keys(c).forEach(g=>{t.searchParams.append(g,c[g])});const m=new Request(t,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({content:n})});return fetch(m)}const le=n=>{if(n.startsWith("data:")){const r=n.substring(5).trim();if(r==="[DONE]")return{done:!0};try{return JSON.parse(r)}catch(s){console.error("JSON parsing error:",s)}}return null},U=[{label:"模拟数据模型",modelName:"standard",api:null},{label:"Spark 星火大模型",modelName:"spark",api:ne},{label:"Ollama 3 大模型",modelName:"ollama3",api:te},{label:"SiliconFlow 硅基流动大模型",modelName:"siliconflow",api:re},{label:"Kimi Moonshot 月之暗面大模型",modelName:"moonshot",api:oe},{label:"通义千问大模型",modelName:"dashscope",api:ae},{label:"数智建管大模型",modelName:"szjy",api:se},{label:"Dify (OpenAI 兼容)",modelName:"dify-openai",api:ee}],M={standard(n,r){let s="";return n instanceof Uint8Array?s=r.decode(n,{stream:!0}):s=n,{content:s}},spark(n){const r=le(n);return r.done?{done:!0}:{content:r.choices[0].delta.content||""}},siliconflow(n){return this.spark(n)},moonshot(n){return this.spark(n)},dashscope(n){return this.spark(n)},szjy(n){return this.spark(n)},"dify-openai"(n){return this.spark(n)},ollama3(n){return{content:JSON.parse(n).message.content}}},q=(n,r,s)=>{const l=n.split(s);return l.slice(0,-1).forEach(o=>{o.trim()!==""&&r.enqueue(o)}),l[l.length-1]},ie=n=>{let r="";return new TransformStream({transform(s,l){if(r+=s,r.trim().startsWith("data:"))r=q(r,l,n);else try{JSON.parse(r),r=q(r,l,n)}catch{l.enqueue(s),r=""}},flush(s){r.trim()!==""&&s.enqueue(r)}})};async function ce(n,r){const s=n.api;return s?new Promise(l=>{s(r.text,r.token,r.identifier,r.baseUrl).then(o=>{if(o.body){const t=o.body.pipeThrough(new TextDecoderStream).pipeThrough(ie(`
2
- `)).getReader();console.log("reader from response:",t),l({error:0,reader:t})}else l({error:1,reader:null})}).catch(o=>{l({error:1,reader:null})})}):{error:1,reader:null}}let j=null;function de(){return j||(window.markdownit?j=new window.markdownit({html:!0,linkify:!0,typographer:!0}):console.log("markdownit is not loaded"),j)}const F=(n,r)=>{const s=n.__vccOpts||n;for(const[l,o]of r)s[l]=o;return s},ue=["src","alt"],I=F({__name:"SvgIcon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:16},color:{type:String,default:""},className:{type:String,default:""},basePath:{type:String,default:"/icons/"}},setup(n){const r=n,s=e.computed(()=>{if(r.name.startsWith("http://")||r.name.startsWith("https://")||r.name.startsWith("/"))return r.name;const t=r.name.endsWith(".svg")?r.name:`${r.name}.svg`;return`${r.basePath}${t}`}),l=e.computed(()=>{const t=typeof r.size=="number"?`${r.size}px`:r.size;return{width:t,height:t,display:"inline-flex",justifyContent:"center",alignItems:"center"}}),o=e.computed(()=>{const t={width:"100%",height:"100%"};return r.color&&(t.filter=`drop-shadow(0 0 0 ${r.color})`),t});return(t,c)=>(e.openBlock(),e.createElementBlock("div",{class:"svg-icon-wrapper",style:e.normalizeStyle(l.value)},[e.createElementVNode("img",{src:s.value,alt:n.name,class:e.normalizeClass(["svg-icon",n.className]),style:e.normalizeStyle(o.value)},null,14,ue)],4))}},[["__scopeId","data-v-490b11c1"]]),fe=async n=>{if(navigator.clipboard&&navigator.permissions)await navigator.clipboard.writeText(n);else{const r=document.createElement("textArea");r.value=n,r.style.width=0,r.style.position="fixed",r.style.left="-999px",r.style.top="10px",r.setAttribute("readonly","readonly"),document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)}},me=["innerHTML"],pe={__name:"Previewer",props:{reader:null,model:"szjy",scrollToBottomFn:null,displayText:"",messagePostRender:{type:Function,default:null}},emits:["failed","completed","updating"],setup(n,{expose:r,emit:s}){const{appContext:l}=e.getCurrentInstance(),{$message:o}=l.config.globalProperties,t=n,c=e.ref(t.displayText||""),m=e.ref(""),g=e.ref(!0),w=e.ref(!1),N=e.ref(!!t.displayText),z=s,T=e.ref(null);let C=null;const L=e.computed(()=>j?j.render(c.value):c.value),P=()=>{t.reader&&t.reader.cancel(),w.value=!0,d.value=!1,f(),N.value=!0,z("completed",c.value),g.value=!1,C&&(cancelAnimationFrame(C),C=null)},V=e.computed(()=>`${L.value}`),p=e.ref(!1),u=()=>{p.value=!0},f=()=>{p.value=!1},d=e.ref(!1),i=async()=>{if(!t.reader)return;const k=new TextDecoder("utf-8");for(g.value=!0;!w.value;)try{if(!t.reader){d.value=!0;break}const{value:a,done:b}=await t.reader.read();if(!t.reader){d.value=!0;break}if(b){d.value=!0;break}const x=M[t.model];if(!x)break;const R=x.call(M,a,k);if(R.done){d.value=!0;break}m.value+=R.content,C===null&&S()}catch(a){d.value=!0,console.log(3333,a),z("failed",a),P();break}finally{f()}},h=async()=>{t.scrollToBottomFn&&t.scrollToBottomFn()},y=(k=()=>{},a=()=>{})=>{if(m.value.length>0){const b=m.value.substring(0,10);c.value+=b,m.value=m.value.substring(10),k()}else a()},S=()=>{if(w.value&&C){cancelAnimationFrame(C),C=null,g.value=!1;return}d.value?y(()=>{C=requestAnimationFrame(S),z("updating",null)},()=>{z("completed",c.value),g.value=!1,N.value=!0,e.nextTick(()=>{if(d.value=!1,t.messagePostRender&&T.value)try{t.messagePostRender(T.value,c.value)}catch(k){console.error("messagePostRender 执行失败:",k)}}),C=null}):(y(),C=requestAnimationFrame(S)),h()};e.watch(()=>t.reader,()=>{t.reader&&i()},{immediate:!0,deep:!0}),e.onUnmounted(()=>{P()}),r({abortReader:P,initializeStart:u,initializeEnd:f}),e.computed(()=>p.value?!0:(!t.reader||!g||c.value,!1));const v=async()=>{try{const k=c.value;await fe(k),o.success("复制成功")}catch(k){console.error("复制失败:",k),o.error("复制失败")}};return(k,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"fade"},{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"refWrapperContent",ref:T,"text-16":"",class:"w-full h-full overflow-y-auto relative","p-24px":""},[e.createElementVNode("div",{class:"markdown-wrapper",innerHTML:V.value},null,8,me),N.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ai-copy-btn-wrapper",onClick:v},[e.createVNode(I,{name:"/images/svg/copy.svg",color:"#666666"}),a[0]||(a[0]=e.createElementVNode("span",{class:"copy-text"},"复制",-1))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)]),_:1}))}},he={class:"panel-header"},ye={class:"header-actions"},ge={class:"header-title"},be={class:"action-icons"},ke={class:"body-content"},we={key:0,class:"welcome-content"},ve={class:"subtitle"},Se={class:"highlight"},xe={class:"quick-questions"},Ne=["onClick"],Ce={key:1,class:"message-content user-content"},_e={class:"panel-footer"},Ee={key:0,src:G,alt:"加载中",class:"loading-icon"},Te={class:"input-box"},Re=["src"],Ve={__name:"ChatPanel",props:{modelValue:{type:Boolean,default:!1},token:{type:String,default:""},identifier:{type:String,default:""},baseUrl:{type:String,default:""},title:{type:String,default:"数智AI助理"},llmName:{type:String,default:"szjy"},messagePostRender:{type:Function,default:null}},emits:["update:modelValue","submit"],setup(n,{emit:r}){const{appContext:s}=e.getCurrentInstance(),{$message:l}=s.config.globalProperties,o=n,t=e.computed(()=>U.find(a=>a.modelName===o.llmName)??U.find(a=>a.modelName==="szjy")),c=r,m=e.ref(""),g=e.ref(null),w=e.ref(!1),N=e.ref([]),z=e.ref(["什么是AI助理,能做什么?","当前项目的基本情况?","当前项目的进度情况?","当前项目的参建方有哪些?","数智建管平台有哪些功能?能做什么?"]),T=e.ref([]),C=e.ref(!1),L=e.ref(null),P=()=>{e.nextTick(()=>{if(L.value){const a=L.value,b=a.scrollHeight,x=a.scrollTop,R=a.clientHeight;b-x-R<100?a.scrollTop=b:a.scrollTo({top:b})}})},V=e.ref(!1),p=e.computed(()=>V.value?"/images/ai-stop.png":"/images/ai-send.png"),u=(a,b)=>{console.log("onFailedReader",a,b),C.value=!1;const x=v();x&&x.initializeEnd(),l.error("转换失败,请重试"),V.value=!1,setTimeout(()=>{g.value&&g.value.focus()})},f=(a,b)=>{C.value=!1,V.value=!1,P(),b&&N.value[a]&&(N.value[a].displayText=b),setTimeout(()=>{g.value&&g.value.focus()})},d=a=>{V.value=!0},i=()=>{V.value=!1,c("update:modelValue",!1),w.value=!1,N.value=[]},h=e.ref(!1),y=()=>{h.value=!h.value},S=a=>{m.value=a,k()},v=()=>{for(let a=T.value.length-1;a>=0;a--)if(T.value[a])return T.value[a];return null},k=async()=>{if(console.log("stylizingLoading:",C.value),C.value){const _=v();console.log("lastPreviewer:",_),_&&(console.log("abortReader"),_.abortReader());return}if(!m.value.trim()){console.log("no input, return"),g.value.focus();return}N.value.push({type:"user",content:m.value}),V.value=!0,w.value=!0,c("submit",m.value),P();const a=m.value;m.value="";const b=N.value.length;T.value[b]&&T.value[b].initializeStart(),C.value=!0,N.value.push({type:"ai"});const{error:x,reader:R}=await ce(t.value,{text:a,token:o.token,identifier:o.identifier,baseUrl:o.baseUrl});if(x){console.log(45455,x),u(b,x);return}R&&(N.value[b].reader=R)};return(a,b)=>{const x=e.resolveComponent("el-icon"),R=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(e.Transition,{name:"slide"},{default:e.withCtx(()=>[n.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ai-panel",{"drawer-mode":h.value}])},[e.createElementVNode("div",he,[e.createElementVNode("div",ye,[e.createElementVNode("div",ge,e.toDisplayString(n.title),1),e.createElementVNode("div",be,[e.createVNode(x,{class:"action-icon",onClick:y},{default:e.withCtx(()=>[e.createVNode(I,{name:"/images/svg/drawer-layout.svg",color:"#999999"})]),_:1}),e.createVNode(x,{class:"action-icon",onClick:i},{default:e.withCtx(()=>[e.createVNode(I,{name:"/images/svg/close.svg",color:"#999999"})]),_:1})])])]),e.createElementVNode("div",ke,[w.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"chat-messages",ref_key:"messageContainerRef",ref:L},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(_,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:e.normalizeClass(["message-item",_.type==="user"?"user-message":"ai-message"])},[_.type==="ai"?(e.openBlock(),e.createBlock(pe,{key:0,ref_for:!0,ref:B=>T.value[O]=B,reader:_.reader,"onUpdate:reader":B=>_.reader=B,model:o.llmName,displayText:_.displayText,scrollToBottomFn:P,messagePostRender:n.messagePostRender,onFailed:B=>u(O,B),onCompleted:B=>f(O,B),onUpdating:()=>d()},null,8,["reader","onUpdate:reader","model","displayText","messagePostRender","onFailed","onCompleted","onUpdating"])):(e.openBlock(),e.createElementBlock("div",Ce,e.toDisplayString(_.content),1))],2))),128))],512)):(e.openBlock(),e.createElementBlock("div",we,[b[2]||(b[2]=e.createElementVNode("div",{class:"title"},[e.createElementVNode("img",{src:Z,alt:"AI助手",class:"panel-icon"}),e.createElementVNode("h3",{class:"title-text"},"Hi, 您好")],-1)),e.createElementVNode("div",ve,[b[1]||(b[1]=e.createTextVNode(" 我是",-1)),e.createElementVNode("span",Se,e.toDisplayString(n.title),1)]),e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,(_,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"question-item",onClick:B=>S(_)},[e.createElementVNode("span",null,e.toDisplayString(_),1),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(I,{name:"/images/svg/arrow-right.svg",color:"#999999"})]),_:1})],8,Ne))),128))])]))]),e.createElementVNode("div",_e,[V.value?(e.openBlock(),e.createElementBlock("img",Ee)):e.createCommentVNode("",!0),e.createElementVNode("div",Te,[e.createVNode(R,{modelValue:m.value,"onUpdate:modelValue":b[0]||(b[0]=_=>m.value=_),ref_key:"refInputTextString",ref:g,placeholder:"请输入您的问题",autofocus:"",onKeyup:e.withKeys(k,["enter"])},{append:e.withCtx(()=>[e.createElementVNode("div",{class:"send-icon-box",onClick:k},[e.createElementVNode("img",{src:p.value,alt:"发送",class:"send-icon"},null,8,Re)])]),_:1},8,["modelValue"])])])],2)):e.createCommentVNode("",!0)]),_:1})}}};var D={exports:{}};(function(n,r){(function(s,l){n.exports=l()})(window,function(){return function(s){var l={};function o(t){if(l[t])return l[t].exports;var c=l[t]={i:t,l:!1,exports:{}};return s[t].call(c.exports,c,c.exports,o),c.l=!0,c.exports}return o.m=s,o.c=l,o.d=function(t,c,m){o.o(t,c)||Object.defineProperty(t,c,{enumerable:!0,get:m})},o.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,c){if(1&c&&(t=o(t)),8&c||4&c&&typeof t=="object"&&t&&t.__esModule)return t;var m=Object.create(null);if(o.r(m),Object.defineProperty(m,"default",{enumerable:!0,value:t}),2&c&&typeof t!="string")for(var g in t)o.d(m,g,(function(w){return t[w]}).bind(null,g));return m},o.n=function(t){var c=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(c,"a",c),c},o.o=function(t,c){return Object.prototype.hasOwnProperty.call(t,c)},o.p="",o(o.s=0)}([function(s,l,o){function t(p,u,f,d){f.push(p),d.push([].concat(u[p]||[]))}function c(p,u){if(!p)throw new Error("[getMaxDepsChain] dep 参数不能为空");var f=[],d=[],i=[];for(t(p,u,d,i);d.length;){var h=i.pop();if(h&&h.length){var y=h.shift();if(i.push(h),~d.indexOf(y))throw new Error("[getMaxDepsChain][loop] 存在循环依赖,请检查依赖关系; nextName: "+y+", mainStack: "+d);t(y,u,d,i)}else f.push([].concat(d)),d.pop()}return f.reduce(function(S,v){return v.length>S.length?v:S},[])}function m(p){if(!p)throw new Error("[depsParser] 入参不能为空");var u={};p.forEach(function(d){u[d.name]=d.deps||[]});var f=[];return p.forEach(function(d){var i=c(d.name,u).length-1;d.priority=i,f[i]=(f[i]||[]).concat(d)}),f}o.r(l),o.d(l,"loadScript",function(){return T}),o.d(l,"loadScripts",function(){return C}),o.d(l,"dynamicLoadScripts",function(){return L}),o.d(l,"createScriptsLoadIterator",function(){return P}),o.d(l,"loadScriptsQueue",function(){return V}),o.d(l,"getMaxDepsChain",function(){return c}),o.d(l,"depsParser",function(){return m});var g=function(){return(g=Object.assign||function(p){for(var u,f=1,d=arguments.length;f<d;f++)for(var i in u=arguments[f])Object.prototype.hasOwnProperty.call(u,i)&&(p[i]=u[i]);return p}).apply(this,arguments)},w=function(p,u,f,d){return new(f||(f=Promise))(function(i,h){function y(k){try{v(d.next(k))}catch(a){h(a)}}function S(k){try{v(d.throw(k))}catch(a){h(a)}}function v(k){var a;k.done?i(k.value):(a=k.value,a instanceof f?a:new f(function(b){b(a)})).then(y,S)}v((d=d.apply(p,[])).next())})},N=function(p,u){var f,d,i,h,y={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return h={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function S(v){return function(k){return function(a){if(f)throw new TypeError("Generator is already executing.");for(;y;)try{if(f=1,d&&(i=2&a[0]?d.return:a[0]?d.throw||((i=d.return)&&i.call(d),0):d.next)&&!(i=i.call(d,a[1])).done)return i;switch(d=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return y.label++,{value:a[1],done:!1};case 5:y.label++,d=a[1],a=[0];continue;case 7:a=y.ops.pop(),y.trys.pop();continue;default:if(i=y.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){y=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){y.label=a[1];break}if(a[0]===6&&y.label<i[1]){y.label=i[1],i=a;break}if(i&&y.label<i[2]){y.label=i[2],y.ops.push(a);break}i[2]&&y.ops.pop(),y.trys.pop();continue}a=u.call(p,y)}catch(b){a=[6,b],d=0}finally{f=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([v,k])}}},z=function(p){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u,f=p[Symbol.asyncIterator];return f?f.call(p):(p=typeof __values=="function"?__values(p):p[Symbol.iterator](),u={},d("next"),d("throw"),d("return"),u[Symbol.asyncIterator]=function(){return this},u);function d(i){u[i]=p[i]&&function(h){return new Promise(function(y,S){(function(v,k,a,b){Promise.resolve(b).then(function(x){v({value:x,done:a})},k)})(y,S,(h=p[i](h)).done,h.value)})}}};function T(p,u){return u===void 0&&(u=!1),new Promise(function(f,d){var i=u?document.head:document.body,h=document.createElement("script");h.type="text/javascript",h.src=p,h.crossOrigin="anonymous",h.onreadystatechange=f,h.onload=f,h.onerror=d,i.appendChild(h)})}var C=function(p,u){return u===void 0&&(u={}),w(void 0,void 0,void 0,function(){var f,d,i,h,y;return N(this,function(S){switch(S.label){case 0:return f=u.baseUrl,d=f===void 0?"":f,i=u.lastLoadResult,h=u.inHead,y=h!==void 0&&h,[4,Promise.all(p.map(function(v){return w(void 0,void 0,void 0,function(){var k,a,b,x,R,_,O,B;return N(this,function(X){switch(X.label){case 0:return k=v.name,a=v.path,b=v.deps,(O={})[k]=!0,x=O,(B={})[k]=!1,R=B,window[k]?[2,x]:[3,1];case 1:return _=!0,b&&i&&[].concat(b).forEach(function(qe){i[qe]!==!1&&(_=!0)}),_?[4,T(a.indexOf("http")===0||a.indexOf("//:")===0?a:d+a,y).then(function(){return x}).catch(function(){return R})]:[3,3];case 2:return[2,X.sent()];case 3:return[2,R]}})})}))];case 1:return[2,S.sent()]}})})},L=function(p,u){return u===void 0&&(u={}),function(){var f=[].concat(m(p));return{next:function(){if(f.length){var d=f.shift();return C(d,u).then(function(i){return{value:i,done:!1}})}return Promise.resolve({done:!0})}}}},P=function(p,u){var f;return u===void 0&&(u={}),(f={})[Symbol.asyncIterator]=L(p,u),f},V=function(p,u){return u===void 0&&(u={}),w(void 0,void 0,void 0,function(){var f,d,i,h,y,S;return N(this,function(v){switch(v.label){case 0:v.trys.push([0,5,6,11]),f=z(P(p,u)),v.label=1;case 1:return[4,f.next()];case 2:if((d=v.sent()).done)return[3,4];i=d.value,u.lastLoadResult=u.lastLoadResult||{},console.log("current load: ",i),i.forEach(function(k){u.lastLoadResult=g(g({},u.lastLoadResult),k)}),v.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return h=v.sent(),y={error:h},[3,11];case 6:return v.trys.push([6,,9,10]),d&&!d.done&&(S=f.return)?[4,S.call(f)]:[3,8];case 7:v.sent(),v.label=8;case 8:return[3,10];case 9:if(y)throw y.error;return[7];case 10:return[7];case 11:return[2,u.lastLoadResult]}})})}}])})})(D);var Be=D.exports;const Pe={key:0,class:"ai-assistant"},Oe={name:"AiChat"},ze=e.defineComponent({...Oe,props:{token:{type:String,default:""},identifier:{type:String,default:""},baseUrl:{type:String,default:""},title:{type:String,default:"数智AI助理"},llmName:{type:String,default:"szjy"},messagePostRender:{type:Function,default:null}},setup(n){const r=e.ref(!1),s=e.ref(!1),l=()=>{r.value=!r.value},o=()=>{s.value=!0,r.value=!1},t=g=>{console.log("用户输入:",g)},c=[{name:"markdownit",path:"markdown-it.min.js"},{name:"hljs",path:"highlight.11.11.1.min.js"}];let m={};return Be.loadScriptsQueue(c,{baseUrl:"/scripts/ai/",lastLoadResult:m,inHead:!1}).then(g=>{if(console.log("load ai deps: ",g),window.markdownit){const w=window.markdownit();console.log("markdownit: ",w),de()}}),(g,w)=>s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Pe,[e.createVNode(Ve,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=N=>r.value=N),onSubmit:t,token:n.token,identifier:n.identifier,baseUrl:n.baseUrl,title:n.title,llmName:n.llmName,messagePostRender:n.messagePostRender},null,8,["modelValue","token","identifier","baseUrl","title","llmName","messagePostRender"]),e.createElementVNode("div",{class:"ai-icon",onClick:l},[e.createElementVNode("div",{class:"close-icon",onClick:e.withModifiers(o,["stop"])},[...w[1]||(w[1]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"8",height:"8"},[e.createElementVNode("path",{d:"M512 456.310154L94.247385 38.557538a39.384615 39.384615 0 0 0-55.689847 55.689847L456.310154 512 38.557538 929.752615a39.384615 39.384615 0 0 0 55.689847 55.689847L512 567.689846l417.752615 417.752616c15.163077 15.163077 40.526769 15.163077 55.689847 0s15.163077-40.526769 0-55.689847L567.689846 512l417.752616-417.752615a39.384615 39.384615 0 0 0-55.689847-55.689847L512 456.310154z",fill:"currentColor"})],-1)])]),w[2]||(w[2]=e.createElementVNode("img",{src:Y,alt:"AI助手"},null,-1)),w[3]||(w[3]=e.createElementVNode("span",{class:"ai-icon-text"},"AI助手",-1))])]))}}),W=F(ze,[["__scopeId","data-v-9d212a48"]]),J=Object.freeze(Object.defineProperty({__proto__:null,SzAiChat:W},Symbol.toStringTag,{value:"Module"})),A=function(n){if(!A.installed){A.installed=!0;for(let r in J){const s=Reflect.get(J,r);n.component(s.name,s)}}},Le=n=>{console.log(`点击了路由链接: ${n}`)},je={color:"#536fec",fontWeight:"bold",textDecoration:"underline",cursor:"pointer",padding:"0 3px"},H=n=>{const r=/#router:([^#]+)#/g,s=[];let l=0,o;for(;(o=r.exec(n))!==null;){o.index>l&&s.push({text:n.substring(l,o.index)});const t=o[1];s.push({text:t,routeName:t}),l=r.lastIndex}return l<n.length&&s.push({text:n.substring(l)}),s},Q=(n,r,s={})=>{const{onRouteClick:l=Le,linkStyle:o={}}=s,t=document.createElement("a");t.href="#",t.textContent=n;const c={...je,...o};return Object.assign(t.style,c),t.addEventListener("click",m=>{m.preventDefault(),l(r)}),t},K=n=>{const r=/#router:([^#]+)#/g,s=[],l=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let o=l.nextNode();for(;o;){const t=o,c=t.textContent||"";if(r.test(c)){r.lastIndex=0;const m=H(c);m.length>0&&s.push({node:t,replacements:m})}o=l.nextNode()}return s},Ie=(n,r,s={})=>{const l=K(n);l.forEach(({node:o,replacements:t})=>{var m;const c=document.createDocumentFragment();t.forEach(({text:g,routeName:w})=>{if(w){const N=Q(g,w,s);c.appendChild(N)}else c.appendChild(document.createTextNode(g))}),(m=o.parentNode)==null||m.replaceChild(c,o)}),s!=null&&s.nodeCallback&&l.forEach(({node:o,replacements:t})=>{var c;(c=s.nodeCallback)==null||c.call(s,o,t)})},Ae="0.1.5",$e="Sz";function Ue({componentPrefix:n=$e,components:r=[]}={}){const s=[];function l(t,c,m){t.component(n+c)||t.component(n+c,m)}function o(t){s.includes(t)||(s.push(t),r.forEach(c=>{const{name:m,alias:g}=c;l(t,m,c),g&&g.forEach(w=>{l(t,w,c)})}))}return{version:Ae,componentPrefix:n,install:o}}const Me={install(n){A(n)}};E.SzAiChat=W,E.create=Ue,E.createRouteLink=Q,E.default=Me,E.findRouteTextNodes=K,E.parseRouteMarkers=H,E.routeLinkRender=Ie,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E["szjy-ai-coms"]={},E.Vue))})(this,function(E,e){"use strict";const Z="/images/ai-round.png",G="/images/ai-sqrt.png",ee="/images/bars-loading.svg";function $(n){return n.startsWith("http://")||n.startsWith("https://")?n:`${location.protocol}//${location.host}${n}`}async function te(n,r,l,i="",a={}){const{projectId:t}=a,o=$(i),u=new URL(`${o}/v1/chat/completions`),f=new Request(u,{method:"post",headers:{"Content-Type":"application/json",Authorization:"Bearer app-oLZVFFdYyJX2QK3rdOLWsC2u"},body:JSON.stringify({model:"dify",stream:!0,inputs:{token:r,projectCode:l,...t?{projectId:t}:{}},messages:[{role:"system",content:"你是一个专业的AI助手,请用中文回答问题。"},{role:"user",content:n}]})});return fetch(f)}async function ne(n,r,l,i="",a={}){const t=new URL("http://localhost:11434/api/chat"),o={};Object.keys(o).forEach(f=>{t.searchParams.append(f,o[f])});const u=new Request(t,{mode:"cors",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"llama3",stream:!0,messages:[{role:"system",content:"全程使用中文回答问题。"},{role:"user",content:n}]})});return fetch(u)}async function re(n,r,l,i="",a={}){const t=new URL(`${location.origin}/spark/v1/chat/completions`),o={};Object.keys(o).forEach(f=>{t.searchParams.append(f,o[f])});const u=new Request(t,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"generalv4.0Ultra",stream:!0,messages:[{role:"user",content:n}]})});return fetch(u)}async function oe(n,r,l,i="",a={}){const t=new URL(`${location.origin}/siliconflow/v1/chat/completions`),o={};Object.keys(o).forEach(f=>{t.searchParams.append(f,o[f])});const u=new Request(t,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"Qwen/Qwen1.5-110B-Chat",stream:!0,messages:[{role:"user",content:n}]})});return fetch(u)}async function ae(n,r,l,i="",a={}){const t=new URL(`${location.origin}/moonshot/v1/chat/completions`),o={};Object.keys(o).forEach(f=>{t.searchParams.append(f,o[f])});const u=new Request(t,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"moonshot-v1-8k",stream:!0,messages:[{role:"system",content:"你是 Kimi,由 Moonshot AI 提供的人工智能助手,你更擅长中文和英文的对话。你会为用户提供安全,有帮助,准确的回答。同时,你会拒绝一切涉及恐怖主义,种族歧视,黄色暴力等问题的回答。Moonshot AI 为专有名词,不可翻译成其他语言。"},{role:"user",content:n}]})});return fetch(u)}async function se(n,r,l,i="",a={}){const t=new URL(`${location.origin}/dashscope/compatible-mode/v1/chat/completions`),o={};Object.keys(o).forEach(f=>{t.searchParams.append(f,o[f])});const u=new Request(t,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({model:"qwq-32b-preview",stream:!0,messages:[{role:"system",content:"全程使用中文回答问题"},{role:"user",content:n}]})});return fetch(u)}async function le(n,r,l,i="",a={}){const t=$(i),o=new URL(`${t}/support/${l}/a`),u={};Object.keys(u).forEach(w=>{o.searchParams.append(w,u[w])});const f=new Request(o,{method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({content:n})});return fetch(f)}const ie=n=>{if(n.startsWith("data:")){const r=n.substring(5).trim();if(r==="[DONE]")return{done:!0};try{return JSON.parse(r)}catch(l){console.error("JSON parsing error:",l)}}return null},A=[{label:"模拟数据模型",modelName:"standard",api:null},{label:"Spark 星火大模型",modelName:"spark",api:re},{label:"Ollama 3 大模型",modelName:"ollama3",api:ne},{label:"SiliconFlow 硅基流动大模型",modelName:"siliconflow",api:oe},{label:"Kimi Moonshot 月之暗面大模型",modelName:"moonshot",api:ae},{label:"通义千问大模型",modelName:"dashscope",api:se},{label:"数智建管大模型",modelName:"szjy",api:le},{label:"Dify (OpenAI 兼容)",modelName:"dify-openai",api:te}],q={standard(n,r){let l="";return n instanceof Uint8Array?l=r.decode(n,{stream:!0}):l=n,{content:l}},spark(n){const r=ie(n);return r.done?{done:!0}:{content:r.choices[0].delta.content||""}},siliconflow(n){return this.spark(n)},moonshot(n){return this.spark(n)},dashscope(n){return this.spark(n)},szjy(n){return this.spark(n)},"dify-openai"(n){return this.spark(n)},ollama3(n){return{content:JSON.parse(n).message.content}}},M=(n,r,l)=>{const i=n.split(l);return i.slice(0,-1).forEach(a=>{a.trim()!==""&&r.enqueue(a)}),i[i.length-1]},ce=n=>{let r="";return new TransformStream({transform(l,i){if(r+=l,r.trim().startsWith("data:"))r=M(r,i,n);else try{JSON.parse(r),r=M(r,i,n)}catch{i.enqueue(l),r=""}},flush(l){r.trim()!==""&&l.enqueue(r)}})};async function de(n,r){const l=n.api;return l?new Promise(i=>{l(r.text,r.token,r.identifier,r.baseUrl,r.extraConfig).then(a=>{if(a.body){const t=a.body.pipeThrough(new TextDecoderStream).pipeThrough(ce(`
2
+ `)).getReader();console.log("reader from response:",t),i({error:0,reader:t})}else i({error:1,reader:null})}).catch(a=>{i({error:1,reader:null})})}):{error:1,reader:null}}let z=null;function ue(){return z||(window.markdownit?z=new window.markdownit({html:!0,linkify:!0,typographer:!0}):console.log("markdownit is not loaded"),z)}const F=(n,r)=>{const l=n.__vccOpts||n;for(const[i,a]of r)l[i]=a;return l},fe=["src","alt"],U=F({__name:"SvgIcon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:16},color:{type:String,default:""},className:{type:String,default:""},basePath:{type:String,default:"/icons/"}},setup(n){const r=n,l=e.computed(()=>{if(r.name.startsWith("http://")||r.name.startsWith("https://")||r.name.startsWith("/"))return r.name;const t=r.name.endsWith(".svg")?r.name:`${r.name}.svg`;return`${r.basePath}${t}`}),i=e.computed(()=>{const t=typeof r.size=="number"?`${r.size}px`:r.size;return{width:t,height:t,display:"inline-flex",justifyContent:"center",alignItems:"center"}}),a=e.computed(()=>{const t={width:"100%",height:"100%"};return r.color&&(t.filter=`drop-shadow(0 0 0 ${r.color})`),t});return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:"svg-icon-wrapper",style:e.normalizeStyle(i.value)},[e.createElementVNode("img",{src:l.value,alt:n.name,class:e.normalizeClass(["svg-icon",n.className]),style:e.normalizeStyle(a.value)},null,14,fe)],4))}},[["__scopeId","data-v-490b11c1"]]),me=async n=>{if(navigator.clipboard&&navigator.permissions)await navigator.clipboard.writeText(n);else{const r=document.createElement("textArea");r.value=n,r.style.width=0,r.style.position="fixed",r.style.left="-999px",r.style.top="10px",r.setAttribute("readonly","readonly"),document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)}},pe=["innerHTML"],he={__name:"Previewer",props:{reader:null,model:"szjy",scrollToBottomFn:null,displayText:"",messagePostRender:{type:Function,default:null}},emits:["failed","completed","updating"],setup(n,{expose:r,emit:l}){const{appContext:i}=e.getCurrentInstance(),{$message:a}=i.config.globalProperties,t=n,o=e.ref(t.displayText||""),u=e.ref(""),f=e.ref(!0),w=e.ref(!1),C=e.ref(!!t.displayText),B=l,T=e.ref(null);let N=null;const j=e.computed(()=>z?z.render(o.value):o.value),O=()=>{t.reader&&t.reader.cancel(),w.value=!0,d.value=!1,p(),C.value=!0,B("completed",o.value),f.value=!1,N&&(cancelAnimationFrame(N),N=null)},P=e.computed(()=>`${j.value}`),h=e.ref(!1),m=()=>{h.value=!0},p=()=>{h.value=!1},d=e.ref(!1),c=async()=>{if(!t.reader)return;const k=new TextDecoder("utf-8");for(f.value=!0;!w.value;)try{if(!t.reader){d.value=!0;break}const{value:s,done:b}=await t.reader.read();if(!t.reader){d.value=!0;break}if(b){d.value=!0;break}const S=q[t.model];if(!S)break;const R=S.call(q,s,k);if(R.done){d.value=!0;break}u.value+=R.content,N===null&&v()}catch(s){d.value=!0,console.log(3333,s),B("failed",s),O();break}finally{p()}},g=async()=>{t.scrollToBottomFn&&t.scrollToBottomFn()},y=(k=()=>{},s=()=>{})=>{if(u.value.length>0){const b=u.value.substring(0,10);o.value+=b,u.value=u.value.substring(10),k()}else s()},v=()=>{if(w.value&&N){cancelAnimationFrame(N),N=null,f.value=!1;return}d.value?y(()=>{N=requestAnimationFrame(v),B("updating",null)},()=>{B("completed",o.value),f.value=!1,C.value=!0,e.nextTick(()=>{if(d.value=!1,t.messagePostRender&&T.value)try{t.messagePostRender(T.value,o.value)}catch(k){console.error("messagePostRender 执行失败:",k)}}),N=null}):(y(),N=requestAnimationFrame(v)),g()};e.watch(()=>t.reader,()=>{t.reader&&c()},{immediate:!0,deep:!0}),e.onUnmounted(()=>{O()}),r({abortReader:O,initializeStart:m,initializeEnd:p}),e.computed(()=>h.value?!0:(!t.reader||!f||o.value,!1));const x=async()=>{try{const k=o.value;await me(k),a.success("复制成功")}catch(k){console.error("复制失败:",k),a.error("复制失败")}};return(k,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"fade"},{default:e.withCtx(()=>[P.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"refWrapperContent",ref:T,"text-16":"",class:"w-full h-full overflow-y-auto relative","p-24px":""},[e.createElementVNode("div",{class:"markdown-wrapper",innerHTML:P.value},null,8,pe),C.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ai-copy-btn-wrapper",onClick:x},[e.createVNode(U,{name:"/images/svg/copy.svg",color:"#666666"}),s[0]||(s[0]=e.createElementVNode("span",{class:"copy-text"},"复制",-1))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)]),_:1}))}},ge={class:"panel-header"},ye={class:"header-actions"},be={class:"header-title"},ke={class:"action-icons"},we={class:"body-content"},xe={key:0,class:"welcome-content"},ve={class:"subtitle"},Se={class:"highlight"},Ce={class:"quick-questions"},Ne=["onClick"],_e={key:1,class:"message-content user-content"},Ee={class:"panel-footer"},Te={key:0,src:ee,alt:"加载中",class:"loading-icon"},Re={class:"input-box"},Pe=["src"],Ve={__name:"ChatPanel",props:{modelValue:{type:Boolean,default:!1},token:{type:String,default:""},identifier:{type:String,default:""},baseUrl:{type:String,default:""},title:{type:String,default:"数智AI助理"},llmName:{type:String,default:"szjy"},messagePostRender:{type:Function,default:null},extraConfig:{type:Object,default:()=>({})}},emits:["update:modelValue","submit"],setup(n,{emit:r}){const{appContext:l}=e.getCurrentInstance(),{$message:i}=l.config.globalProperties,a=n,t=e.computed(()=>A.find(s=>s.modelName===a.llmName)??A.find(s=>s.modelName==="szjy")),o=r,u=e.ref(""),f=e.ref(null),w=e.ref(!1),C=e.ref([]),B=e.ref(["什么是AI助理,能做什么?","当前项目的基本情况?","当前项目的进度情况?","当前项目的参建方有哪些?","数智建管平台有哪些功能?能做什么?"]),T=e.ref([]),N=e.ref(!1),j=e.ref(null),O=()=>{e.nextTick(()=>{if(j.value){const s=j.value,b=s.scrollHeight,S=s.scrollTop,R=s.clientHeight;b-S-R<100?s.scrollTop=b:s.scrollTo({top:b})}})},P=e.ref(!1),h=e.computed(()=>P.value?"/images/ai-stop.png":"/images/ai-send.png"),m=(s,b)=>{console.log("onFailedReader",s,b),N.value=!1;const S=x();S&&S.initializeEnd(),i.error("转换失败,请重试"),P.value=!1,setTimeout(()=>{f.value&&f.value.focus()})},p=(s,b)=>{N.value=!1,P.value=!1,O(),b&&C.value[s]&&(C.value[s].displayText=b),setTimeout(()=>{f.value&&f.value.focus()})},d=s=>{P.value=!0},c=()=>{P.value=!1,o("update:modelValue",!1),w.value=!1,C.value=[]},g=e.ref(!1),y=()=>{g.value=!g.value},v=s=>{u.value=s,k()},x=()=>{for(let s=T.value.length-1;s>=0;s--)if(T.value[s])return T.value[s];return null},k=async()=>{if(console.log("stylizingLoading:",N.value),N.value){const _=x();console.log("lastPreviewer:",_),_&&(console.log("abortReader"),_.abortReader());return}if(!u.value.trim()){console.log("no input, return"),f.value.focus();return}C.value.push({type:"user",content:u.value}),P.value=!0,w.value=!0,o("submit",u.value),O();const s=u.value;u.value="";const b=C.value.length;T.value[b]&&T.value[b].initializeStart(),N.value=!0,C.value.push({type:"ai"});const{error:S,reader:R}=await de(t.value,{text:s,token:a.token,identifier:a.identifier,baseUrl:a.baseUrl,extraConfig:a.extraConfig});if(S){console.log(45455,S),m(b,S);return}R&&(C.value[b].reader=R)};return(s,b)=>{const S=e.resolveComponent("el-icon"),R=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(e.Transition,{name:"slide"},{default:e.withCtx(()=>[n.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ai-panel",{"drawer-mode":g.value}])},[e.createElementVNode("div",ge,[e.createElementVNode("div",ye,[e.createElementVNode("div",be,e.toDisplayString(n.title),1),e.createElementVNode("div",ke,[e.createVNode(S,{class:"action-icon",onClick:y},{default:e.withCtx(()=>[e.createVNode(U,{name:"/images/svg/drawer-layout.svg",color:"#999999"})]),_:1}),e.createVNode(S,{class:"action-icon",onClick:c},{default:e.withCtx(()=>[e.createVNode(U,{name:"/images/svg/close.svg",color:"#999999"})]),_:1})])])]),e.createElementVNode("div",we,[w.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"chat-messages",ref_key:"messageContainerRef",ref:j},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(_,L)=>(e.openBlock(),e.createElementBlock("div",{key:L,class:e.normalizeClass(["message-item",_.type==="user"?"user-message":"ai-message"])},[_.type==="ai"?(e.openBlock(),e.createBlock(he,{key:0,ref_for:!0,ref:V=>T.value[L]=V,reader:_.reader,"onUpdate:reader":V=>_.reader=V,model:a.llmName,displayText:_.displayText,scrollToBottomFn:O,messagePostRender:n.messagePostRender,onFailed:V=>m(L,V),onCompleted:V=>p(L,V),onUpdating:()=>d()},null,8,["reader","onUpdate:reader","model","displayText","messagePostRender","onFailed","onCompleted","onUpdating"])):(e.openBlock(),e.createElementBlock("div",_e,e.toDisplayString(_.content),1))],2))),128))],512)):(e.openBlock(),e.createElementBlock("div",xe,[b[2]||(b[2]=e.createElementVNode("div",{class:"title"},[e.createElementVNode("img",{src:G,alt:"AI助手",class:"panel-icon"}),e.createElementVNode("h3",{class:"title-text"},"Hi, 您好")],-1)),e.createElementVNode("div",ve,[b[1]||(b[1]=e.createTextVNode(" 我是",-1)),e.createElementVNode("span",Se,e.toDisplayString(n.title),1)]),e.createElementVNode("div",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,(_,L)=>(e.openBlock(),e.createElementBlock("div",{key:L,class:"question-item",onClick:V=>v(_)},[e.createElementVNode("span",null,e.toDisplayString(_),1),e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(U,{name:"/images/svg/arrow-right.svg",color:"#999999"})]),_:1})],8,Ne))),128))])]))]),e.createElementVNode("div",Ee,[P.value?(e.openBlock(),e.createElementBlock("img",Te)):e.createCommentVNode("",!0),e.createElementVNode("div",Re,[e.createVNode(R,{modelValue:u.value,"onUpdate:modelValue":b[0]||(b[0]=_=>u.value=_),ref_key:"refInputTextString",ref:f,placeholder:"请输入您的问题",autofocus:"",onKeyup:e.withKeys(k,["enter"])},{append:e.withCtx(()=>[e.createElementVNode("div",{class:"send-icon-box",onClick:k},[e.createElementVNode("img",{src:h.value,alt:"发送",class:"send-icon"},null,8,Pe)])]),_:1},8,["modelValue"])])])],2)):e.createCommentVNode("",!0)]),_:1})}}};var D={exports:{}};(function(n,r){(function(l,i){n.exports=i()})(window,function(){return function(l){var i={};function a(t){if(i[t])return i[t].exports;var o=i[t]={i:t,l:!1,exports:{}};return l[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=l,a.c=i,a.d=function(t,o,u){a.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:u})},a.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,o){if(1&o&&(t=a(t)),8&o||4&o&&typeof t=="object"&&t&&t.__esModule)return t;var u=Object.create(null);if(a.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:t}),2&o&&typeof t!="string")for(var f in t)a.d(u,f,(function(w){return t[w]}).bind(null,f));return u},a.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(o,"a",o),o},a.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},a.p="",a(a.s=0)}([function(l,i,a){function t(h,m,p,d){p.push(h),d.push([].concat(m[h]||[]))}function o(h,m){if(!h)throw new Error("[getMaxDepsChain] dep 参数不能为空");var p=[],d=[],c=[];for(t(h,m,d,c);d.length;){var g=c.pop();if(g&&g.length){var y=g.shift();if(c.push(g),~d.indexOf(y))throw new Error("[getMaxDepsChain][loop] 存在循环依赖,请检查依赖关系; nextName: "+y+", mainStack: "+d);t(y,m,d,c)}else p.push([].concat(d)),d.pop()}return p.reduce(function(v,x){return x.length>v.length?x:v},[])}function u(h){if(!h)throw new Error("[depsParser] 入参不能为空");var m={};h.forEach(function(d){m[d.name]=d.deps||[]});var p=[];return h.forEach(function(d){var c=o(d.name,m).length-1;d.priority=c,p[c]=(p[c]||[]).concat(d)}),p}a.r(i),a.d(i,"loadScript",function(){return T}),a.d(i,"loadScripts",function(){return N}),a.d(i,"dynamicLoadScripts",function(){return j}),a.d(i,"createScriptsLoadIterator",function(){return O}),a.d(i,"loadScriptsQueue",function(){return P}),a.d(i,"getMaxDepsChain",function(){return o}),a.d(i,"depsParser",function(){return u});var f=function(){return(f=Object.assign||function(h){for(var m,p=1,d=arguments.length;p<d;p++)for(var c in m=arguments[p])Object.prototype.hasOwnProperty.call(m,c)&&(h[c]=m[c]);return h}).apply(this,arguments)},w=function(h,m,p,d){return new(p||(p=Promise))(function(c,g){function y(k){try{x(d.next(k))}catch(s){g(s)}}function v(k){try{x(d.throw(k))}catch(s){g(s)}}function x(k){var s;k.done?c(k.value):(s=k.value,s instanceof p?s:new p(function(b){b(s)})).then(y,v)}x((d=d.apply(h,[])).next())})},C=function(h,m){var p,d,c,g,y={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return g={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function v(x){return function(k){return function(s){if(p)throw new TypeError("Generator is already executing.");for(;y;)try{if(p=1,d&&(c=2&s[0]?d.return:s[0]?d.throw||((c=d.return)&&c.call(d),0):d.next)&&!(c=c.call(d,s[1])).done)return c;switch(d=0,c&&(s=[2&s[0],c.value]),s[0]){case 0:case 1:c=s;break;case 4:return y.label++,{value:s[1],done:!1};case 5:y.label++,d=s[1],s=[0];continue;case 7:s=y.ops.pop(),y.trys.pop();continue;default:if(c=y.trys,!((c=c.length>0&&c[c.length-1])||s[0]!==6&&s[0]!==2)){y=0;continue}if(s[0]===3&&(!c||s[1]>c[0]&&s[1]<c[3])){y.label=s[1];break}if(s[0]===6&&y.label<c[1]){y.label=c[1],c=s;break}if(c&&y.label<c[2]){y.label=c[2],y.ops.push(s);break}c[2]&&y.ops.pop(),y.trys.pop();continue}s=m.call(h,y)}catch(b){s=[6,b],d=0}finally{p=c=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([x,k])}}},B=function(h){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m,p=h[Symbol.asyncIterator];return p?p.call(h):(h=typeof __values=="function"?__values(h):h[Symbol.iterator](),m={},d("next"),d("throw"),d("return"),m[Symbol.asyncIterator]=function(){return this},m);function d(c){m[c]=h[c]&&function(g){return new Promise(function(y,v){(function(x,k,s,b){Promise.resolve(b).then(function(S){x({value:S,done:s})},k)})(y,v,(g=h[c](g)).done,g.value)})}}};function T(h,m){return m===void 0&&(m=!1),new Promise(function(p,d){var c=m?document.head:document.body,g=document.createElement("script");g.type="text/javascript",g.src=h,g.crossOrigin="anonymous",g.onreadystatechange=p,g.onload=p,g.onerror=d,c.appendChild(g)})}var N=function(h,m){return m===void 0&&(m={}),w(void 0,void 0,void 0,function(){var p,d,c,g,y;return C(this,function(v){switch(v.label){case 0:return p=m.baseUrl,d=p===void 0?"":p,c=m.lastLoadResult,g=m.inHead,y=g!==void 0&&g,[4,Promise.all(h.map(function(x){return w(void 0,void 0,void 0,function(){var k,s,b,S,R,_,L,V;return C(this,function(Y){switch(Y.label){case 0:return k=x.name,s=x.path,b=x.deps,(L={})[k]=!0,S=L,(V={})[k]=!1,R=V,window[k]?[2,S]:[3,1];case 1:return _=!0,b&&c&&[].concat(b).forEach(function(Fe){c[Fe]!==!1&&(_=!0)}),_?[4,T(s.indexOf("http")===0||s.indexOf("//:")===0?s:d+s,y).then(function(){return S}).catch(function(){return R})]:[3,3];case 2:return[2,Y.sent()];case 3:return[2,R]}})})}))];case 1:return[2,v.sent()]}})})},j=function(h,m){return m===void 0&&(m={}),function(){var p=[].concat(u(h));return{next:function(){if(p.length){var d=p.shift();return N(d,m).then(function(c){return{value:c,done:!1}})}return Promise.resolve({done:!0})}}}},O=function(h,m){var p;return m===void 0&&(m={}),(p={})[Symbol.asyncIterator]=j(h,m),p},P=function(h,m){return m===void 0&&(m={}),w(void 0,void 0,void 0,function(){var p,d,c,g,y,v;return C(this,function(x){switch(x.label){case 0:x.trys.push([0,5,6,11]),p=B(O(h,m)),x.label=1;case 1:return[4,p.next()];case 2:if((d=x.sent()).done)return[3,4];c=d.value,m.lastLoadResult=m.lastLoadResult||{},console.log("current load: ",c),c.forEach(function(k){m.lastLoadResult=f(f({},m.lastLoadResult),k)}),x.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return g=x.sent(),y={error:g},[3,11];case 6:return x.trys.push([6,,9,10]),d&&!d.done&&(v=p.return)?[4,v.call(p)]:[3,8];case 7:x.sent(),x.label=8;case 8:return[3,10];case 9:if(y)throw y.error;return[7];case 10:return[7];case 11:return[2,m.lastLoadResult]}})})}}])})})(D);var Be=D.exports;const Oe={key:0,class:"ai-assistant"},Le={name:"AiChat"},je=e.defineComponent({...Le,props:{token:{type:String,default:""},identifier:{type:String,default:""},baseUrl:{type:String,default:""},title:{type:String,default:"数智AI助理"},llmName:{type:String,default:"szjy"},messagePostRender:{type:Function,default:null},extraConfig:{type:Object,default:()=>({})}},setup(n){const r=e.ref(!1),l=e.ref(!1),i=()=>{r.value=!r.value},a=()=>{l.value=!0,r.value=!1},t=f=>{console.log("用户输入:",f)},o=[{name:"markdownit",path:"markdown-it.min.js"},{name:"hljs",path:"highlight.11.11.1.min.js"}];let u={};return Be.loadScriptsQueue(o,{baseUrl:"/scripts/ai/",lastLoadResult:u,inHead:!1}).then(f=>{if(console.log("load ai deps: ",f),window.markdownit){const w=window.markdownit();console.log("markdownit: ",w),ue()}}),(f,w)=>l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Oe,[e.createVNode(Ve,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=C=>r.value=C),onSubmit:t,token:n.token,identifier:n.identifier,baseUrl:n.baseUrl,title:n.title,llmName:n.llmName,messagePostRender:n.messagePostRender,extraConfig:n.extraConfig},null,8,["modelValue","token","identifier","baseUrl","title","llmName","messagePostRender","extraConfig"]),e.createElementVNode("div",{class:"ai-icon",onClick:i},[e.createElementVNode("div",{class:"close-icon",onClick:e.withModifiers(a,["stop"])},[...w[1]||(w[1]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"8",height:"8"},[e.createElementVNode("path",{d:"M512 456.310154L94.247385 38.557538a39.384615 39.384615 0 0 0-55.689847 55.689847L456.310154 512 38.557538 929.752615a39.384615 39.384615 0 0 0 55.689847 55.689847L512 567.689846l417.752615 417.752616c15.163077 15.163077 40.526769 15.163077 55.689847 0s15.163077-40.526769 0-55.689847L567.689846 512l417.752616-417.752615a39.384615 39.384615 0 0 0-55.689847-55.689847L512 456.310154z",fill:"currentColor"})],-1)])]),w[2]||(w[2]=e.createElementVNode("img",{src:Z,alt:"AI助手"},null,-1)),w[3]||(w[3]=e.createElementVNode("span",{class:"ai-icon-text"},"AI助手",-1))])]))}}),W=F(je,[["__scopeId","data-v-33f89960"]]),J=Object.freeze(Object.defineProperty({__proto__:null,SzAiChat:W},Symbol.toStringTag,{value:"Module"})),I=function(n){if(!I.installed){I.installed=!0;for(let r in J){const l=Reflect.get(J,r);n.component(l.name,l)}}},ze=(n,r)=>{const l=r?`?${new URLSearchParams(r).toString()}`:"";console.log(`点击了路由链接: ${n}${l}`)},H=n=>{const r=n.indexOf("?");if(r===-1)return{routeName:n};const l=n.substring(0,r),i=n.substring(r+1),a={};return new URLSearchParams(i).forEach((o,u)=>{a[u]=o}),{routeName:l,queryParams:Object.keys(a).length>0?a:void 0}},Ue={color:"#536fec",fontWeight:"bold",textDecoration:"underline",cursor:"pointer",padding:"0 3px"},Q=n=>{const r=/#router:([^#]+)#/g,l=[];let i=0,a;for(;(a=r.exec(n))!==null;){a.index>i&&l.push({text:n.substring(i,a.index)});const t=a[1],{routeName:o,queryParams:u}=H(t);l.push({text:o,routeName:o,queryParams:u}),i=r.lastIndex}return i<n.length&&l.push({text:n.substring(i)}),l},K=(n,r,l={},i)=>{const{onRouteClick:a=ze,linkStyle:t={}}=l,o=document.createElement("a");o.href="#",o.textContent=n;const u={...Ue,...t};return Object.assign(o.style,u),o.addEventListener("click",f=>{f.preventDefault(),a(r,i)}),o},X=n=>{const r=/#router:([^#]+)#/g,l=[],i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let a=i.nextNode();for(;a;){const t=a,o=t.textContent||"";if(r.test(o)){r.lastIndex=0;const u=Q(o);u.length>0&&l.push({node:t,replacements:u})}a=i.nextNode()}return l},Ie=(n,r,l={})=>{const i=X(n);i.forEach(({node:a,replacements:t})=>{var u;const o=document.createDocumentFragment();t.forEach(({text:f,routeName:w,queryParams:C})=>{if(w){const B=K(f,w,l,C);o.appendChild(B)}else o.appendChild(document.createTextNode(f))}),(u=a.parentNode)==null||u.replaceChild(o,a)}),l!=null&&l.nodeCallback&&i.forEach(({node:a,replacements:t})=>{var o;(o=l.nodeCallback)==null||o.call(l,a,t)})},$e="0.1.7",Ae="Sz";function qe({componentPrefix:n=Ae,components:r=[]}={}){const l=[];function i(t,o,u){t.component(n+o)||t.component(n+o,u)}function a(t){l.includes(t)||(l.push(t),r.forEach(o=>{const{name:u,alias:f}=o;i(t,u,o),f&&f.forEach(w=>{i(t,w,o)})}))}return{version:$e,componentPrefix:n,install:a}}const Me={install(n){I(n)}};E.SzAiChat=W,E.create=qe,E.createRouteLink=K,E.default=Me,E.findRouteTextNodes=X,E.parseRouteMarkerContent=H,E.parseRouteMarkers=Q,E.routeLinkRender=Ie,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -7,28 +7,28 @@
7
7
  * "messages": [ { role, content }, ... ]
8
8
  * }
9
9
  */
10
- export declare function createDifyOpenAIStylized(text: any, token: any, identifier: any, baseUrl?: string): Promise<Response>;
10
+ export declare function createDifyOpenAIStylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
11
11
  /**
12
12
  * Event Stream 调用大模型接口 Ollama3 (Fetch 调用)
13
13
  */
14
- export declare function createOllama3Stylized(text: any): Promise<Response>;
14
+ export declare function createOllama3Stylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
15
15
  /**
16
16
  * Event Stream 调用大模型接口 Spark 星火认知大模型 (Fetch 调用)
17
17
  */
18
- export declare function createSparkStylized(text: any, token: any): Promise<Response>;
18
+ export declare function createSparkStylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
19
19
  /**
20
20
  * Event Stream 调用大模型接口 SiliconFlow 硅基流动大模型 (Fetch 调用)
21
21
  */
22
- export declare function createSiliconFlowStylized(text: any, token: any): Promise<Response>;
22
+ export declare function createSiliconFlowStylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
23
23
  /**
24
24
  * Event Stream 调用大模型接口 Kimi Moonshot 月之暗面大模型 (Fetch 调用)
25
25
  */
26
- export declare function createKimiMoonshotStylized(text: any, token: any): Promise<Response>;
26
+ export declare function createKimiMoonshotStylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
27
27
  /**
28
28
  * Event Stream 调用大模型接口 Kimi Moonshot 月之暗面大模型 (Fetch 调用)
29
29
  */
30
- export declare function createDashScopeStylized(text: any, token: any): Promise<Response>;
30
+ export declare function createDashScopeStylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
31
31
  /**
32
32
  * Event Stream 调用大模型接口 数智交院 月之暗面大模型 (Fetch 调用)
33
33
  */
34
- export declare function createSZJYStylized(text: any, token: any, identifier: any, baseUrl?: string): Promise<Response>;
34
+ export declare function createSZJYStylized(text: any, token: any, identifier: any, baseUrl?: string, extraConfig?: {}): Promise<Response>;
@@ -3,8 +3,8 @@
3
3
  * 将 #router:xxx# 格式的文本替换为可点击的路由链接
4
4
  */
5
5
  export interface RouteLinkOptions {
6
- /** 路由跳转处理函数,接收路由名称作为参数 */
7
- onRouteClick?: (routeName: string) => void;
6
+ /** 路由跳转处理函数,接收路由名称和查询参数作为参数 */
7
+ onRouteClick?: (routeName: string, queryParams?: Record<string, string>) => void;
8
8
  /** 节点遍历回调函数,接收节点和替换数组作为参数 */
9
9
  nodeCallback?: (node: Node, replacements: RouteReplacement[]) => void;
10
10
  /** 链接样式配置 */
@@ -13,7 +13,18 @@ export interface RouteLinkOptions {
13
13
  export interface RouteReplacement {
14
14
  text: string;
15
15
  routeName?: string;
16
+ /** 路由链接中的查询参数,如 #router:personal?a=xx&b=yy# 中的 { a: 'xx', b: 'yy' } */
17
+ queryParams?: Record<string, string>;
16
18
  }
19
+ /**
20
+ * 解析路由标记内容,分离路由名称和查询参数
21
+ * @param markerContent - #router:xxx# 中 xxx 部分的内容,如 "personal?a=xx&b=yy"
22
+ * @returns 路由名称和查询参数
23
+ */
24
+ export declare const parseRouteMarkerContent: (markerContent: string) => {
25
+ routeName: string;
26
+ queryParams?: Record<string, string>;
27
+ };
17
28
  /**
18
29
  * 解析文本中的路由标记,返回替换数组
19
30
  * @param text - 要解析的文本
@@ -27,7 +38,7 @@ export declare const parseRouteMarkers: (text: string) => RouteReplacement[];
27
38
  * @param options - 配置选项
28
39
  * @returns 链接元素
29
40
  */
30
- export declare const createRouteLink: (text: string, routeName: string, options?: RouteLinkOptions) => HTMLAnchorElement;
41
+ export declare const createRouteLink: (text: string, routeName: string, options?: RouteLinkOptions, queryParams?: Record<string, string>) => HTMLAnchorElement;
31
42
  /**
32
43
  * 查找容器中包含路由标记的文本节点
33
44
  * @param container - 容器元素
@@ -34,6 +34,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
34
34
  type: FunctionConstructor;
35
35
  default: null;
36
36
  };
37
+ /**
38
+ * 额外配置参数,用于扩展供应商 API 调用
39
+ * 例如:{ projectId: 'xxx' } 供 Dify 等供应商使用
40
+ */
41
+ extraConfig: {
42
+ type: ObjectConstructor;
43
+ default: () => {};
44
+ };
37
45
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
38
46
  token: {
39
47
  type: StringConstructor;
@@ -70,6 +78,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
70
78
  type: FunctionConstructor;
71
79
  default: null;
72
80
  };
81
+ /**
82
+ * 额外配置参数,用于扩展供应商 API 调用
83
+ * 例如:{ projectId: 'xxx' } 供 Dify 等供应商使用
84
+ */
85
+ extraConfig: {
86
+ type: ObjectConstructor;
87
+ default: () => {};
88
+ };
73
89
  }>> & Readonly<{}>, {
74
90
  token: string;
75
91
  identifier: string;
@@ -77,5 +93,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
77
93
  title: string;
78
94
  llmName: string;
79
95
  messagePostRender: Function;
96
+ extraConfig: Record<string, any>;
80
97
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
81
98
  export default _default;
@@ -1,4 +1,4 @@
1
- import { createSZJYStylized } from '../../../../api/ai';
1
+ import { createSparkStylized } from '../../../../api/ai';
2
2
 
3
3
  /**
4
4
  * 转义处理响应值为 data: 的 json 字符串
@@ -15,7 +15,7 @@ export declare const LLMTypes: ({
15
15
  } | {
16
16
  label: string;
17
17
  modelName: string;
18
- api: typeof createSZJYStylized;
18
+ api: typeof createSparkStylized;
19
19
  })[];
20
20
  /**
21
21
  * 用于处理不同类型流的值转换器
package/dist/style.css CHANGED
@@ -6,4 +6,4 @@
6
6
  Website: https://highlightjs.org/
7
7
  License: see project LICENSE
8
8
  Touched: 2021
9
- */pre code.hljs[data-v-9d212a48]{display:block;overflow-x:auto;padding:1em}code.hljs[data-v-9d212a48]{padding:3px 5px}.hljs[data-v-9d212a48]{background:#f3f3f3;color:#444}.hljs-comment[data-v-9d212a48]{color:#697070}.hljs-punctuation[data-v-9d212a48],.hljs-tag[data-v-9d212a48]{color:#444a}.hljs-tag .hljs-attr[data-v-9d212a48],.hljs-tag .hljs-name[data-v-9d212a48]{color:#444}.hljs-attribute[data-v-9d212a48],.hljs-doctag[data-v-9d212a48],.hljs-keyword[data-v-9d212a48],.hljs-meta .hljs-keyword[data-v-9d212a48],.hljs-name[data-v-9d212a48],.hljs-selector-tag[data-v-9d212a48]{font-weight:700}.hljs-deletion[data-v-9d212a48],.hljs-number[data-v-9d212a48],.hljs-quote[data-v-9d212a48],.hljs-selector-class[data-v-9d212a48],.hljs-selector-id[data-v-9d212a48],.hljs-string[data-v-9d212a48],.hljs-template-tag[data-v-9d212a48],.hljs-type[data-v-9d212a48]{color:#800}.hljs-section[data-v-9d212a48],.hljs-title[data-v-9d212a48]{color:#800;font-weight:700}.hljs-link[data-v-9d212a48],.hljs-operator[data-v-9d212a48],.hljs-regexp[data-v-9d212a48],.hljs-selector-attr[data-v-9d212a48],.hljs-selector-pseudo[data-v-9d212a48],.hljs-symbol[data-v-9d212a48],.hljs-template-variable[data-v-9d212a48],.hljs-variable[data-v-9d212a48]{color:#ab5656}.hljs-literal[data-v-9d212a48]{color:#695}.hljs-addition[data-v-9d212a48],.hljs-built_in[data-v-9d212a48],.hljs-bullet[data-v-9d212a48],.hljs-code[data-v-9d212a48]{color:#397300}.hljs-meta[data-v-9d212a48]{color:#1f7199}.hljs-meta .hljs-string[data-v-9d212a48]{color:#38a}.hljs-emphasis[data-v-9d212a48]{font-style:italic}.hljs-strong[data-v-9d212a48]{font-weight:700}.ai-assistant{box-sizing:border-box;position:fixed;right:20px;bottom:40px;z-index:1000;display:flex;align-items:flex-end}.ai-assistant div{box-sizing:border-box}.ai-assistant .ai-icon{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;cursor:pointer;width:44px;padding:6px;transition:all .3s;height:114px;background-color:#fff;box-shadow:0 4px 16px 4px #00000008,0 2px 8px #0000000d,0 0 4px -2px #00000014;border-radius:22px;border:1px solid transparent;background-image:linear-gradient(#fff,#fff),linear-gradient(180deg,#60fffc,#0a84ff);background-origin:border-box;background-clip:padding-box,border-box}.ai-assistant .ai-icon:hover{transform:translateY(-2px);box-shadow:0 4px 16px #00000026}.ai-assistant .ai-icon img{width:32px;height:32px;margin-bottom:6px}.ai-assistant .ai-icon .ai-icon-text{display:inline-block;width:20px;font-size:16px;line-height:18px;font-weight:700;color:#333}.ai-assistant .ai-icon:hover .close-icon{display:flex}.ai-assistant .ai-icon .close-icon{display:none;position:absolute;top:-6px;right:-6px;width:16px;height:16px;background:#fff;border-radius:50%;align-items:center;justify-content:center;box-shadow:0 2px 4px #0000001a;color:#666;cursor:pointer;z-index:1}.ai-assistant .ai-icon .close-icon:hover{color:#333;background:#f5f5f5}
9
+ */pre code.hljs[data-v-33f89960]{display:block;overflow-x:auto;padding:1em}code.hljs[data-v-33f89960]{padding:3px 5px}.hljs[data-v-33f89960]{background:#f3f3f3;color:#444}.hljs-comment[data-v-33f89960]{color:#697070}.hljs-punctuation[data-v-33f89960],.hljs-tag[data-v-33f89960]{color:#444a}.hljs-tag .hljs-attr[data-v-33f89960],.hljs-tag .hljs-name[data-v-33f89960]{color:#444}.hljs-attribute[data-v-33f89960],.hljs-doctag[data-v-33f89960],.hljs-keyword[data-v-33f89960],.hljs-meta .hljs-keyword[data-v-33f89960],.hljs-name[data-v-33f89960],.hljs-selector-tag[data-v-33f89960]{font-weight:700}.hljs-deletion[data-v-33f89960],.hljs-number[data-v-33f89960],.hljs-quote[data-v-33f89960],.hljs-selector-class[data-v-33f89960],.hljs-selector-id[data-v-33f89960],.hljs-string[data-v-33f89960],.hljs-template-tag[data-v-33f89960],.hljs-type[data-v-33f89960]{color:#800}.hljs-section[data-v-33f89960],.hljs-title[data-v-33f89960]{color:#800;font-weight:700}.hljs-link[data-v-33f89960],.hljs-operator[data-v-33f89960],.hljs-regexp[data-v-33f89960],.hljs-selector-attr[data-v-33f89960],.hljs-selector-pseudo[data-v-33f89960],.hljs-symbol[data-v-33f89960],.hljs-template-variable[data-v-33f89960],.hljs-variable[data-v-33f89960]{color:#ab5656}.hljs-literal[data-v-33f89960]{color:#695}.hljs-addition[data-v-33f89960],.hljs-built_in[data-v-33f89960],.hljs-bullet[data-v-33f89960],.hljs-code[data-v-33f89960]{color:#397300}.hljs-meta[data-v-33f89960]{color:#1f7199}.hljs-meta .hljs-string[data-v-33f89960]{color:#38a}.hljs-emphasis[data-v-33f89960]{font-style:italic}.hljs-strong[data-v-33f89960]{font-weight:700}.ai-assistant{box-sizing:border-box;position:fixed;right:20px;bottom:40px;z-index:1000;display:flex;align-items:flex-end}.ai-assistant div{box-sizing:border-box}.ai-assistant .ai-icon{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;cursor:pointer;width:44px;padding:6px;transition:all .3s;height:114px;background-color:#fff;box-shadow:0 4px 16px 4px #00000008,0 2px 8px #0000000d,0 0 4px -2px #00000014;border-radius:22px;border:1px solid transparent;background-image:linear-gradient(#fff,#fff),linear-gradient(180deg,#60fffc,#0a84ff);background-origin:border-box;background-clip:padding-box,border-box}.ai-assistant .ai-icon:hover{transform:translateY(-2px);box-shadow:0 4px 16px #00000026}.ai-assistant .ai-icon img{width:32px;height:32px;margin-bottom:6px}.ai-assistant .ai-icon .ai-icon-text{display:inline-block;width:20px;font-size:16px;line-height:18px;font-weight:700;color:#333}.ai-assistant .ai-icon:hover .close-icon{display:flex}.ai-assistant .ai-icon .close-icon{display:none;position:absolute;top:-6px;right:-6px;width:16px;height:16px;background:#fff;border-radius:50%;align-items:center;justify-content:center;box-shadow:0 2px 4px #0000001a;color:#666;cursor:pointer;z-index:1}.ai-assistant .ai-icon .close-icon:hover{color:#333;background:#f5f5f5}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@szjy/ai-coms",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "vue3 ai component",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.mjs",