@deep-eye/core 1.2.55 → 1.2.56
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
131
|
*/const TR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Fg=Rr("x",TR),YR=["src","alt"],UR=u.defineComponent({__name:"ChatImageLightbox",props:{open:{type:Boolean},images:{},index:{}},emits:["update:open","update:index"],setup(e,{emit:A}){const t=e,r=A,n=u.ref(),i=u.ref();let a=null;function o(){r("update:open",!1)}function s(c){if(!t.images.length)return;const h=t.index??0;r("update:index",(h+c+t.images.length)%t.images.length)}function l(c){t.open&&(c.key==="Escape"&&o(),c.key==="ArrowLeft"&&s(-1),c.key==="ArrowRight"&&s(1),c.key==="Tab"&&g(c))}function g(c){var d;const h=Array.from(((d=n.value)==null?void 0:d.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(h.length===0)return;const C=h[0],I=h[h.length-1];c.shiftKey&&document.activeElement===C?(c.preventDefault(),I.focus()):!c.shiftKey&&document.activeElement===I&&(c.preventDefault(),C.focus())}return u.watch(()=>t.open,c=>{c?(a=document.activeElement instanceof HTMLElement?document.activeElement:null,u.nextTick(()=>{var h;return(h=i.value)==null?void 0:h.focus()})):(a==null||a.focus(),a=null)}),typeof window<"u"&&window.addEventListener("keydown",l),u.onBeforeUnmount(()=>window.removeEventListener("keydown",l)),(c,h)=>{var C,I;return u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[e.open&&e.images.length?(u.openBlock(),u.createElementBlock("div",{key:0,ref_key:"dialogRef",ref:n,class:"chat-image-lightbox",role:"dialog","aria-modal":"true","aria-label":"图片预览"},[u.createElementVNode("button",{ref_key:"closeRef",ref:i,type:"button",class:"chat-image-lightbox__close","aria-label":"关闭图片预览",onClick:o},[u.createVNode(u.unref(Fg),{size:20,"stroke-width":1.75,"aria-hidden":"true"})],512),e.images.length>1?(u.openBlock(),u.createElementBlock("button",{key:0,type:"button",class:"chat-image-lightbox__previous","aria-label":"上一张图片",onClick:h[0]||(h[0]=d=>s(-1))},[u.createVNode(u.unref(cR),{size:20,"stroke-width":1.75,"aria-hidden":"true"})])):u.createCommentVNode("",!0),u.createElementVNode("img",{src:(C=e.images[e.index??0])==null?void 0:C.original_url,alt:(I=e.images[e.index??0])==null?void 0:I.filename},null,8,YR),e.images.length>1?(u.openBlock(),u.createElementBlock("button",{key:1,type:"button",class:"chat-image-lightbox__next","aria-label":"下一张图片",onClick:h[1]||(h[1]=d=>s(1))},[u.createVNode(u.unref(CR),{size:20,"stroke-width":1.75,"aria-hidden":"true"})])):u.createCommentVNode("",!0)],512)):u.createCommentVNode("",!0)])}}}),Sb=Be(UR,[["__scopeId","data-v-7344bd69"]]),JR={class:"chat-attachments","aria-label":"消息附件"},OR=["aria-label","onClick"],HR=["src","alt"],VR=["aria-label","onClick"],ZR=["src"],KR={class:"chat-attachments__file-info"},qR={class:"chat-attachments__name"},PR={class:"chat-attachments__meta"},WR={class:"chat-attachments__type"},zR=200,XR=u.defineComponent({__name:"ChatAttachments",props:{resources:{}},emits:["preview"],setup(e,{emit:A}){const t=e,r=A,n=u.computed(()=>t.resources.filter(c=>eI(c)==="image")),i=u.ref(!1),a=u.ref(0);function o(c){return eI(c)==="image"}function s(c){return Ws(c.original_url,{width:zR})}function l(c){a.value=n.value.findIndex(h=>h.original_url===c.original_url),i.value=!0}function g(c){return c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(1)} KB`:`${(c/(1024*1024)).toFixed(1)} MB`}return(c,h)=>(u.openBlock(),u.createElementBlock("section",JR,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.resources,C=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:C.original_url},[o(C)?(u.openBlock(),u.createElementBlock("button",{key:0,type:"button",class:"chat-attachments__item chat-attachments__image","aria-label":`预览 ${C.filename}`,onClick:I=>l(C)},[u.createElementVNode("img",{src:s(C),alt:C.filename,loading:"lazy"},null,8,HR)],8,OR)):(u.openBlock(),u.createElementBlock("button",{key:1,type:"button",class:"chat-attachments__item chat-attachments__file","aria-label":`预览 ${C.filename}`,onClick:I=>r("preview",C)},[u.createElementVNode("img",{class:"chat-attachments__file-icon",src:u.unref(Gm)(C.url_type||C.filename,C.original_url),alt:"","aria-hidden":"true"},null,8,ZR),u.createElementVNode("span",KR,[u.createElementVNode("span",qR,u.toDisplayString(C.filename),1),u.createElementVNode("span",PR,u.toDisplayString(g(C.size)),1)]),u.createElementVNode("span",WR,u.toDisplayString(C.url_type.toUpperCase()),1)],8,VR))],64))),128)),u.createVNode(Sb,{open:i.value,"onUpdate:open":h[0]||(h[0]=C=>i.value=C),index:a.value,"onUpdate:index":h[1]||(h[1]=C=>a.value=C),images:n.value},null,8,["open","index","images"])]))}}),Nb=Be(XR,[["__scopeId","data-v-9a79734c"]]),jR={key:0,class:"chat-follow-ups",role:"group","aria-label":"推荐追问","data-testid":"chat-follow-ups"},$R=["onClick","onKeydown"],AG={class:"chat-follow-ups__line"},eG=3,tG=u.defineComponent({name:"ChatFollowUps",__name:"ChatFollowUps",props:{questions:{}},emits:["select"],setup(e,{emit:A}){const t=e,r=A,n=u.computed(()=>t.questions.map(o=>o.trim()).filter(Boolean).slice(0,eG));function i(o){r("select",o)}function a(o,s){o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),i(s))}return(o,s)=>n.value.length?(u.openBlock(),u.createElementBlock("div",jR,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(n.value,(l,g)=>(u.openBlock(),u.createElementBlock("div",{key:`${g}:${l}`,role:"button",tabindex:"0",class:"chat-follow-ups__chip",onClick:c=>i(l),onKeydown:c=>a(c,l)},[u.createElementVNode("span",AG,u.toDisplayString(l),1)],40,$R))),128))])):u.createCommentVNode("",!0)}}),Fb=Be(tG,[["__scopeId","data-v-cdf11c56"]]),rG=["data-open"],nG=["data-expandable","role","tabindex","aria-expanded"],iG=["aria-expanded"],aG={class:"dsh-disclosure__icon-idle"},oG={key:1,class:"dsh-disclosure__leading"},sG={class:"dsh-disclosure__icon-idle"},lG={class:"dsh-disclosure__title"},gG=u.defineComponent({name:"HarnessDisclosureRow",__name:"DisclosureRow",props:{title:{},open:{type:Boolean},expandable:{type:Boolean,default:!0},expandOnRowClick:{type:Boolean,default:!0},previewChevron:{type:Boolean,default:void 0},keepContentWhenOpen:{type:Boolean,default:!1}},emits:["toggle"],setup(e,{emit:A}){const t=e,r=A,n=()=>t.previewChevron===void 0?t.expandable:t.previewChevron;function i(){t.expandable&&t.expandOnRowClick&&r("toggle")}function a(s){!t.expandable||!t.expandOnRowClick||s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),r("toggle"))}function o(s){s.stopPropagation(),r("toggle")}return(s,l)=>(u.openBlock(),u.createElementBlock("div",{class:"dsh-disclosure","data-open":e.open||void 0},[u.createElementVNode("div",{class:"dsh-disclosure__row","data-disclosure-row":"true","data-expandable":e.expandable&&e.expandOnRowClick?"true":void 0,role:e.expandable&&e.expandOnRowClick?"button":void 0,tabindex:e.expandable&&e.expandOnRowClick?0:void 0,"aria-expanded":e.expandable&&e.expandOnRowClick?e.open:void 0,onClick:i,onKeydown:a},[e.expandable&&!e.expandOnRowClick?(u.openBlock(),u.createElementBlock("button",{key:0,type:"button",class:"dsh-disclosure__leading","aria-expanded":e.open,onClick:o},[e.open?(u.openBlock(),u.createBlock(u.unref(eu),{key:0,class:"dsh-disclosure__chevron",size:14})):n()?(u.openBlock(),u.createElementBlock(u.Fragment,{key:1},[u.createElementVNode("span",aG,[u.renderSlot(s.$slots,"icon",{},void 0,!0)]),u.createVNode(u.unref(eu),{class:"dsh-disclosure__chevron dsh-disclosure__chevron-hover",size:14})],64)):u.renderSlot(s.$slots,"icon",{key:2},void 0,!0)],8,iG)):(u.openBlock(),u.createElementBlock("span",oG,[e.open?(u.openBlock(),u.createBlock(u.unref(eu),{key:0,class:"dsh-disclosure__chevron",size:14})):e.expandable&&n()?(u.openBlock(),u.createElementBlock(u.Fragment,{key:1},[u.createElementVNode("span",sG,[u.renderSlot(s.$slots,"icon",{},void 0,!0)]),u.createVNode(u.unref(eu),{class:"dsh-disclosure__chevron dsh-disclosure__chevron-hover",size:14})],64)):u.renderSlot(s.$slots,"icon",{key:2},void 0,!0)])),u.createElementVNode("span",lG,u.toDisplayString(e.title),1),e.keepContentWhenOpen||!e.open?u.renderSlot(s.$slots,"collapsed",{key:2},void 0,!0):u.createCommentVNode("",!0)],40,nG),e.open?u.renderSlot(s.$slots,"default",{key:0},void 0,!0):u.createCommentVNode("",!0)],8,rG))}}),cG=Be(gG,[["__scopeId","data-v-818f93d8"]]),uG=["data-state","aria-busy"],CG=["data-follow-end"],hG={key:0,class:"chat-reasoning__body"},IG=u.defineComponent({name:"ChatReasoning",__name:"ChatReasoning",props:{content:{},streaming:{type:Boolean}},setup(e){const A=e,t=u.ref(!1),r=u.ref(),n=u.computed(()=>!!A.content.trim()),i=u.computed(()=>{const l=A.content;if(!l.trim())return"";if(A.streaming){const c=l.trimEnd(),h=c.lastIndexOf(`
|
|
132
132
|
`);return h===-1?c:c.slice(h+1)}const g=l.indexOf(`
|
|
133
|
-
`);return g===-1?l:l.slice(0,g)}),a=u.computed(()=>n.value),o=u.computed(()=>A.streaming?"
|
|
133
|
+
`);return g===-1?l:l.slice(0,g)}),a=u.computed(()=>n.value),o=u.computed(()=>A.streaming?"思考中...":"思考过程");u.watch([()=>A.streaming,i],async()=>{await u.nextTick();const l=r.value;l&&(l.scrollLeft=A.streaming?l.scrollWidth-l.clientWidth:0)},{flush:"post"});function s(){a.value&&(t.value=!t.value)}return(l,g)=>(u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["chat-reasoning",{"chat-reasoning--empty":!n.value}]),"data-variant":"think","data-state":e.streaming?"running":"ok","aria-busy":e.streaming?"true":void 0,"aria-label":"思考过程"},[u.createVNode(cG,{title:o.value,open:t.value,expandable:a.value,"expand-on-row-click":"","keep-content-when-open":!1,onToggle:s},{icon:u.withCtx(()=>[u.createVNode(u.unref($_),{size:14})]),collapsed:u.withCtx(()=>[i.value?(u.openBlock(),u.createElementBlock(u.Fragment,{key:0},[g[0]||(g[0]=u.createElementVNode("span",{class:"chat-reasoning__sep","aria-hidden":"true"},null,-1)),u.createElementVNode("span",{ref_key:"summaryRef",ref:r,class:"chat-reasoning__summary","data-follow-end":e.streaming||void 0},u.toDisplayString(i.value),9,CG)],64)):u.createCommentVNode("",!0)]),default:u.withCtx(()=>[n.value?(u.openBlock(),u.createElementBlock("div",hG,u.toDisplayString(e.content),1)):u.createCommentVNode("",!0)]),_:1},8,["title","open","expandable"])],10,uG))}}),vp=Be(IG,[["__scopeId","data-v-7d7f01a4"]]),dG=["aria-label"],fG={class:"conversation-chart__title"},BG={class:"conversation-chart__rows",role:"list"},QG={class:"conversation-chart__label"},pG={class:"conversation-chart__bar-wrap"},EG={class:"conversation-chart__value"},mG=u.defineComponent({name:"ChartToolRenderer",__name:"ChartToolRenderer",props:{result:{}},setup(e){const A=e,t=u.computed(()=>{const i=n(A.result)?A.result:{},o=(Array.isArray(i.data)?i.data:[]).flatMap(l=>!n(l)||typeof l.label!="string"||typeof l.value!="number"?[]:[{label:l.label,value:l.value}]),s=Math.max(1,...o.map(l=>l.value));return{title:typeof i.title=="string"?i.title:"图表结果",rows:o,maxValue:s}});function r(i){return`${Math.max(0,Math.min(100,i/t.value.maxValue*100))}%`}function n(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}return(i,a)=>t.value.rows.length?(u.openBlock(),u.createElementBlock("section",{key:0,class:"conversation-chart","aria-label":t.value.title},[u.createElementVNode("strong",fG,u.toDisplayString(t.value.title),1),u.createElementVNode("div",BG,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(t.value.rows,o=>(u.openBlock(),u.createElementBlock("div",{key:o.label,class:"conversation-chart__row",role:"listitem"},[u.createElementVNode("span",QG,u.toDisplayString(o.label),1),u.createElementVNode("span",pG,[u.createElementVNode("span",{class:"conversation-chart__bar",style:u.normalizeStyle({width:r(o.value)})},null,4)]),u.createElementVNode("span",EG,u.toDisplayString(o.value),1)]))),128))])],8,dG)):u.createCommentVNode("",!0)}}),xb=Be(mG,[["__scopeId","data-v-db9fb284"]]);function vG(e){const A=e.trim();if(!A)return"";if(_b(A))return yp(A);const t=gl(A);if(t)return wp(f2(t));try{return wp(f2(JSON.parse(A)))}catch{return Mb(e)}}function gl(e){const A=e.trim();if(!A)return null;try{let t=JSON.parse(A);if(typeof t=="string"){const r=t.trim();if(!r)return null;try{t=JSON.parse(r)}catch{return null}}return tI(t)?t:null}catch{return null}}function _b(e){const A=e.trim();if(!A)return!1;const t=gl(A);return t?typeof t.mdoc=="string"&&t.mdoc.includes("ask-form")?!0:typeof t.desc=="string"&&typeof t.mdoc=="string":A.includes('"mdoc"')&&(A.includes("ask-form")||A.includes('"desc"'))}function yp(e){const A=e.trim();if(!A)return"";const t=gl(A);return t&&typeof t.desc=="string"?t.desc:yG(A,"desc")??""}function yG(e,A){const r=new RegExp(`"${wG(A)}"\\s*:\\s*"((?:\\\\.|[^"\\\\])*)"`).exec(e);if(!(r!=null&&r[1]))return null;try{return JSON.parse(`"${r[1]}"`)}catch{return Mb(r[1])}}function wG(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f2(e){if(!tI(e)||!("mdoc"in e))return e;const A={...e};return delete A.mdoc,A}function wp(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||e===null)return String(e);if(Array.isArray(e))return e.map(A=>wp(A)).join(`
|
|
134
134
|
`);if(tI(e)){const A=Object.entries(e);if(A.length===1){const[t,r]=A[0];if(typeof r=="string"&&r.includes(`
|
|
135
135
|
`))return`${t}:
|
|
136
136
|
${r}`}return A.map(([t,r])=>{if(typeof r=="string")return r.includes(`
|
package/dist/index.js
CHANGED
|
@@ -3267,7 +3267,7 @@ const KR = [
|
|
|
3267
3267
|
const l = g.indexOf(`
|
|
3268
3268
|
`);
|
|
3269
3269
|
return l === -1 ? g : g.slice(0, l);
|
|
3270
|
-
}), a = J(() => r.value), o = J(() => A.streaming ? "
|
|
3270
|
+
}), a = J(() => r.value), o = J(() => A.streaming ? "思考中..." : "思考过程");
|
|
3271
3271
|
Ke(
|
|
3272
3272
|
[() => A.streaming, n],
|
|
3273
3273
|
async () => {
|
|
@@ -3319,7 +3319,7 @@ const KR = [
|
|
|
3319
3319
|
}, 8, ["title", "open", "expandable"])
|
|
3320
3320
|
], 10, vG));
|
|
3321
3321
|
}
|
|
3322
|
-
}), H2 = /* @__PURE__ */ xe(wG, [["__scopeId", "data-v-
|
|
3322
|
+
}), H2 = /* @__PURE__ */ xe(wG, [["__scopeId", "data-v-7d7f01a4"]]), DG = ["aria-label"], bG = { class: "conversation-chart__title" }, kG = {
|
|
3323
3323
|
class: "conversation-chart__rows",
|
|
3324
3324
|
role: "list"
|
|
3325
3325
|
}, SG = { class: "conversation-chart__label" }, FG = { class: "conversation-chart__bar-wrap" }, xG = { class: "conversation-chart__value" }, NG = /* @__PURE__ */ $A({
|