hermium 0.3.1 → 0.3.3
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/bin/hermium.mjs +9 -11
- package/dist/public/assets/css/styles-B8p6jk5Z.css +1 -0
- package/dist/public/assets/js/{ChatInputBlock-BgJMx5nW.js → ChatInputBlock-D4CYR2D_.js} +1 -1
- package/dist/{server/public/assets/js/MarkdownMessage-Dd6VsKhk.js → public/assets/js/MarkdownMessage-Bu4diQAT.js} +1 -1
- package/dist/{server/public/assets/js/base-ui-Ls-HE_Zl.js → public/assets/js/base-ui-DKZpRETY.js} +1 -1
- package/dist/public/assets/js/{chat._sessionId-Yif-J0_7.js → chat._sessionId-IyYhnI65.js} +1 -1
- package/dist/public/assets/js/{chat.index-QgwoSqOs.js → chat.index-CdO1bi1g.js} +1 -1
- package/dist/public/assets/js/{index-BDLsrzTe.js → index-CGq67I5U.js} +4 -4
- package/dist/public/assets/js/{index-DRH0t4ti.js → index-CYDXRqze.js} +1 -1
- package/dist/public/assets/js/{memory-CHpNNtU2.js → memory-BC-tVM26.js} +1 -1
- package/dist/public/assets/js/{router-B8BATVn7.js → router-Cdi9aGOg.js} +1 -1
- package/dist/public/assets/js/{settings-CRV3Pp8x.js → settings-CthZPCPZ.js} +1 -1
- package/dist/{server/public/assets/js/skills-C8G72gXr.js → public/assets/js/skills-COr12qk7.js} +1 -1
- package/dist/public/assets/js/{usage-Bev8hqwh.js → usage-oWmLZ5Lt.js} +1 -1
- package/dist/server/_libs/h3.mjs +117 -0
- package/dist/server/_libs/ufo.mjs +158 -1
- package/dist/server/_ssr/{ChatInputBlock-Bu2-iop_.mjs → ChatInputBlock-BTSt3ldw.mjs} +1 -1
- package/dist/server/_ssr/{MarkdownMessage-CNS7OSKN.mjs → MarkdownMessage-DzImLKnw.mjs} +1 -1
- package/dist/server/_ssr/{chat._sessionId-P02iSfut.mjs → chat._sessionId-CUSsvbBX.mjs} +4 -4
- package/dist/server/_ssr/{chat.index-BYB_48NC.mjs → chat.index-YqIyLr2b.mjs} +1 -1
- package/dist/server/_ssr/{index-DFV9_oCk.mjs → index--T6rScER.mjs} +2 -2
- package/dist/server/_ssr/{index-C1mT_2d8.mjs → index-Be17Jodh.mjs} +2 -2
- package/dist/server/_ssr/{memory-CW_fSOG9.mjs → memory-DLVdk8UN.mjs} +3 -3
- package/dist/server/_ssr/{router-CUAfx91O.mjs → router-C0m-TE_e.mjs} +7 -9
- package/dist/server/_ssr/{skills-Cs7A5ZwO.mjs → skills-DAVualEA.mjs} +3 -3
- package/dist/server/_ssr/{usage-Bs2-LXGz.mjs → usage-CCOujow3.mjs} +1 -1
- package/dist/server/{_tanstack-start-manifest_v-C7Upe2TI.mjs → _tanstack-start-manifest_v-wG3l04YA.mjs} +1 -1
- package/dist/server/index.mjs +158 -117
- package/dist/server/public/assets/css/styles-B8p6jk5Z.css +1 -0
- package/dist/server/public/assets/js/{ChatInputBlock-BgJMx5nW.js → ChatInputBlock-D4CYR2D_.js} +1 -1
- package/dist/{public/assets/js/MarkdownMessage-Dd6VsKhk.js → server/public/assets/js/MarkdownMessage-Bu4diQAT.js} +1 -1
- package/dist/{public/assets/js/base-ui-Ls-HE_Zl.js → server/public/assets/js/base-ui-DKZpRETY.js} +1 -1
- package/dist/server/public/assets/js/{chat._sessionId-Yif-J0_7.js → chat._sessionId-IyYhnI65.js} +1 -1
- package/dist/server/public/assets/js/{chat.index-QgwoSqOs.js → chat.index-CdO1bi1g.js} +1 -1
- package/dist/server/public/assets/js/{index-BDLsrzTe.js → index-CGq67I5U.js} +4 -4
- package/dist/server/public/assets/js/{index-DRH0t4ti.js → index-CYDXRqze.js} +1 -1
- package/dist/server/public/assets/js/{memory-CHpNNtU2.js → memory-BC-tVM26.js} +1 -1
- package/dist/server/public/assets/js/{router-B8BATVn7.js → router-Cdi9aGOg.js} +1 -1
- package/dist/server/public/assets/js/{settings-CRV3Pp8x.js → settings-CthZPCPZ.js} +1 -1
- package/dist/{public/assets/js/skills-C8G72gXr.js → server/public/assets/js/skills-COr12qk7.js} +1 -1
- package/dist/server/public/assets/js/{usage-Bev8hqwh.js → usage-oWmLZ5Lt.js} +1 -1
- package/package.json +1 -1
- package/dist/public/assets/css/styles-o9LLzp-x.css +0 -1
- package/dist/server/public/assets/css/styles-o9LLzp-x.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aD as u,am as e,i as w,ar as d,g as v,D as p,j as f,e as y,h as C,aF as k,S,x as I}from"./index-BDLsrzTe.js";import{M as g}from"./MarkdownMessage-Dd6VsKhk.js";import{C as T}from"./ChatInputBlock-BgJMx5nW.js";import"./base-ui-Ls-HE_Zl.js";import"./router-B8BATVn7.js";function M({text:t}){const[s,r]=d.useState(!1),a=async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return e.jsxs("button",{onClick:a,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/50 hover:text-foreground hover:bg-muted transition-colors","aria-label":"Copy message",children:[s?e.jsx(y,{className:"size-3"}):e.jsx(C,{className:"size-3"}),s?"Copied":"Copy"]})}function E(t){const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const r=Math.floor(s/60),a=s%60;return a===0?`${r}m`:`${r}m ${a}s`}function j({reasoning:t,isStreaming:s,startedAt:r,endedAt:a}){const[o,l]=d.useState(s??!1),[n,m]=d.useState(Date.now()),i=d.useRef(null);if(d.useEffect(()=>{l(s??!1)},[s]),d.useEffect(()=>{if(s&&r&&!a)return i.current=setInterval(()=>m(Date.now()),1e3),()=>{i.current&&clearInterval(i.current)};i.current&&(clearInterval(i.current),i.current=null)},[s,r,a]),!t.trim())return null;const x=r?Math.max(0,(a??(s?n:r))-r):null,h=[...t].length,c=s&&r&&!a;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>l(!o),className:p("inline-flex items-center gap-1.5 text-[11px] transition-colors",c?"text-amber-500 dark:text-amber-400 font-medium":"text-muted-foreground/70 hover:text-foreground"),children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",o&&"rotate-90")}),c?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"thinking…"]}):e.jsx("span",{children:"thought"}),x!==null&&x>0&&e.jsxs("span",{className:"text-muted-foreground/60 tabular-nums",children:["· ",E(x)]}),e.jsxs("span",{className:"text-muted-foreground/60",children:["· ",h.toLocaleString()," chars"]})]}),o&&e.jsx("div",{className:"mt-1 rounded-md bg-amber-50 dark:bg-amber-950/20 px-2.5 py-1.5 text-[11px] text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-amber-200 dark:border-amber-800/30",children:t})]})}function N(t){if(!t)return null;try{const s=JSON.parse(t);return{text:JSON.stringify(s,null,2),isJson:!0}}catch{return{text:t,isJson:!1}}}function b({tools:t}){const[s,r]=d.useState(!1);if(!t?.length)return null;const a=t.filter(n=>n.status==="running").length,o=t.filter(n=>n.status==="done").length,l=t.filter(n=>n.status==="error").length;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>r(!s),className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground/70 hover:text-foreground transition-colors",children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",s&&"rotate-90")}),e.jsxs("span",{children:["used ",t.length," tool",t.length>1?"s":""]}),a>0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),a]}),o>0&&e.jsxs("span",{className:"text-emerald-500",children:[o," done"]}),l>0&&e.jsxs("span",{className:"text-red-500",children:[l," error"]}),t.length>0&&a===0&&e.jsxs("span",{className:"text-muted-foreground/50 truncate max-w-[200px]",children:["— ",t.map(n=>n.name).join(", ")]})]}),s&&e.jsx("div",{className:"mt-1 flex flex-col gap-1.5",children:t.map((n,m)=>{const i=N(n.preview),x=N(n.output);return e.jsxs("div",{className:"rounded-md bg-muted/40 border border-border/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-foreground/80 font-mono",children:n.name}),n.status==="running"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"running"]}),n.status==="done"&&e.jsx("span",{className:"text-[10px] text-emerald-500",children:"✓ done"}),n.status==="error"&&e.jsx("span",{className:"text-[10px] text-red-500",children:"✗ error"})]}),i&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Arguments"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",i.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:i.text})})]}),x&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Result"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",x.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:x.text})})]})]},n.callId||`${n.name}-${m}`)})})]})}function z({content:t,isStreaming:s,isAssistant:r}){return r&&!s&&t?e.jsx(g,{content:t}):s&&t?e.jsx("div",{className:"text-base leading-relaxed",children:e.jsx(g,{content:t,isStreaming:!0})}):s&&!t?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}),"Thinking…"]}):e.jsx("div",{className:"text-base leading-relaxed whitespace-pre-wrap",children:t})}function D(t){if(!t||isNaN(t))return null;try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return null}}function L(){const t=u(s=>s.messages);return t.length===0?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Start a conversation"}):e.jsx("div",{className:"flex flex-col",children:t.map(s=>{const r=s.role==="user",a=s.role==="system",o=s.role==="tool",l=!!s.content?.trim(),n=!!s.reasoning?.trim(),m=!!s.toolCalls?.length,i=D(s.timestamp),x=o||!r&&!l&&(n||m);if(a)return e.jsx("div",{className:"px-4 py-2",children:e.jsx("div",{className:"mx-auto max-w-3xl rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-2.5 text-sm text-destructive",children:s.content})},s.id);if(x)return e.jsxs("div",{className:"px-4 py-1",children:[e.jsxs("div",{className:"mx-auto max-w-3xl flex flex-col gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),!o&&m&&e.jsx(b,{tools:s.toolCalls}),o&&e.jsx("div",{className:"rounded-md bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-border/50",children:s.content})]}),i&&e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/40",children:i})})]},s.id);if(r){const h=!!s.attachments?.length;return e.jsx("div",{className:"flex px-4 py-2 justify-end",children:e.jsxs("div",{className:"flex min-w-0 flex-col max-w-[80%] items-end gap-1.5",children:[h&&e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:s.attachments.map(c=>c.type.startsWith("image/")?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-xl overflow-hidden border border-border/50 hover:border-border transition-colors",children:e.jsx("img",{src:c.url,alt:c.name,className:"max-h-[200px] max-w-[260px] object-cover"})},c.id):e.jsxs("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border bg-card px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(w,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:c.name})]},c.id))}),e.jsx("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed bg-primary text-primary-foreground",children:e.jsx("div",{className:"whitespace-pre-wrap",children:s.content})}),i&&e.jsx("span",{className:"text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)}return e.jsx("div",{className:"flex px-4 py-4 justify-start",children:e.jsxs("div",{className:"flex min-w-0 flex-col w-full max-w-3xl gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),m&&e.jsx(b,{tools:s.toolCalls}),e.jsx(z,{content:s.content,isStreaming:s.isStreaming,isAssistant:!0}),l&&e.jsx("div",{className:"mt-1 flex items-center gap-2 px-1",children:e.jsx(M,{text:s.content})}),i&&e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)})})}function R(){const{activeSessionId:t,isStreaming:s}=u(),r=u(l=>l.syncFromDb),{state:a}=k(),o=a==="collapsed";return d.useEffect(()=>{if(!t||!s)return;const l=setInterval(()=>{r(t)},2e3);return()=>clearInterval(l)},[t,s,r]),e.jsxs("div",{className:"flex h-full flex-col ",children:[e.jsx("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o&&e.jsx(S,{className:p("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx("h2",{className:"truncate font-medium",children:t?`Chat ${t.slice(0,8)}`:"New Chat"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"Streaming…"})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(L,{})})}),e.jsx("div",{className:"shrink-0 bg-background px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(T,{})})})]})}function P(){const{sessionId:t}=I.useParams(),s=u(o=>o.switchSession),r=u(o=>o.loadSessions),a=u(o=>o.sessionsLoaded);return d.useEffect(()=>{a||r()},[a,r]),d.useEffect(()=>{t&&s(t)},[t,s]),e.jsx(R,{})}export{P as component};
|
|
1
|
+
import{aD as u,am as e,i as w,ar as d,g as v,D as p,j as f,e as y,h as C,aF as k,S,x as I}from"./index-CGq67I5U.js";import{M as g}from"./MarkdownMessage-Bu4diQAT.js";import{C as T}from"./ChatInputBlock-D4CYR2D_.js";import"./base-ui-DKZpRETY.js";import"./router-Cdi9aGOg.js";function M({text:t}){const[s,r]=d.useState(!1),a=async()=>{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return e.jsxs("button",{onClick:a,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/50 hover:text-foreground hover:bg-muted transition-colors","aria-label":"Copy message",children:[s?e.jsx(y,{className:"size-3"}):e.jsx(C,{className:"size-3"}),s?"Copied":"Copy"]})}function E(t){const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const r=Math.floor(s/60),a=s%60;return a===0?`${r}m`:`${r}m ${a}s`}function j({reasoning:t,isStreaming:s,startedAt:r,endedAt:a}){const[o,l]=d.useState(s??!1),[n,m]=d.useState(Date.now()),i=d.useRef(null);if(d.useEffect(()=>{l(s??!1)},[s]),d.useEffect(()=>{if(s&&r&&!a)return i.current=setInterval(()=>m(Date.now()),1e3),()=>{i.current&&clearInterval(i.current)};i.current&&(clearInterval(i.current),i.current=null)},[s,r,a]),!t.trim())return null;const x=r?Math.max(0,(a??(s?n:r))-r):null,h=[...t].length,c=s&&r&&!a;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>l(!o),className:p("inline-flex items-center gap-1.5 text-[11px] transition-colors",c?"text-amber-500 dark:text-amber-400 font-medium":"text-muted-foreground/70 hover:text-foreground"),children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",o&&"rotate-90")}),c?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"thinking…"]}):e.jsx("span",{children:"thought"}),x!==null&&x>0&&e.jsxs("span",{className:"text-muted-foreground/60 tabular-nums",children:["· ",E(x)]}),e.jsxs("span",{className:"text-muted-foreground/60",children:["· ",h.toLocaleString()," chars"]})]}),o&&e.jsx("div",{className:"mt-1 rounded-md bg-amber-50 dark:bg-amber-950/20 px-2.5 py-1.5 text-[11px] text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-amber-200 dark:border-amber-800/30",children:t})]})}function N(t){if(!t)return null;try{const s=JSON.parse(t);return{text:JSON.stringify(s,null,2),isJson:!0}}catch{return{text:t,isJson:!1}}}function b({tools:t}){const[s,r]=d.useState(!1);if(!t?.length)return null;const a=t.filter(n=>n.status==="running").length,o=t.filter(n=>n.status==="done").length,l=t.filter(n=>n.status==="error").length;return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>r(!s),className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground/70 hover:text-foreground transition-colors",children:[e.jsx(v,{className:p("size-3 shrink-0 transition-transform",s&&"rotate-90")}),e.jsxs("span",{children:["used ",t.length," tool",t.length>1?"s":""]}),a>0&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),a]}),o>0&&e.jsxs("span",{className:"text-emerald-500",children:[o," done"]}),l>0&&e.jsxs("span",{className:"text-red-500",children:[l," error"]}),t.length>0&&a===0&&e.jsxs("span",{className:"text-muted-foreground/50 truncate max-w-[200px]",children:["— ",t.map(n=>n.name).join(", ")]})]}),s&&e.jsx("div",{className:"mt-1 flex flex-col gap-1.5",children:t.map((n,m)=>{const i=N(n.preview),x=N(n.output);return e.jsxs("div",{className:"rounded-md bg-muted/40 border border-border/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-foreground/80 font-mono",children:n.name}),n.status==="running"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-amber-500",children:[e.jsx(f,{className:"size-2.5 animate-spin"}),"running"]}),n.status==="done"&&e.jsx("span",{className:"text-[10px] text-emerald-500",children:"✓ done"}),n.status==="error"&&e.jsx("span",{className:"text-[10px] text-red-500",children:"✗ error"})]}),i&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Arguments"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",i.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:i.text})})]}),x&&e.jsxs("div",{className:"border-t border-border/30",children:[e.jsx("div",{className:"px-2.5 py-0.5 text-[9px] uppercase tracking-wider text-muted-foreground/60",children:"Result"}),e.jsx("div",{className:"px-2.5 pb-1.5",children:e.jsx("pre",{className:p("text-[10px] leading-relaxed overflow-x-auto font-mono whitespace-pre-wrap max-h-[200px] overflow-y-auto rounded",x.isJson?"bg-slate-900/10 dark:bg-slate-900/40 text-foreground/80 px-2 py-1":"text-muted-foreground/70"),children:x.text})})]})]},n.callId||`${n.name}-${m}`)})})]})}function z({content:t,isStreaming:s,isAssistant:r}){return r&&!s&&t?e.jsx(g,{content:t}):s&&t?e.jsx("div",{className:"text-base leading-relaxed",children:e.jsx(g,{content:t,isStreaming:!0})}):s&&!t?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(f,{className:"h-3.5 w-3.5 animate-spin"}),"Thinking…"]}):e.jsx("div",{className:"text-base leading-relaxed whitespace-pre-wrap",children:t})}function D(t){if(!t||isNaN(t))return null;try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return null}}function L(){const t=u(s=>s.messages);return t.length===0?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:"Start a conversation"}):e.jsx("div",{className:"flex flex-col",children:t.map(s=>{const r=s.role==="user",a=s.role==="system",o=s.role==="tool",l=!!s.content?.trim(),n=!!s.reasoning?.trim(),m=!!s.toolCalls?.length,i=D(s.timestamp),x=o||!r&&!l&&(n||m);if(a)return e.jsx("div",{className:"px-4 py-2",children:e.jsx("div",{className:"mx-auto max-w-3xl rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-2.5 text-sm text-destructive",children:s.content})},s.id);if(x)return e.jsxs("div",{className:"px-4 py-1",children:[e.jsxs("div",{className:"mx-auto max-w-3xl flex flex-col gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),!o&&m&&e.jsx(b,{tools:s.toolCalls}),o&&e.jsx("div",{className:"rounded-md bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap font-mono border border-border/50",children:s.content})]}),i&&e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/40",children:i})})]},s.id);if(r){const h=!!s.attachments?.length;return e.jsx("div",{className:"flex px-4 py-2 justify-end",children:e.jsxs("div",{className:"flex min-w-0 flex-col max-w-[80%] items-end gap-1.5",children:[h&&e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:s.attachments.map(c=>c.type.startsWith("image/")?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-xl overflow-hidden border border-border/50 hover:border-border transition-colors",children:e.jsx("img",{src:c.url,alt:c.name,className:"max-h-[200px] max-w-[260px] object-cover"})},c.id):e.jsxs("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border bg-card px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[e.jsx(w,{className:"size-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:c.name})]},c.id))}),e.jsx("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed bg-primary text-primary-foreground",children:e.jsx("div",{className:"whitespace-pre-wrap",children:s.content})}),i&&e.jsx("span",{className:"text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)}return e.jsx("div",{className:"flex px-4 py-4 justify-start",children:e.jsxs("div",{className:"flex min-w-0 flex-col w-full max-w-3xl gap-1",children:[n&&e.jsx(j,{reasoning:s.reasoning,isStreaming:s.isStreaming,startedAt:s.reasoningStartedAt,endedAt:s.reasoningEndedAt}),m&&e.jsx(b,{tools:s.toolCalls}),e.jsx(z,{content:s.content,isStreaming:s.isStreaming,isAssistant:!0}),l&&e.jsx("div",{className:"mt-1 flex items-center gap-2 px-1",children:e.jsx(M,{text:s.content})}),i&&e.jsx("span",{className:"mt-0.5 text-[10px] text-muted-foreground/50 px-1",children:i})]})},s.id)})})}function R(){const{activeSessionId:t,isStreaming:s}=u(),r=u(l=>l.syncFromDb),{state:a}=k(),o=a==="collapsed";return d.useEffect(()=>{if(!t||!s)return;const l=setInterval(()=>{r(t)},2e3);return()=>clearInterval(l)},[t,s,r]),e.jsxs("div",{className:"flex h-full flex-col ",children:[e.jsx("header",{className:"flex items-center justify-between border-b px-4 py-3 shrink-0",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o&&e.jsx(S,{className:p("mr-1 -ml-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0")}),e.jsx("h2",{className:"truncate font-medium",children:t?`Chat ${t.slice(0,8)}`:"New Chat"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"Streaming…"})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(L,{})})}),e.jsx("div",{className:"shrink-0 bg-background px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(T,{})})})]})}function P(){const{sessionId:t}=I.useParams(),s=u(o=>o.switchSession),r=u(o=>o.loadSessions),a=u(o=>o.sessionsLoaded);return d.useEffect(()=>{a||r()},[a,r]),d.useEffect(()=>{t&&s(t)},[t,s]),e.jsx(R,{})}export{P as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aD as n,ar as o,G as c,am as i}from"./index-
|
|
1
|
+
import{aD as n,ar as o,G as c,am as i}from"./index-CGq67I5U.js";import{d as u}from"./router-Cdi9aGOg.js";import"./base-ui-DKZpRETY.js";function l(){const s=u(),a=n(e=>e.sessionsLoaded),t=n(e=>e.sessions),r=o.useRef(!1);return o.useEffect(()=>{if(a)if(t.length>0)s({to:"/chat/$sessionId",params:{sessionId:t[0].id},replace:!0});else{if(r.current)return;r.current=!0,c({title:"",source:"api_server"}).then(e=>{s({to:"/chat/$sessionId",params:{sessionId:e.id},replace:!0})}).catch(()=>{r.current=!1})}},[a,t,s]),i.jsx("div",{className:"flex flex-1 items-center justify-center",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading conversations…"})})}export{l as component};
|