2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
var m=(i,t,o)=>new Promise((a,s)=>{var l=n=>{try{e(o.next(n))}catch(c){s(c)}},r=n=>{try{e(o.throw(n))}catch(c){s(c)}},e=n=>n.done?a(n.value):Promise.resolve(n.value).then(l,r);e((o=o.apply(i,t)).next())});import{a9 as w,an as f,am as C,ac as k}from"./bootstrap-DO1fwVR8.js";import{m as b,c$ as M,b9 as y,aa as p,v as H,ad as x,b2 as g,ac as h,ae as d,bL as S,j as _,u,bp as $,aR as j,ab as L}from"../jse/index-index-WYMMa-75.js";import{H as v}from"./index-Tl_mfZZw.js";import{M as R}from"./index-B2ey4j0C.js";const z=["innerHTML"],B=b({__name:"markdown-view",props:{content:{}},setup(i){const t=i,{copy:o}=M(),a=y(null),s=new R({highlight(r,e){if(e&&v.getLanguage(e))try{return`<pre style="position: relative;">${`<div id="copy" data-copy='${r}' style="position: absolute; right: 10px; top: 5px; color: #fff;cursor: pointer;">复制</div>`}<code class="hljs">${v.highlight(r,{language:e,ignoreIllegals:!0}).value}</code></pre>`}catch(n){}return""}}),l=p(()=>s.render(t.content));return H(()=>m(null,null,function*(){var r;(r=a.value)==null||r.addEventListener("click",e=>{var n,c;e.target.id==="copy"&&(o((c=(n=e.target)==null?void 0:n.dataset)==null?void 0:c.copy),w.success("复制成功!"))})})),(r,e)=>(g(),x("div",{ref_key:"contentRef",ref:a,class:"markdown-view",innerHTML:l.value},null,8,z))}}),E={key:0,class:"mt-2.5"},I={class:"flex items-center gap-1.5 text-sm font-medium text-gray-700"},T={class:"scrollbar-thin max-h-[300px] overflow-y-auto rounded-b-lg border border-t-0 border-gray-200/60 bg-white/70 p-3 shadow-sm backdrop-blur-sm"},N=b({__name:"reasoning",props:{content:{},reasoningContent:{}},setup(i){const t=i,o=y(!0),a=p(()=>t.reasoningContent&&t.reasoningContent.trim()!==""),s=p(()=>{const r=t.reasoningContent&&t.reasoningContent.trim()!=="",e=t.content&&t.content.trim()!=="";return r&&!e?"深度思考中":"已深度思考"});function l(){o.value=!o.value}return(r,e)=>a.value?(g(),x("div",E,[d("div",{class:"flex cursor-pointer items-center justify-between rounded-t-lg border border-b-0 border-gray-200/60 bg-gradient-to-r from-blue-50 to-purple-50 p-2 transition-all duration-200 hover:from-blue-100 hover:to-purple-100",onClick:l},[d("div",I,[_(u(f),{icon:"lucide:brain",class:"text-blue-600",size:16}),d("span",null,$(s.value),1)]),_(u(f),{icon:"lucide:chevron-down",class:j(["text-gray-500 transition-transform duration-200",{"rotate-180":o.value}]),size:14},null,8,["class"])]),S(d("div",T,[t.reasoningContent?(g(),L(u(B),{key:0,class:"text-sm leading-relaxed text-gray-700",content:t.reasoningContent},null,8,["content"])):h("",!0)],512),[[C,o.value]])])):h("",!0)}}),V=k(N,[["__scopeId","data-v-fefafea0"]]),A=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{V as M,B as _,A as r};
|