autoglm-gui 1.5.1__py3-none-any.whl → 1.5.2__py3-none-any.whl
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.
- AutoGLM_GUI/__init__.py +1 -1
- AutoGLM_GUI/__main__.py +11 -2
- AutoGLM_GUI/adb_plus/qr_pair.py +3 -3
- AutoGLM_GUI/agents/__init__.py +7 -2
- AutoGLM_GUI/agents/factory.py +46 -6
- AutoGLM_GUI/agents/glm/agent.py +2 -2
- AutoGLM_GUI/agents/glm/async_agent.py +515 -0
- AutoGLM_GUI/agents/glm/parser.py +4 -2
- AutoGLM_GUI/agents/protocols.py +111 -1
- AutoGLM_GUI/agents/stream_runner.py +4 -5
- AutoGLM_GUI/api/__init__.py +3 -1
- AutoGLM_GUI/api/agents.py +78 -37
- AutoGLM_GUI/api/devices.py +72 -0
- AutoGLM_GUI/api/layered_agent.py +9 -8
- AutoGLM_GUI/api/mcp.py +6 -4
- AutoGLM_GUI/config_manager.py +38 -1
- AutoGLM_GUI/device_manager.py +28 -4
- AutoGLM_GUI/device_metadata_manager.py +174 -0
- AutoGLM_GUI/devices/mock_device.py +8 -1
- AutoGLM_GUI/phone_agent_manager.py +145 -32
- AutoGLM_GUI/scheduler_manager.py +6 -6
- AutoGLM_GUI/schemas.py +89 -0
- AutoGLM_GUI/scrcpy_stream.py +2 -1
- AutoGLM_GUI/static/assets/{about-CfwX1Cmc.js → about-D7r9gCvG.js} +1 -1
- AutoGLM_GUI/static/assets/{alert-dialog-CtGlN2IJ.js → alert-dialog-BKM-yRiQ.js} +1 -1
- AutoGLM_GUI/static/assets/chat-k6TTD7PW.js +129 -0
- AutoGLM_GUI/static/assets/{circle-alert-t08bEMPO.js → circle-alert-sohSDLhl.js} +1 -1
- AutoGLM_GUI/static/assets/{dialog-FNwZJFwk.js → dialog-BgtPh0d5.js} +1 -1
- AutoGLM_GUI/static/assets/{eye-D0UPWCWC.js → eye-DLqKbQmg.js} +1 -1
- AutoGLM_GUI/static/assets/{history-CRo95B7i.js → history-Bv1lfGUU.js} +1 -1
- AutoGLM_GUI/static/assets/index-CxWwh1VO.js +1 -0
- AutoGLM_GUI/static/assets/{index-CTHbFvKl.js → index-SysdKciY.js} +5 -5
- AutoGLM_GUI/static/assets/label-DTUnzN4B.js +1 -0
- AutoGLM_GUI/static/assets/{logs-RW09DyYY.js → logs-BIhnDizW.js} +1 -1
- AutoGLM_GUI/static/assets/{popover--JTJrE5v.js → popover-CikYqu2P.js} +1 -1
- AutoGLM_GUI/static/assets/scheduled-tasks-B-KBsGbl.js +1 -0
- AutoGLM_GUI/static/assets/{textarea-PRmVnWq5.js → textarea-knJZrz77.js} +1 -1
- AutoGLM_GUI/static/assets/workflows-DzcSYwLZ.js +1 -0
- AutoGLM_GUI/static/index.html +1 -1
- {autoglm_gui-1.5.1.dist-info → autoglm_gui-1.5.2.dist-info}/METADATA +10 -1
- {autoglm_gui-1.5.1.dist-info → autoglm_gui-1.5.2.dist-info}/RECORD +44 -43
- AutoGLM_GUI/static/assets/chat-BYa-foUI.js +0 -129
- AutoGLM_GUI/static/assets/index-BaLMSqd3.js +0 -1
- AutoGLM_GUI/static/assets/label-DJFevVmr.js +0 -1
- AutoGLM_GUI/static/assets/scheduled-tasks-DTRKsQXF.js +0 -1
- AutoGLM_GUI/static/assets/square-pen-CPK_K680.js +0 -1
- AutoGLM_GUI/static/assets/workflows-CdcsAoaT.js +0 -1
- {autoglm_gui-1.5.1.dist-info → autoglm_gui-1.5.2.dist-info}/WHEEL +0 -0
- {autoglm_gui-1.5.1.dist-info → autoglm_gui-1.5.2.dist-info}/entry_points.txt +0 -0
- {autoglm_gui-1.5.1.dist-info → autoglm_gui-1.5.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./index-
|
|
1
|
+
import{o as e}from"./index-SysdKciY.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],o=e("circle-alert",c);export{o as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as ae,r as i,j as u,b as S,G as de,y as G,P as F,E as et,x as tt,A as Y,H as oe,ak as nt,D as _,z as rt,al as at,ao as ot}from"./index-CTHbFvKl.js";const it=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=ae("loader-circle",it);const ct=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],On=ae("trash-2",ct);const st=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],lt=ae("x",st),ut=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("rounded-2xl border border-slate-200 bg-white text-slate-950 shadow-sm dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",e),...t}));ut.displayName="Card";const dt=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("flex flex-col space-y-1.5 p-6",e),...t}));dt.displayName="CardHeader";const ft=i.forwardRef(({className:e,...t},n)=>u.jsx("h3",{ref:n,className:S("text-xl font-semibold leading-none tracking-tight",e),...t}));ft.displayName="CardTitle";const vt=i.forwardRef(({className:e,...t},n)=>u.jsx("p",{ref:n,className:S("text-sm text-slate-500 dark:text-slate-400",e),...t}));vt.displayName="CardDescription";const mt=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("p-6 pt-0",e),...t}));mt.displayName="CardContent";const pt=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("flex items-center p-6 pt-0",e),...t}));pt.displayName="CardFooter";var Z="focusScope.autoFocusOnMount",q="focusScope.autoFocusOnUnmount",fe={bubbles:!1,cancelable:!0},ht="FocusScope",we=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[c,y]=i.useState(null),h=de(a),m=de(o),f=i.useRef(null),p=G(t,s=>y(s)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let s=function(E){if(g.paused||!c)return;const C=E.target;c.contains(C)?f.current=C:T(f.current,{select:!0})},d=function(E){if(g.paused||!c)return;const C=E.relatedTarget;C!==null&&(c.contains(C)||T(f.current,{select:!0}))},v=function(E){if(document.activeElement===document.body)for(const w of E)w.removedNodes.length>0&&T(c)};document.addEventListener("focusin",s),document.addEventListener("focusout",d);const b=new MutationObserver(v);return c&&b.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",d),b.disconnect()}}},[r,c,g.paused]),i.useEffect(()=>{if(c){me.add(g);const s=document.activeElement;if(!c.contains(s)){const v=new CustomEvent(Z,fe);c.addEventListener(Z,h),c.dispatchEvent(v),v.defaultPrevented||(gt(wt(xe(c)),{select:!0}),document.activeElement===s&&T(c))}return()=>{c.removeEventListener(Z,h),setTimeout(()=>{const v=new CustomEvent(q,fe);c.addEventListener(q,m),c.dispatchEvent(v),v.defaultPrevented||T(s??document.body,{select:!0}),c.removeEventListener(q,m),me.remove(g)},0)}}},[c,h,m,g]);const x=i.useCallback(s=>{if(!n&&!r||g.paused)return;const d=s.key==="Tab"&&!s.altKey&&!s.ctrlKey&&!s.metaKey,v=document.activeElement;if(d&&v){const b=s.currentTarget,[E,C]=yt(b);E&&C?!s.shiftKey&&v===C?(s.preventDefault(),n&&T(E,{select:!0})):s.shiftKey&&v===E&&(s.preventDefault(),n&&T(C,{select:!0})):v===b&&s.preventDefault()}},[n,r,g.paused]);return u.jsx(F.div,{tabIndex:-1,...l,ref:p,onKeyDown:x})});we.displayName=ht;function gt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(T(r,{select:t}),document.activeElement!==n)return}function yt(e){const t=xe(e),n=ve(t,e),r=ve(t.reverse(),e);return[n,r]}function xe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ve(e,t){for(const n of e)if(!bt(n,{upTo:t}))return n}function bt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Et(e){return e instanceof HTMLInputElement&&"select"in e}function T(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Et(e)&&t&&e.select()}}var me=Ct();function Ct(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=pe(e,t),e.unshift(t)},remove(t){e=pe(e,t),e[0]?.resume()}}}function pe(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function wt(e){return e.filter(t=>t.tagName!=="A")}var Q=0;function xt(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??he()),document.body.insertAdjacentElement("beforeend",e[1]??he()),Q++,()=>{Q===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Q--}},[])}function he(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R=function(){return R=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},R.apply(this,arguments)};function Se(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function St(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,o;r<a;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var U="right-scroll-bar-position",$="width-before-scroll-bar",Nt="with-scroll-bars-hidden",Rt="--removed-body-scroll-bar-size";function J(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Dt(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var kt=typeof window<"u"?i.useLayoutEffect:i.useEffect,ge=new WeakMap;function Tt(e,t){var n=Dt(null,function(r){return e.forEach(function(a){return J(a,r)})});return kt(function(){var r=ge.get(n);if(r){var a=new Set(r),o=new Set(e),l=n.current;a.forEach(function(c){o.has(c)||J(c,null)}),o.forEach(function(c){a.has(c)||J(c,l)})}ge.set(n,e)},[e]),n}function At(e){return e}function Pt(e,t){t===void 0&&(t=At);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var l=t(o,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(o),l=n}var y=function(){var m=l;l=[],m.forEach(o)},h=function(){return Promise.resolve().then(y)};h(),n={push:function(m){l.push(m),h()},filter:function(m){return l=l.filter(m),n}}}};return a}function Ot(e){e===void 0&&(e={});var t=Pt(null);return t.options=R({async:!0,ssr:!1},e),t}var Ne=function(e){var t=e.sideCar,n=Se(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,R({},n))};Ne.isSideCarExport=!0;function Mt(e,t){return e.useMedium(t),Ne}var Re=Ot(),ee=function(){},K=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:ee,onWheelCapture:ee,onTouchMoveCapture:ee}),a=r[0],o=r[1],l=e.forwardProps,c=e.children,y=e.className,h=e.removeScrollBar,m=e.enabled,f=e.shards,p=e.sideCar,g=e.noRelative,x=e.noIsolation,s=e.inert,d=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,E=e.gapMode,C=Se(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=p,D=Tt([n,t]),k=R(R({},C),a);return i.createElement(i.Fragment,null,m&&i.createElement(w,{sideCar:Re,removeScrollBar:h,shards:f,noRelative:g,noIsolation:x,inert:s,setCallbacks:o,allowPinchZoom:!!d,lockRef:n,gapMode:E}),l?i.cloneElement(i.Children.only(c),R(R({},k),{ref:D})):i.createElement(b,R({},k,{className:y,ref:D}),c))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K.classNames={fullWidth:$,zeroRight:U};var It=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ft(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=It();return t&&e.setAttribute("nonce",t),e}function _t(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function jt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Lt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ft())&&(_t(t,n),jt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Wt=function(){var e=Lt();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},De=function(){var e=Wt(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},Bt={left:0,top:0,right:0,gap:0},te=function(e){return parseInt(e||"",10)||0},Ht=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[te(n),te(r),te(a)]},Ut=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Bt;var t=Ht(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},$t=De(),I="data-scroll-locked",Vt=function(e,t,n,r){var a=e.left,o=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
1
|
+
import{o as ae,r as i,j as u,b as S,H as de,z as G,P as F,G as et,y as tt,D as Y,I as oe,al as nt,E as _,A as rt,am as at,ap as ot}from"./index-SysdKciY.js";const it=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=ae("loader-circle",it);const ct=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],On=ae("trash-2",ct);const st=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],lt=ae("x",st),ut=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("rounded-2xl border border-slate-200 bg-white text-slate-950 shadow-sm dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",e),...t}));ut.displayName="Card";const dt=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("flex flex-col space-y-1.5 p-6",e),...t}));dt.displayName="CardHeader";const ft=i.forwardRef(({className:e,...t},n)=>u.jsx("h3",{ref:n,className:S("text-xl font-semibold leading-none tracking-tight",e),...t}));ft.displayName="CardTitle";const vt=i.forwardRef(({className:e,...t},n)=>u.jsx("p",{ref:n,className:S("text-sm text-slate-500 dark:text-slate-400",e),...t}));vt.displayName="CardDescription";const mt=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("p-6 pt-0",e),...t}));mt.displayName="CardContent";const pt=i.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:S("flex items-center p-6 pt-0",e),...t}));pt.displayName="CardFooter";var Z="focusScope.autoFocusOnMount",q="focusScope.autoFocusOnUnmount",fe={bubbles:!1,cancelable:!0},ht="FocusScope",we=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[c,y]=i.useState(null),h=de(a),m=de(o),f=i.useRef(null),p=G(t,s=>y(s)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let s=function(E){if(g.paused||!c)return;const C=E.target;c.contains(C)?f.current=C:T(f.current,{select:!0})},d=function(E){if(g.paused||!c)return;const C=E.relatedTarget;C!==null&&(c.contains(C)||T(f.current,{select:!0}))},v=function(E){if(document.activeElement===document.body)for(const w of E)w.removedNodes.length>0&&T(c)};document.addEventListener("focusin",s),document.addEventListener("focusout",d);const b=new MutationObserver(v);return c&&b.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",d),b.disconnect()}}},[r,c,g.paused]),i.useEffect(()=>{if(c){me.add(g);const s=document.activeElement;if(!c.contains(s)){const v=new CustomEvent(Z,fe);c.addEventListener(Z,h),c.dispatchEvent(v),v.defaultPrevented||(gt(wt(xe(c)),{select:!0}),document.activeElement===s&&T(c))}return()=>{c.removeEventListener(Z,h),setTimeout(()=>{const v=new CustomEvent(q,fe);c.addEventListener(q,m),c.dispatchEvent(v),v.defaultPrevented||T(s??document.body,{select:!0}),c.removeEventListener(q,m),me.remove(g)},0)}}},[c,h,m,g]);const x=i.useCallback(s=>{if(!n&&!r||g.paused)return;const d=s.key==="Tab"&&!s.altKey&&!s.ctrlKey&&!s.metaKey,v=document.activeElement;if(d&&v){const b=s.currentTarget,[E,C]=yt(b);E&&C?!s.shiftKey&&v===C?(s.preventDefault(),n&&T(E,{select:!0})):s.shiftKey&&v===E&&(s.preventDefault(),n&&T(C,{select:!0})):v===b&&s.preventDefault()}},[n,r,g.paused]);return u.jsx(F.div,{tabIndex:-1,...l,ref:p,onKeyDown:x})});we.displayName=ht;function gt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(T(r,{select:t}),document.activeElement!==n)return}function yt(e){const t=xe(e),n=ve(t,e),r=ve(t.reverse(),e);return[n,r]}function xe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ve(e,t){for(const n of e)if(!bt(n,{upTo:t}))return n}function bt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Et(e){return e instanceof HTMLInputElement&&"select"in e}function T(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Et(e)&&t&&e.select()}}var me=Ct();function Ct(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=pe(e,t),e.unshift(t)},remove(t){e=pe(e,t),e[0]?.resume()}}}function pe(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function wt(e){return e.filter(t=>t.tagName!=="A")}var Q=0;function xt(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??he()),document.body.insertAdjacentElement("beforeend",e[1]??he()),Q++,()=>{Q===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Q--}},[])}function he(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R=function(){return R=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},R.apply(this,arguments)};function Se(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function St(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,o;r<a;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var U="right-scroll-bar-position",$="width-before-scroll-bar",Nt="with-scroll-bars-hidden",Rt="--removed-body-scroll-bar-size";function J(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Dt(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var kt=typeof window<"u"?i.useLayoutEffect:i.useEffect,ge=new WeakMap;function Tt(e,t){var n=Dt(null,function(r){return e.forEach(function(a){return J(a,r)})});return kt(function(){var r=ge.get(n);if(r){var a=new Set(r),o=new Set(e),l=n.current;a.forEach(function(c){o.has(c)||J(c,null)}),o.forEach(function(c){a.has(c)||J(c,l)})}ge.set(n,e)},[e]),n}function At(e){return e}function Pt(e,t){t===void 0&&(t=At);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var l=t(o,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(o){for(r=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(o),l=n}var y=function(){var m=l;l=[],m.forEach(o)},h=function(){return Promise.resolve().then(y)};h(),n={push:function(m){l.push(m),h()},filter:function(m){return l=l.filter(m),n}}}};return a}function Ot(e){e===void 0&&(e={});var t=Pt(null);return t.options=R({async:!0,ssr:!1},e),t}var Ne=function(e){var t=e.sideCar,n=Se(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,R({},n))};Ne.isSideCarExport=!0;function Mt(e,t){return e.useMedium(t),Ne}var Re=Ot(),ee=function(){},K=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:ee,onWheelCapture:ee,onTouchMoveCapture:ee}),a=r[0],o=r[1],l=e.forwardProps,c=e.children,y=e.className,h=e.removeScrollBar,m=e.enabled,f=e.shards,p=e.sideCar,g=e.noRelative,x=e.noIsolation,s=e.inert,d=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,E=e.gapMode,C=Se(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=p,D=Tt([n,t]),k=R(R({},C),a);return i.createElement(i.Fragment,null,m&&i.createElement(w,{sideCar:Re,removeScrollBar:h,shards:f,noRelative:g,noIsolation:x,inert:s,setCallbacks:o,allowPinchZoom:!!d,lockRef:n,gapMode:E}),l?i.cloneElement(i.Children.only(c),R(R({},k),{ref:D})):i.createElement(b,R({},k,{className:y,ref:D}),c))});K.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K.classNames={fullWidth:$,zeroRight:U};var It=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ft(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=It();return t&&e.setAttribute("nonce",t),e}function _t(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function jt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Lt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ft())&&(_t(t,n),jt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Wt=function(){var e=Lt();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},De=function(){var e=Wt(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},Bt={left:0,top:0,right:0,gap:0},te=function(e){return parseInt(e||"",10)||0},Ht=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[te(n),te(r),te(a)]},Ut=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Bt;var t=Ht(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},$t=De(),I="data-scroll-locked",Vt=function(e,t,n,r){var a=e.left,o=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
2
2
|
.`.concat(Nt,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(c,"px ").concat(r,`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as c}from"./index-
|
|
1
|
+
import{o as c}from"./index-SysdKciY.js";const e=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],n=c("chevron-right",e);const o=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],r=c("eye",o);export{n as C,r as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as K,u as de,r,p as xe,j as e,B as h,f as m,C as E,g as he,q as me,s as ge}from"./index-CTHbFvKl.js";import{T as F,L as H,C as ue,c as pe,D as je,d as fe,e as ye,f as Ne}from"./dialog-FNwZJFwk.js";import{S as ke,a as be,b as ve,c as we,d as R,A as z,e as B,f as V,g as q,h as I,i as J,j as U,k as X}from"./alert-dialog-CtGlN2IJ.js";import{C as Y,a as G,b as De}from"./popover--JTJrE5v.js";import{E as Se,C as Ce}from"./eye-D0UPWCWC.js";const Pe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Le=K("bot",Pe);const Ae=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_e=K("user",Ae);function Fe(){const t=de(),[N,Q]=r.useState([]),[n,k]=r.useState(""),[o,x]=r.useState([]),[W,b]=r.useState(!1),[v,w]=r.useState(!1),[D,g]=r.useState(0),[S,u]=r.useState(0),[Z,p]=r.useState(!1),[ee,j]=r.useState(!1),[f,C]=r.useState(null),[se,P]=r.useState(!1),[i,te]=r.useState(null),[y,L]=r.useState(new Set),ae=20;r.useEffect(()=>{(async()=>{try{const a=await he();Q(a),a.length>0&&!n&&k(a[0].serial)}catch(a){console.error("Failed to load devices:",a)}})()},[n]);const A=r.useCallback(async(s,a=!0)=>{if(s)try{a?(b(!0),u(0)):w(!0);const l=a?0:S,c=await xe(s,ae,l);x(a?c.records:d=>[...d,...c.records]),g(c.total),u(l+c.records.length)}catch(l){console.error("Failed to load history:",l)}finally{b(!1),w(!1)}},[S]);r.useEffect(()=>{n&&A(n,!0)},[n]);const le=()=>{n&&o.length<D&&A(n,!1)},re=async()=>{if(n){try{await me(n),x([]),g(0),u(0)}catch(s){console.error("Failed to clear history:",s)}p(!1)}},ne=async()=>{if(!(!n||!f)){try{await ge(n,f),x(s=>s.filter(a=>a.id!==f)),g(s=>s-1)}catch(s){console.error("Failed to delete record:",s)}j(!1),C(null)}},_=s=>{te(s);const a=new Set;s.messages.forEach(l=>{l.step!==null&&l.step!==void 0&&a.add(l.step)}),L(a),P(!0)},ie=s=>{L(a=>{const l=new Set(a);return l.has(s)?l.delete(s):l.add(s),l})},M=s=>s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}min`,ce=s=>{const a=new Date(s),l=new Date,c=a.toDateString()===l.toDateString(),d=new Date(l);d.setDate(d.getDate()-1);const oe=a.toDateString()===d.toDateString(),$=a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return c?`${t.history.today} ${$}`:oe?`${t.history.yesterday} ${$}`:a.toLocaleDateString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},T=s=>({chat:t.historyPage.source.chat,layered:t.historyPage.source.layered,scheduled:t.historyPage.source.scheduled})[s]||s,O=s=>{switch(s){case"chat":return"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300";case"layered":return"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300";case"scheduled":return"bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300";default:return"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"}};return e.jsxs("div",{className:"container mx-auto p-6 max-w-4xl",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold",children:t.historyPage.title}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(ke,{value:n,onValueChange:k,children:[e.jsx(be,{className:"w-[200px]",children:e.jsx(ve,{placeholder:t.historyPage.selectDevice})}),e.jsx(we,{children:N.length===0?e.jsx(R,{value:"_none",disabled:!0,children:t.historyPage.noDevices}):N.map(s=>e.jsx(R,{value:s.serial,children:s.model||s.serial},s.serial))})]}),o.length>0&&e.jsxs(h,{variant:"destructive",size:"sm",onClick:()=>p(!0),children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),t.historyPage.clearAll]})]})]}),W?e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(H,{className:"w-8 h-8 animate-spin text-slate-400"})}):o.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:t.historyPage.noRecords}),e.jsx("p",{className:"text-sm text-slate-400 dark:text-slate-500 mt-2",children:t.historyPage.noRecordsDesc})]}):e.jsxs("div",{className:"space-y-4",children:[o.map(s=>e.jsx(ue,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>_(s),children:e.jsx(pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 line-clamp-2 mb-2",children:s.task_text}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400 line-clamp-2 mb-3",children:s.final_message}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[s.success?e.jsxs(m,{variant:"outline",className:"text-green-600 border-green-300 dark:text-green-400 dark:border-green-700",children:[e.jsx(Y,{className:"w-3 h-3 mr-1"}),t.historyPage.success]}):e.jsxs(m,{variant:"outline",className:"text-red-600 border-red-300 dark:text-red-400 dark:border-red-700",children:[e.jsx(G,{className:"w-3 h-3 mr-1"}),t.historyPage.failed]}),e.jsxs(m,{className:O(s.source),children:[T(s.source),s.source_detail&&`: ${s.source_detail}`]}),s.steps>0&&e.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:t.historyPage.steps.replace("{count}",String(s.steps))}),e.jsxs("span",{className:"text-slate-500 dark:text-slate-400 flex items-center",children:[e.jsx(E,{className:"w-3 h-3 mr-1"}),M(s.duration_ms)]}),e.jsx("span",{className:"text-slate-400 dark:text-slate-500",children:ce(s.start_time)})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{variant:"ghost",size:"sm",className:"text-slate-400 hover:text-blue-500",onClick:a=>{a.stopPropagation(),_(s)},children:e.jsx(Se,{className:"w-4 h-4"})}),e.jsx(h,{variant:"ghost",size:"sm",className:"text-slate-400 hover:text-red-500",onClick:a=>{a.stopPropagation(),C(s.id),j(!0)},children:e.jsx(F,{className:"w-4 h-4"})})]})]})})},s.id)),o.length<D&&e.jsx("div",{className:"text-center py-4",children:e.jsx(h,{variant:"outline",onClick:le,disabled:v,children:v?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-4 h-4 mr-2 animate-spin"}),t.historyPage.loading]}):t.historyPage.loadMore})})]}),e.jsx(z,{open:Z,onOpenChange:p,children:e.jsxs(B,{children:[e.jsxs(V,{children:[e.jsx(q,{children:t.historyPage.clearAll}),e.jsx(I,{children:t.historyPage.clearAllConfirm})]}),e.jsxs(J,{children:[e.jsx(U,{children:t.common.cancel}),e.jsx(X,{onClick:re,children:t.common.confirm})]})]})}),e.jsx(z,{open:ee,onOpenChange:j,children:e.jsxs(B,{children:[e.jsxs(V,{children:[e.jsx(q,{children:t.common.delete}),e.jsx(I,{children:t.historyPage.deleteConfirm})]}),e.jsxs(J,{children:[e.jsx(U,{children:t.common.cancel}),e.jsx(X,{onClick:ne,children:t.common.confirm})]})]})}),e.jsx(je,{open:se,onOpenChange:P,children:e.jsxs(fe,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[e.jsx(ye,{className:"flex-shrink-0",children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[i?.success?e.jsx(Y,{className:"w-5 h-5 text-green-500"}):e.jsx(G,{className:"w-5 h-5 text-red-500"}),t.historyPage.detailTitle||"对话详情"]})}),i&&e.jsx("div",{className:"overflow-y-auto max-h-[calc(80vh-120px)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-slate-50 dark:bg-slate-900 rounded-lg",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:t.historyPage.taskLabel||"任务"}),e.jsx("p",{className:"text-sm text-slate-900 dark:text-slate-100",children:i.task_text})]}),e.jsx("div",{className:"space-y-3",children:i.messages.length>0?i.messages.map((s,a)=>e.jsx("div",{className:"space-y-2",children:s.role==="user"?e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center flex-shrink-0",children:e.jsx(_e,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("div",{className:"flex-1 p-3 bg-blue-50 dark:bg-blue-900/30 rounded-lg",children:e.jsx("p",{className:"text-sm text-slate-900 dark:text-slate-100",children:s.content})})]}):e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-emerald-100 dark:bg-emerald-900 flex items-center justify-center flex-shrink-0",children:e.jsx(Le,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-400"})}),e.jsxs("div",{className:"flex-1 space-y-2",children:[s.step!==null&&s.step!==void 0&&e.jsxs("button",{className:"flex items-center gap-1 text-xs text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200",onClick:()=>ie(s.step),children:[y.has(s.step)?e.jsx(De,{className:"w-3 h-3"}):e.jsx(Ce,{className:"w-3 h-3"}),t.historyPage.stepLabel?.replace("{step}",String(s.step))||`步骤 ${s.step}`]}),s.thinking&&(s.step===null||s.step===void 0||y.has(s.step))&&e.jsxs("div",{className:"p-3 bg-slate-100 dark:bg-slate-800 rounded-lg",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500 dark:text-slate-400 mb-1",children:t.historyPage.thinkingLabel||"思考"}),e.jsx("p",{className:"text-sm text-slate-700 dark:text-slate-300 whitespace-pre-wrap",children:s.thinking})]}),s.action&&(s.step===null||s.step===void 0||y.has(s.step))&&e.jsxs("div",{className:"p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg",children:[e.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400 mb-1",children:t.historyPage.actionLabel||"动作"}),e.jsx("pre",{className:"text-xs text-slate-700 dark:text-slate-300 overflow-x-auto",children:JSON.stringify(s.action,null,2)})]})]})]})},a)):e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 text-center py-4",children:t.historyPage.noMessages||"暂无详细消息记录"})}),e.jsxs("div",{className:`p-3 rounded-lg ${i.success?"bg-green-50 dark:bg-green-900/20":"bg-red-50 dark:bg-red-900/20"}`,children:[e.jsx("p",{className:`text-xs font-medium mb-1 ${i.success?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:t.historyPage.resultLabel||"结果"}),e.jsx("p",{className:"text-sm text-slate-900 dark:text-slate-100",children:i.final_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-slate-500 dark:text-slate-400 pt-2 border-t border-slate-200 dark:border-slate-700",children:[e.jsx("span",{children:t.historyPage.steps.replace("{count}",String(i.steps))}),e.jsxs("span",{className:"flex items-center",children:[e.jsx(E,{className:"w-3 h-3 mr-1"}),M(i.duration_ms)]}),e.jsx(m,{className:O(i.source),children:T(i.source)})]})]})})]})})]})}export{Fe as component};
|
|
1
|
+
import{o as K,u as de,r,p as xe,j as e,B as h,f as m,C as E,g as he,q as me,s as ge}from"./index-SysdKciY.js";import{T as F,L as H,C as ue,c as pe,D as je,d as fe,e as ye,f as Ne}from"./dialog-BgtPh0d5.js";import{S as ke,a as be,b as ve,c as we,d as R,A as z,e as B,f as V,g as q,h as I,i as J,j as U,k as X}from"./alert-dialog-BKM-yRiQ.js";import{C as Y,a as G,b as De}from"./popover-CikYqu2P.js";import{E as Se,C as Ce}from"./eye-DLqKbQmg.js";const Pe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Le=K("bot",Pe);const Ae=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_e=K("user",Ae);function Fe(){const t=de(),[N,Q]=r.useState([]),[n,k]=r.useState(""),[o,x]=r.useState([]),[W,b]=r.useState(!1),[v,w]=r.useState(!1),[D,g]=r.useState(0),[S,u]=r.useState(0),[Z,p]=r.useState(!1),[ee,j]=r.useState(!1),[f,C]=r.useState(null),[se,P]=r.useState(!1),[i,te]=r.useState(null),[y,L]=r.useState(new Set),ae=20;r.useEffect(()=>{(async()=>{try{const a=await he();Q(a),a.length>0&&!n&&k(a[0].serial)}catch(a){console.error("Failed to load devices:",a)}})()},[n]);const A=r.useCallback(async(s,a=!0)=>{if(s)try{a?(b(!0),u(0)):w(!0);const l=a?0:S,c=await xe(s,ae,l);x(a?c.records:d=>[...d,...c.records]),g(c.total),u(l+c.records.length)}catch(l){console.error("Failed to load history:",l)}finally{b(!1),w(!1)}},[S]);r.useEffect(()=>{n&&A(n,!0)},[n]);const le=()=>{n&&o.length<D&&A(n,!1)},re=async()=>{if(n){try{await me(n),x([]),g(0),u(0)}catch(s){console.error("Failed to clear history:",s)}p(!1)}},ne=async()=>{if(!(!n||!f)){try{await ge(n,f),x(s=>s.filter(a=>a.id!==f)),g(s=>s-1)}catch(s){console.error("Failed to delete record:",s)}j(!1),C(null)}},_=s=>{te(s);const a=new Set;s.messages.forEach(l=>{l.step!==null&&l.step!==void 0&&a.add(l.step)}),L(a),P(!0)},ie=s=>{L(a=>{const l=new Set(a);return l.has(s)?l.delete(s):l.add(s),l})},M=s=>s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${(s/6e4).toFixed(1)}min`,ce=s=>{const a=new Date(s),l=new Date,c=a.toDateString()===l.toDateString(),d=new Date(l);d.setDate(d.getDate()-1);const oe=a.toDateString()===d.toDateString(),$=a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return c?`${t.history.today} ${$}`:oe?`${t.history.yesterday} ${$}`:a.toLocaleDateString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},T=s=>({chat:t.historyPage.source.chat,layered:t.historyPage.source.layered,scheduled:t.historyPage.source.scheduled})[s]||s,O=s=>{switch(s){case"chat":return"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300";case"layered":return"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300";case"scheduled":return"bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300";default:return"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"}};return e.jsxs("div",{className:"container mx-auto p-6 max-w-4xl",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold",children:t.historyPage.title}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(ke,{value:n,onValueChange:k,children:[e.jsx(be,{className:"w-[200px]",children:e.jsx(ve,{placeholder:t.historyPage.selectDevice})}),e.jsx(we,{children:N.length===0?e.jsx(R,{value:"_none",disabled:!0,children:t.historyPage.noDevices}):N.map(s=>e.jsx(R,{value:s.serial,children:s.model||s.serial},s.serial))})]}),o.length>0&&e.jsxs(h,{variant:"destructive",size:"sm",onClick:()=>p(!0),children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),t.historyPage.clearAll]})]})]}),W?e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(H,{className:"w-8 h-8 animate-spin text-slate-400"})}):o.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:t.historyPage.noRecords}),e.jsx("p",{className:"text-sm text-slate-400 dark:text-slate-500 mt-2",children:t.historyPage.noRecordsDesc})]}):e.jsxs("div",{className:"space-y-4",children:[o.map(s=>e.jsx(ue,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>_(s),children:e.jsx(pe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 line-clamp-2 mb-2",children:s.task_text}),e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400 line-clamp-2 mb-3",children:s.final_message}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[s.success?e.jsxs(m,{variant:"outline",className:"text-green-600 border-green-300 dark:text-green-400 dark:border-green-700",children:[e.jsx(Y,{className:"w-3 h-3 mr-1"}),t.historyPage.success]}):e.jsxs(m,{variant:"outline",className:"text-red-600 border-red-300 dark:text-red-400 dark:border-red-700",children:[e.jsx(G,{className:"w-3 h-3 mr-1"}),t.historyPage.failed]}),e.jsxs(m,{className:O(s.source),children:[T(s.source),s.source_detail&&`: ${s.source_detail}`]}),s.steps>0&&e.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:t.historyPage.steps.replace("{count}",String(s.steps))}),e.jsxs("span",{className:"text-slate-500 dark:text-slate-400 flex items-center",children:[e.jsx(E,{className:"w-3 h-3 mr-1"}),M(s.duration_ms)]}),e.jsx("span",{className:"text-slate-400 dark:text-slate-500",children:ce(s.start_time)})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{variant:"ghost",size:"sm",className:"text-slate-400 hover:text-blue-500",onClick:a=>{a.stopPropagation(),_(s)},children:e.jsx(Se,{className:"w-4 h-4"})}),e.jsx(h,{variant:"ghost",size:"sm",className:"text-slate-400 hover:text-red-500",onClick:a=>{a.stopPropagation(),C(s.id),j(!0)},children:e.jsx(F,{className:"w-4 h-4"})})]})]})})},s.id)),o.length<D&&e.jsx("div",{className:"text-center py-4",children:e.jsx(h,{variant:"outline",onClick:le,disabled:v,children:v?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-4 h-4 mr-2 animate-spin"}),t.historyPage.loading]}):t.historyPage.loadMore})})]}),e.jsx(z,{open:Z,onOpenChange:p,children:e.jsxs(B,{children:[e.jsxs(V,{children:[e.jsx(q,{children:t.historyPage.clearAll}),e.jsx(I,{children:t.historyPage.clearAllConfirm})]}),e.jsxs(J,{children:[e.jsx(U,{children:t.common.cancel}),e.jsx(X,{onClick:re,children:t.common.confirm})]})]})}),e.jsx(z,{open:ee,onOpenChange:j,children:e.jsxs(B,{children:[e.jsxs(V,{children:[e.jsx(q,{children:t.common.delete}),e.jsx(I,{children:t.historyPage.deleteConfirm})]}),e.jsxs(J,{children:[e.jsx(U,{children:t.common.cancel}),e.jsx(X,{onClick:ne,children:t.common.confirm})]})]})}),e.jsx(je,{open:se,onOpenChange:P,children:e.jsxs(fe,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[e.jsx(ye,{className:"flex-shrink-0",children:e.jsxs(Ne,{className:"flex items-center gap-2",children:[i?.success?e.jsx(Y,{className:"w-5 h-5 text-green-500"}):e.jsx(G,{className:"w-5 h-5 text-red-500"}),t.historyPage.detailTitle||"对话详情"]})}),i&&e.jsx("div",{className:"overflow-y-auto max-h-[calc(80vh-120px)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-slate-50 dark:bg-slate-900 rounded-lg",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:t.historyPage.taskLabel||"任务"}),e.jsx("p",{className:"text-sm text-slate-900 dark:text-slate-100",children:i.task_text})]}),e.jsx("div",{className:"space-y-3",children:i.messages.length>0?i.messages.map((s,a)=>e.jsx("div",{className:"space-y-2",children:s.role==="user"?e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center flex-shrink-0",children:e.jsx(_e,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("div",{className:"flex-1 p-3 bg-blue-50 dark:bg-blue-900/30 rounded-lg",children:e.jsx("p",{className:"text-sm text-slate-900 dark:text-slate-100",children:s.content})})]}):e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-emerald-100 dark:bg-emerald-900 flex items-center justify-center flex-shrink-0",children:e.jsx(Le,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-400"})}),e.jsxs("div",{className:"flex-1 space-y-2",children:[s.step!==null&&s.step!==void 0&&e.jsxs("button",{className:"flex items-center gap-1 text-xs text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200",onClick:()=>ie(s.step),children:[y.has(s.step)?e.jsx(De,{className:"w-3 h-3"}):e.jsx(Ce,{className:"w-3 h-3"}),t.historyPage.stepLabel?.replace("{step}",String(s.step))||`步骤 ${s.step}`]}),s.thinking&&(s.step===null||s.step===void 0||y.has(s.step))&&e.jsxs("div",{className:"p-3 bg-slate-100 dark:bg-slate-800 rounded-lg",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500 dark:text-slate-400 mb-1",children:t.historyPage.thinkingLabel||"思考"}),e.jsx("p",{className:"text-sm text-slate-700 dark:text-slate-300 whitespace-pre-wrap",children:s.thinking})]}),s.action&&(s.step===null||s.step===void 0||y.has(s.step))&&e.jsxs("div",{className:"p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg",children:[e.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400 mb-1",children:t.historyPage.actionLabel||"动作"}),e.jsx("pre",{className:"text-xs text-slate-700 dark:text-slate-300 overflow-x-auto",children:JSON.stringify(s.action,null,2)})]})]})]})},a)):e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 text-center py-4",children:t.historyPage.noMessages||"暂无详细消息记录"})}),e.jsxs("div",{className:`p-3 rounded-lg ${i.success?"bg-green-50 dark:bg-green-900/20":"bg-red-50 dark:bg-red-900/20"}`,children:[e.jsx("p",{className:`text-xs font-medium mb-1 ${i.success?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:t.historyPage.resultLabel||"结果"}),e.jsx("p",{className:"text-sm text-slate-900 dark:text-slate-100",children:i.final_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-slate-500 dark:text-slate-400 pt-2 border-t border-slate-200 dark:border-slate-700",children:[e.jsx("span",{children:t.historyPage.steps.replace("{count}",String(i.steps))}),e.jsxs("span",{className:"flex items-center",children:[e.jsx(E,{className:"w-3 h-3 mr-1"}),M(i.duration_ms)]}),e.jsx(m,{className:O(i.source),children:T(i.source)})]})]})})]})})]})}export{Fe as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aa as o,r as a,j as t}from"./index-SysdKciY.js";function n(){const e=o();return a.useEffect(()=>{e({to:"/chat"})},[e]),t.jsx("div",{className:"p-2",children:t.jsx("h3",{children:"Welcome Home!"})})}export{n as component};
|