PageSourceSearch

https://itick.org/_nuxt/C-xzRo6u.js

js itick.org collected 2026-10-02 06:58:32 UTC 11,056 bytes, 1 lines download raw bytes

1import{_ as gt}from"./Cee86i8R.js";import{d as vt,u as yt,as as Ct,i as ft,E as v,aC as _t,k as y,aD as wt,J as kt,an as bt,p as xt,c as m,f as H,b as o,g as n,w as Tt,S as At,aT as Et,aU as Mt,aQ as K,aM as St,o as g,e as Ht,F as q,r as P,aN as qt,a9 as B,t as _,av as R,aP as V,aK as Bt,aV as It,aW as Dt,aX as Lt,z as $t}from"./DkdofgM8.js";import{_ as Ot}from"./CHpAbve8.js";const zt={class:"history-content"},Kt={class:"history-scroll-area"},Pt={class:"history-list"},Rt={class:"history-item-main"},Vt=["onClick","onKeydown"],Nt={key:0,class:"history-title-highlight"},Zt={key:1},jt={class:"history-summary"},Ut={class:"history-date"},Ft={class:"history-actions"},Wt=["title","onClick"],Jt=["title","onClick"],Qt={key:0,class:"history-empty"},Xt={class:"history-empty-title"},Yt={class:"history-empty-desc"},Gt=vt({__name:"agentHistory",props:{sidebarOpen:{type:Boolean}},emits:["toggleSidebar"],setup(N,{emit:Z}){const j=N,U=Z,{t:i}=yt(),F=Ct(),{$message:d,$aiToast:w}=ft(),{confirm:I}=Bt(),W=v(()=>j.sidebarOpen!==!1),D=v(()=>_t(F.path)),k=y(""),J=wt("ai-theme",{default:()=>"light",sameSite:"lax",path:"/",maxAge:60*60*24*365}),C=v(()=>J.value||"light"),Q=v(()=>C.value==="dark"?"rgba(255, 255, 255, 0.18)":"rgba(0, 0, 0, 0.22)"),X=v(()=>C.value==="dark"?"rgba(255, 255, 255, 0.32)":"rgba(0, 0, 0, 0.38)"),Y=v(()=>"transparent"),G=()=>R(V(D.value)),b=y([]),S=y(""),x=y(""),f=y(""),E=y(!1),T=y(!1),A=e=>
1String(e).padStart(2,"0"),tt=e=>{const t=new Date(e),r=t.getFullYear(),l=A(t.getMonth()+1),s=A(t.getDate()),a=A(t.getHours()),c=A(t.getMinutes()),p=A(t.getSeconds());return`${r}-${l}-${s} ${a}:${c}:${p}`},et=/<think>[\s\S]*?(?:<\/think>|$)/gi,at=/```[\s\S]*?```/g,it=/^\s*\|?(?:\s*:?-+:?\s*\|)+\s*:?-+:?\s*\|?\s*$/,L=e=>String(e||"").replace(et," ").replace(at," ").split(/\r?\n/).map(l=>l.trim()).filter(Boolean).filter(l=>!it.test(l)).filter(l=>(l.match(/\|/g)||[]).length<2).map(l=>l.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]*)`/g,"$1").replace(/<[^>]+>/g," ").replace(/^\s{0,3}(#{1,6}\s+)/,"").replace(/^\s{0,3}>\s?/,"").replace(/^\s{0,3}(?:[-*+]\s+|\d+\.\s+)/,"").replace(/[*_~]+/g,"").replace(/\s+/g," ").trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim(),ot=(e,t=400)=>{const r=String(e||"");return r.length<=t?r:`${r.slice(0,t)}...`},u=async()=>{const e=await Et(80),t=await Promise.all(e.map(async r=>{const l=r.chatId,s=await Mt(l),a=s.find(h=>h.role==="user"||h.kind==="user"),c=s.find(h=>h.role==="assistant"&&h.messageId),p=c==null?void 0:c.messageId,ut=p?s.filter(h=>h.role==="assistant"&&h.messageId===p).map(h=>h.content||"").join(""):"",pt=r.title||K((a==null?void 0:a.content)||"")||l,mt=ot(L(ut),400)||L(i("aiChat.emptyDesc"));return{id:l,title:pt,summary:mt,updatedAt:r.updatedAt}}));b.value=t.sort((r,l)=>l.updatedAt-r.updatedAt)},st=(e,t,r)=>{const l=b.value.map(s=>s.id===e?{...s,title:t,updatedAt:r}:s).sort((s,a)=>a.updatedAt-s.updatedAt);b.value=l},$=e=>{R(V(D.value,e))},nt=e=>{S.value=e.id,x.value=e.title,f.value="",E.value=!0},O=()=>{E.value=!1,T.value=!1,f.value="",S.value="",x.value=""},lt=async()=>{var r,l;const e=S.value;if(!e||T.value)return;const t=K(x.value);if(!t){f.value=i("aiChat.editTitle.required");return}T.value=!0,f.value="";try{const s=await Dt(e,t);if(!(s!=null&&s.title))throw new Error("Rename title failed");st(e,s.title,s.updatedAt),(r=w==null?void 0:w.success)==null||r.call(w,i("aiChat.editTitle.success")),O()}catch{f.value=i("aiChat.editTitle.failed"),(l=d==null?void 0:d.error)==null||l.call(d,i("aiChat.editTitle.failed")),T.value=!1}},z=v(()=>{const e=k.value.trim().toLowerCase();return e?b.value.filter(t=>t.title.toLowerCase().includes(e)):b.value}),rt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ct=e=>{const t=k.value.trim();if(!t)return[{text:e,highlight:!1}];const r=rt(t);if(!r)return[{text:e,highlight:!1}];const l=new RegExp(r,"gi"),s=[];let a=0,c=null;for(;(c=l.exec(e))!==null;){c.index>a&&s.push({text:e.slice(a,c.index),highlight:!1});const p=e.slice(c.index,c.index+c[0].length);s.push({text:p,highlight:!0}),a=c.index+c[0].length,c[0].length===0&&(l.lastIndex+=1)}return a<e.length&&s.push({text:e.slice(a),highlight:!1}),s.length?s:[{text:e,highlight:!1}]},dt=()=>{(async()=>{try{await I({title:i("aiChat.page.clearHistory"),description:i("aiChat.page.clearHistoryDescription"),confirmText:i("aiChat.subpage.clearAll"),cancelText:i("aiChat.deleteConfirm.cancel"),theme:C.value==="dark"?"dark":"light"})}catch{return}await Lt(),k.value="",await u()})()},ht=async e=>{var t;try{await I({title:i("aiChat.deleteConfirm.historyTitle"),description:i("aiChat.deleteConfirm.historyDescription"),confirmText:i("aiChat.deleteConfirm.confirm"),cancelText:i("aiChat.deleteConfirm.cancel"),theme:C.value==="dark"?"dark":"light"})}catch{return}try{await It(e),await u()}catch{(t=d==null?void 0:d.error)==null||t.call(d,i("aiChat.deleteConfirm.deleteFailed"))}};let M=null;return kt(()=>{u(),M=bt(()=>void u(),2500),window.addEventListener("focus",u),document.addEventListener("visibilitychange",u)}),xt(()=>{M&&clearInterval(M),M=null,window.removeEventListener("focus",u),document.removeEventListener("visibilitychange",u)}),(e,t)=>{const r=gt,l=St,s=Ot;return g(),m("section",{class:At(["ai-agent-placeholder",{"theme-dark":n(C)==="dark"}])},[H(r,{"sidebar-open":n(W),title:n(i)("aiChat.subpage.historyTitle"),"show-back-button":!0,"show-search":!0,"show-header-action":!0,"header-action-label":n(i)("aiChat.subpage.clearAll"),"header-action-title":n(i)("aiChat.subpage.clearAll"),"search-value":n(k),"search-placeholder":n(i)("aiChat.subpage.searchPlaceholder"),"back-button-title":n(i)("aiChat.page.backToHome"),onToggleSidebar:t[0]||(t[0]=a=>U("toggleSidebar")),onBack:G,onHeaderAction:dt,"onUpdate:searchValue":t[1]||(t[1]=a=>k.value=a)},null,8,["sidebar-open","title","header-action-label","header-action-title","search-value","search-placeholder","back-button-title"]),o("div",zt,[H(l,{class:"history-scrollbar",height:"100%",width:"100%","auto-hide":!0,"thumb-color":n(Q),"thumb
1-hover-color":n(X),"track-color":n(Y)},{default:Tt(()=>[o("div",Kt,[o("div",Pt,[(g(!0),m(q,null,P(n(z),a=>(g(),m("div",{key:a.id,class:"history-item"},[o("div",Rt,[o("h3",{class:"history-title",role:"button",tabindex:"0",onClick:c=>$(a.id),onKeydown:qt(B(c=>$(a.id),["prevent"]),["enter"])},[(g(!0),m(q,null,P(ct(a.title),(c,p)=>(g(),m(q,{key:`${a.id}-${p}`},[c.highlight?(g(),m("span",Nt,_(c.text),1)):(g(),m("span",Zt,_(c.text),1))],64))),128))],40,Vt),o("p",jt,_(a.summary),1),o("div",Ut,_(tt(a.updatedAt)),1)]),o("div",Ft,[o("button",{class:"history-action-btn",title:n(i)("aiChat.editTitle.edit"),type:"button",onClick:B(c=>nt(a),["stop"])},[...t[4]||(t[4]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12 20h9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M16.5 3.5a2.121 2.121 0 113 3L7 19l-4 1 1-4 12.5-12.5z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,Wt),o("button",{class:"history-action-btn is-delete",title:n(i)("aiChat.action.delete"),type:"button",onClick:B(c=>ht(a.id),["stop"])},[...t[5]||(t[5]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M19 7l-.867 12.142A2 2 0 0 1 16.138 21H7.862a2 2 0 0 1-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v3M4 7h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,Jt)])]))),128)),n(z).length===0?(g(),m("div",Qt,[t[6]||(t[6]=o("div",{class:"history-empty-icon","aria-hidden":"true"},[o("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z",fill:"var(--history-empty-icon-bg)"}),o("path",{d:"M295.0912 247.168m42.368 0l342.5152 0q42.368 0 42.368 42.368l0 444.9152q0 42.368-42.368 42.368l-342.5152 0q-42.368 0-42.368-42.368l0-444.9152q0-42.368 42.368-42.368Z",fill:"var(--history-empty-icon-paper)"}),o("path",{d:"M257.7664 702.6688h394.4576v25.152c0 15.5136 5.6704 30.4896 15.9616 42.112l6.2464 7.0656L300.1344 776.832A42.4192 42.4192 0 0 1 257.7664 734.4512v-31.7824z",fill:"var(--history-empty-icon-shadow)"}
1),o("path",{d:"M556.3904 331.9168m12.3648 0l84.736 0q12.3648 0 12.3648 12.3648l0-0.0128q0 12.3648-12.3648 12.3648l-84.736 0q-12.3648 0-12.3648-12.3648l0 0.0128q0-12.3648 12.3648-12.3648Z",fill:"var(--history-empty-icon-muted)",opacity:".82"}),o("path",{d:"M348.0576 504.9344m12.3648 0l300.1216 0q12.3648 0 12.3648 12.3648l0-0.0128q0 12.3648-12.3648 12.3648l-300.1216 0q-12.3648 0-12.3648-12.3648l0 0.0128q0-12.3648 12.3648-12.3648Z",fill:"var(--history-empty-icon-muted)",opacity:".82"}),o("path",{d:"M348.0576 593.2032m12.3648 0l300.1216 0q12.3648 0 12.3648 12.3648l0-0.0128q0 12.3648-12.3648 12.3648l-300.1216 0q-12.3648 0-12.3648-12.3648l0 0.0128q0-12.3648 12.3648-12.3648Z",fill:"var(--history-empty-icon-muted)",opacity:".82"}),o("path",{d:"M681.7408 594.9824m-79.4496 0a79.4496 79.4496 0 1 0 158.8992 0 79.4496 79.4496 0 1 0-158.8992 0Z",fill:"var(--history-empty-icon-accent-soft)"}),o("path",{d:"M771.648 644.1728c3.7504 3.584 7.8848 7.424 11.904 11.4176 14.5664 14.5152 29.0944 29.056 43.6096 43.6224 10.4576 10.4832 10.9312 25.2544 1.152 35.1232-9.8432 9.984-24.7552 9.5104-35.392-1.1136-17.5872-17.6-35.2256-35.1616-52.736-52.864-2.176-2.2016-3.584-2.3552-6.336-0.832C671.2576 714.0224 595.6736 679.8848 580.0064 610.1248c-12.672-56.448 25.1776-113.28 82.9184-124.48 59.4816-11.5456 117.0048 31.0912 123.392 91.3024a103.6928 103.6928 0 0 1-13.2864 63.5904c-0.3712 0.64-0.7424 1.28-1.0496 1.9584-0.128 0.256-0.128 0.5632-0.3456 1.6768zM682.1504 660.9664c40.5248-0.3072 72.8832-32.6912 72.704-72.8064-0.192-40.0768-33.152-72.4864-73.3568-72.1664-39.7568 0.3328-71.7568 33.2288-71.552 73.5104 0.2176 39.0016 33.3056 71.7568 72.2048 71.4624z",fill:"var(--history-empty-icon-accent)"}),o("path",{d:"M627.008 589.6832c0.0512-33.664 28.8256-57.6768 56.2688-56.448 0.0768 1.28 0.2048 2.6112 0.2048 3.9168 0.0384 3.8912 0.0256 7.7824 0.0256 11.6224-26.3168 2.304-39.5008 20.288-40.7424 40.9088h-15.744z",fill:"var(--history-empty-icon-highlight)"})])],-1)),o("div",Xt,_(n(i)("aiChat.page.noHistory")),1),o("div",Yt,_(n(i)("aiChat.emptyDesc")),1)])):Ht("",!0)])])]),_:1},8,["thumb-color","thumb-hover-color","track-color"])]),H(s,{"model-value":n(E),value:n(x),title:n(i)("aiChat.editTitle.dialogTitle"),placeholder:n(i)("aiChat.editTitle.placeholder"),"confirm-text":n(i)("aiChat.editTitle.save"),"cancel-text":n(i)("aiChat.editTitle.cancel"),"saving-text":n(i)("aiChat.editTitle.saving"),"error-message":n(f),saving:n(T),theme:n(C)==="dark"?"dark":"light","onUpdate:modelValue":t[2]||(t[2]=a=>E.value=a),"onUpdate:value":t[3]||(t[3]=a=>x.value=a),onCancel:O,onConfirm:lt},null,8,["model-value","value","title","placeholder","confirm-text","cancel-text","saving-text","error-message","saving","theme"])],2)}}}),ie=$t(Gt,[["__scopeId","data-v-d0d4d476"]]);export{ie as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.