hermium 0.3.6 → 0.3.7

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.
Files changed (34) hide show
  1. package/dist/api.mjs +37 -17
  2. package/dist/public/assets/js/{ChatInputBlock-BYpIR_ls.js → ChatInputBlock-BsakEj7f.js} +1 -1
  3. package/dist/{server/public/assets/js/MarkdownMessage-DL1aUod4.js → public/assets/js/MarkdownMessage-CFmUlx03.js} +1 -1
  4. package/dist/public/assets/js/{chat._sessionId-YaowVhVf.js → chat._sessionId-Du4LuT3Z.js} +1 -1
  5. package/dist/{server/public/assets/js/chat.index-B64jjuMw.js → public/assets/js/chat.index-DfETrKqO.js} +1 -1
  6. package/dist/public/assets/js/{index-DnOJbmz0.js → index-c1JE7Mqf.js} +1 -1
  7. package/dist/public/assets/js/{index-DsMUdp1X.js → index-om9XIKI1.js} +22 -22
  8. package/dist/public/assets/js/{memory-B_Uy_WUi.js → memory-TUhvnVO-.js} +1 -1
  9. package/dist/public/assets/js/{settings-ZdgGJLcS.js → settings-C6SLxMLw.js} +1 -1
  10. package/dist/public/assets/js/{skills-Bg3vZgl2.js → skills-CiWhpzh2.js} +1 -1
  11. package/dist/public/assets/js/{usage-DXPIAwzR.js → usage-BrhP5T90.js} +1 -1
  12. package/dist/server/_ssr/{ChatInputBlock-BONgzml9.mjs → ChatInputBlock-D3Bw-ILw.mjs} +1 -1
  13. package/dist/server/_ssr/{MarkdownMessage-y8GThg94.mjs → MarkdownMessage-hXIkdfYz.mjs} +1 -1
  14. package/dist/server/_ssr/{chat._sessionId-BSlHY8-3.mjs → chat._sessionId-CyrHExqJ.mjs} +4 -4
  15. package/dist/server/_ssr/{chat.index-DaPRZ2yS.mjs → chat.index-ngXZoPUQ.mjs} +1 -1
  16. package/dist/server/_ssr/{index-D-zP2Zbh.mjs → index-BC1mevNA.mjs} +2 -2
  17. package/dist/server/_ssr/{index-B6Q_iKG1.mjs → index-CLZ8vwCm.mjs} +2 -2
  18. package/dist/server/_ssr/{memory-CeEgICRt.mjs → memory-D9rLeKcu.mjs} +3 -3
  19. package/dist/server/_ssr/{router-BwJ9sLwD.mjs → router-CuDg0t0a.mjs} +33 -31
  20. package/dist/server/_ssr/{skills-BgBDh_7P.mjs → skills-DzKE4Akb.mjs} +3 -3
  21. package/dist/server/_ssr/{usage-BRFRmZxm.mjs → usage-CHB9EQE9.mjs} +1 -1
  22. package/dist/server/{_tanstack-start-manifest_v-C1EEhhb2.mjs → _tanstack-start-manifest_v-Cw2_0nXX.mjs} +1 -1
  23. package/dist/server/index.mjs +93 -93
  24. package/dist/server/public/assets/js/{ChatInputBlock-BYpIR_ls.js → ChatInputBlock-BsakEj7f.js} +1 -1
  25. package/dist/{public/assets/js/MarkdownMessage-DL1aUod4.js → server/public/assets/js/MarkdownMessage-CFmUlx03.js} +1 -1
  26. package/dist/server/public/assets/js/{chat._sessionId-YaowVhVf.js → chat._sessionId-Du4LuT3Z.js} +1 -1
  27. package/dist/{public/assets/js/chat.index-B64jjuMw.js → server/public/assets/js/chat.index-DfETrKqO.js} +1 -1
  28. package/dist/server/public/assets/js/{index-DnOJbmz0.js → index-c1JE7Mqf.js} +1 -1
  29. package/dist/server/public/assets/js/{index-DsMUdp1X.js → index-om9XIKI1.js} +22 -22
  30. package/dist/server/public/assets/js/{memory-B_Uy_WUi.js → memory-TUhvnVO-.js} +1 -1
  31. package/dist/server/public/assets/js/{settings-ZdgGJLcS.js → settings-C6SLxMLw.js} +1 -1
  32. package/dist/server/public/assets/js/{skills-Bg3vZgl2.js → skills-CiWhpzh2.js} +1 -1
  33. package/dist/server/public/assets/js/{usage-DXPIAwzR.js → usage-BrhP5T90.js} +1 -1
  34. package/package.json +2 -2
package/dist/api.mjs CHANGED
@@ -2031,22 +2031,35 @@ function uid() {
2031
2031
  // src/controllers/hermes/sessions.ts
2032
2032
  function listSessions(c) {
2033
2033
  const db = getDb();
2034
- const rows = db.query("SELECT * FROM sessions ORDER BY updated_at DESC").all();
2035
- const sessions = rows.map((r) => ({
2036
- id: String(r.id),
2037
- title: String(r.title),
2038
- source: r.source ? String(r.source) : undefined,
2039
- createdAt: Number(r.created_at),
2040
- updatedAt: Number(r.updated_at),
2041
- model: r.model ? String(r.model) : undefined,
2042
- provider: r.provider ? String(r.provider) : undefined,
2043
- messageCount: Number(r.message_count || 0),
2044
- inputTokens: Number(r.input_tokens || 0),
2045
- outputTokens: Number(r.output_tokens || 0),
2046
- endedAt: r.ended_at ? Number(r.ended_at) : null,
2047
- lastActiveAt: r.last_active_at ? Number(r.last_active_at) : undefined,
2048
- workspace: r.workspace ? String(r.workspace) : null
2049
- }));
2034
+ const rows = db.query(`
2035
+ SELECT s.*,
2036
+ (SELECT content FROM messages WHERE session_id = s.id AND role = 'user' ORDER BY timestamp LIMIT 1) as preview
2037
+ FROM sessions s
2038
+ ORDER BY s.updated_at DESC
2039
+ `).all();
2040
+ const sessions = rows.map((r) => {
2041
+ const rawTitle = String(r.title || "");
2042
+ const preview = r.preview ? String(r.preview) : "";
2043
+ let title = rawTitle;
2044
+ if (!title && preview) {
2045
+ title = preview.slice(0, 40) + (preview.length > 40 ? "..." : "");
2046
+ }
2047
+ return {
2048
+ id: String(r.id),
2049
+ title,
2050
+ source: r.source ? String(r.source) : undefined,
2051
+ createdAt: Number(r.created_at),
2052
+ updatedAt: Number(r.updated_at),
2053
+ model: r.model ? String(r.model) : undefined,
2054
+ provider: r.provider ? String(r.provider) : undefined,
2055
+ messageCount: Number(r.message_count || 0),
2056
+ inputTokens: Number(r.input_tokens || 0),
2057
+ outputTokens: Number(r.output_tokens || 0),
2058
+ endedAt: r.ended_at ? Number(r.ended_at) : null,
2059
+ lastActiveAt: r.last_active_at ? Number(r.last_active_at) : undefined,
2060
+ workspace: r.workspace ? String(r.workspace) : null
2061
+ };
2062
+ });
2050
2063
  return c.json({ sessions });
2051
2064
  }
2052
2065
  function getSession(c) {
@@ -2056,10 +2069,17 @@ function getSession(c) {
2056
2069
  if (!row)
2057
2070
  return c.json({ error: "Session not found" }, 404);
2058
2071
  const messages = db.query("SELECT * FROM messages WHERE session_id = ? ORDER BY timestamp").all(id);
2072
+ const rawTitle = String(row.title || "");
2073
+ const firstUserMsg = messages.find((m) => String(m.role) === "user");
2074
+ const preview = firstUserMsg ? String(firstUserMsg.content) : "";
2075
+ let title = rawTitle;
2076
+ if (!title && preview) {
2077
+ title = preview.slice(0, 40) + (preview.length > 40 ? "..." : "");
2078
+ }
2059
2079
  return c.json({
2060
2080
  session: {
2061
2081
  id: String(row.id),
2062
- title: String(row.title),
2082
+ title,
2063
2083
  source: row.source ? String(row.source) : undefined,
2064
2084
  createdAt: Number(row.created_at),
2065
2085
  updatedAt: Number(row.updated_at),
@@ -1 +1 @@
1
- import{C as t,x,D as n,J as o,g as R,s as B,B as g,i as L,k as U,m as F,a as K}from"./index-DsMUdp1X.js";function M({className:d,...i}){return t.jsx("textarea",{"data-slot":"textarea",className:x("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",d),...i})}function E({onCreateSession:d}){const[i,m]=n.useState(""),[a,u]=n.useState([]),[j,p]=n.useState(!1),l=n.useRef(null),f=n.useRef(null),h=o(e=>e.sendMessage),w=o(e=>e.abortStream),N=o(e=>e.isStreaming),y=o(e=>e.activeSessionId),v=n.useCallback(e=>{if(!e)return;const s=[];for(const r of Array.from(e))s.push({id:Math.random().toString(36).slice(2),name:r.name,type:r.type||"application/octet-stream",size:r.size,url:URL.createObjectURL(r),file:r});u(r=>[...r,...s])},[]),k=n.useCallback(e=>{u(s=>{const r=s.find(c=>c.id===e);return r&&URL.revokeObjectURL(r.url),s.filter(c=>c.id!==e)})},[]),b=async()=>{const e=i.trim();if(!e&&a.length===0)return;if(d){const r=await o.getState().createNewSession();if(r){d(r),m(""),l.current&&(l.current.value="");const c=a.length>0?a:void 0;u([]),await h(e,void 0,c)}return}if(!y&&!await o.getState().createNewSession())return;m(""),l.current&&(l.current.value="");const s=a.length>0?a:void 0;u([]),await h(e,void 0,s)},S=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),b())},D=e=>{e.preventDefault(),p(!0)},I=e=>{e.preventDefault(),p(!1)},z=e=>{e.preventDefault(),p(!1),v(e.dataTransfer.files)},C=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,A=e=>e.startsWith("image/");return t.jsx("div",{className:"flex flex-col gap-2 w-full",children:t.jsxs("div",{className:x("flex min-h-[120px] flex-col rounded-2xl cursor-text bg-card border border-border shadow-lg transition-colors",j&&"border-primary ring-2 ring-primary/20"),onDragOver:D,onDragLeave:I,onDrop:z,children:[a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 p-3 pb-0",children:a.map(e=>t.jsxs("div",{className:"group relative flex items-center gap-2 rounded-lg border bg-muted/50 px-2 py-1.5 pr-7 text-xs",children:[A(e.type)?t.jsx("img",{src:e.url,alt:e.name,className:"h-6 w-6 rounded object-cover"}):t.jsx(R,{className:"size-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.name}),t.jsx("span",{className:"text-muted-foreground/60",children:C(e.size)}),t.jsx("button",{onClick:()=>k(e.id),className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center rounded p-0.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(B,{className:"size-3"})})]},e.id))}),t.jsx("div",{className:"flex-1 relative overflow-y-auto max-h-[258px]",children:t.jsx(M,{ref:l,value:i,onChange:e=>m(e.target.value),onKeyDown:S,placeholder:"Ask anything",className:"w-full border-0 p-3 transition-[padding] duration-200 ease-in-out min-h-[48.4px] outline-none text-[16px] text-foreground resize-none shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent! whitespace-pre-wrap break-words"})}),t.jsxs("div",{className:"flex min-h-[40px] items-center gap-2 p-2 pb-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:e=>v(e.target.files)}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach files","aria-label":"Attach files",onClick:()=>f.current?.click(),children:t.jsx(L,{className:"h-5 w-5"})}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach images","aria-label":"Attach images",onClick:()=>f.current?.click(),children:t.jsx(U,{className:"h-5 w-5"})})]}),t.jsx("div",{className:"ml-auto flex items-center gap-3",children:N?t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:w,className:"rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground transition-colors cursor-pointer",title:"Stop generating","aria-label":"Stop generating",children:t.jsx(F,{className:"h-4 w-4"})}):t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:b,className:x("rounded-full transition-colors duration-100 ease-out cursor-pointer bg-primary",(i||a.length>0)&&"bg-primary hover:bg-primary/90!"),disabled:!i&&a.length===0,"aria-label":"Send message",children:t.jsx(K,{className:"h-4 w-4 text-primary-foreground"})})})]})]})})}export{E as C};
1
+ import{C as t,x,D as n,J as o,g as R,s as B,B as g,i as L,k as U,m as F,a as K}from"./index-om9XIKI1.js";function M({className:d,...i}){return t.jsx("textarea",{"data-slot":"textarea",className:x("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",d),...i})}function E({onCreateSession:d}){const[i,m]=n.useState(""),[a,u]=n.useState([]),[j,p]=n.useState(!1),l=n.useRef(null),f=n.useRef(null),h=o(e=>e.sendMessage),w=o(e=>e.abortStream),N=o(e=>e.isStreaming),y=o(e=>e.activeSessionId),v=n.useCallback(e=>{if(!e)return;const s=[];for(const r of Array.from(e))s.push({id:Math.random().toString(36).slice(2),name:r.name,type:r.type||"application/octet-stream",size:r.size,url:URL.createObjectURL(r),file:r});u(r=>[...r,...s])},[]),k=n.useCallback(e=>{u(s=>{const r=s.find(c=>c.id===e);return r&&URL.revokeObjectURL(r.url),s.filter(c=>c.id!==e)})},[]),b=async()=>{const e=i.trim();if(!e&&a.length===0)return;if(d){const r=await o.getState().createNewSession();if(r){d(r),m(""),l.current&&(l.current.value="");const c=a.length>0?a:void 0;u([]),await h(e,void 0,c)}return}if(!y&&!await o.getState().createNewSession())return;m(""),l.current&&(l.current.value="");const s=a.length>0?a:void 0;u([]),await h(e,void 0,s)},S=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),b())},D=e=>{e.preventDefault(),p(!0)},I=e=>{e.preventDefault(),p(!1)},z=e=>{e.preventDefault(),p(!1),v(e.dataTransfer.files)},C=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,A=e=>e.startsWith("image/");return t.jsx("div",{className:"flex flex-col gap-2 w-full",children:t.jsxs("div",{className:x("flex min-h-[120px] flex-col rounded-2xl cursor-text bg-card border border-border shadow-lg transition-colors",j&&"border-primary ring-2 ring-primary/20"),onDragOver:D,onDragLeave:I,onDrop:z,children:[a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 p-3 pb-0",children:a.map(e=>t.jsxs("div",{className:"group relative flex items-center gap-2 rounded-lg border bg-muted/50 px-2 py-1.5 pr-7 text-xs",children:[A(e.type)?t.jsx("img",{src:e.url,alt:e.name,className:"h-6 w-6 rounded object-cover"}):t.jsx(R,{className:"size-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.name}),t.jsx("span",{className:"text-muted-foreground/60",children:C(e.size)}),t.jsx("button",{onClick:()=>k(e.id),className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center rounded p-0.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(B,{className:"size-3"})})]},e.id))}),t.jsx("div",{className:"flex-1 relative overflow-y-auto max-h-[258px]",children:t.jsx(M,{ref:l,value:i,onChange:e=>m(e.target.value),onKeyDown:S,placeholder:"Ask anything",className:"w-full border-0 p-3 transition-[padding] duration-200 ease-in-out min-h-[48.4px] outline-none text-[16px] text-foreground resize-none shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent! whitespace-pre-wrap break-words"})}),t.jsxs("div",{className:"flex min-h-[40px] items-center gap-2 p-2 pb-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:e=>v(e.target.files)}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach files","aria-label":"Attach files",onClick:()=>f.current?.click(),children:t.jsx(L,{className:"h-5 w-5"})}),t.jsx(g,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground transition-colors duration-100 ease-out",title:"Attach images","aria-label":"Attach images",onClick:()=>f.current?.click(),children:t.jsx(U,{className:"h-5 w-5"})})]}),t.jsx("div",{className:"ml-auto flex items-center gap-3",children:N?t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:w,className:"rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground transition-colors cursor-pointer",title:"Stop generating","aria-label":"Stop generating",children:t.jsx(F,{className:"h-4 w-4"})}):t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:b,className:x("rounded-full transition-colors duration-100 ease-out cursor-pointer bg-primary",(i||a.length>0)&&"bg-primary hover:bg-primary/90!"),disabled:!i&&a.length===0,"aria-label":"Send message",children:t.jsx(K,{className:"h-4 w-4 text-primary-foreground"})})})]})]})})}export{E as C};
@@ -1 +1 @@
1
- import{C as s,M as m,E as d,F as n}from"./index-DsMUdp1X.js";function c({content:a,isStreaming:l}){return s.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none leading-relaxed",children:[s.jsx(m,{remarkPlugins:[n],rehypePlugins:[d],components:{p:({children:e})=>s.jsx("p",{className:"mb-3 last:mb-0",children:e}),h1:({children:e})=>s.jsx("h1",{className:"text-xl font-semibold mt-4 mb-2",children:e}),h2:({children:e})=>s.jsx("h2",{className:"text-lg font-semibold mt-3 mb-2",children:e}),h3:({children:e})=>s.jsx("h3",{className:"text-base font-semibold mt-2 mb-1",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:e}),ol:({children:e})=>s.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:e}),li:({children:e})=>s.jsx("li",{className:"marker:text-muted-foreground",children:e}),code:({className:e,children:r,...t})=>{if(!(e?.includes("hljs")||e?.includes("language-")))return s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-sm font-mono text-foreground",...t,children:r});const o=e?.match(/language-(\w+)/)?.[1];return s.jsxs("div",{className:"relative my-3 rounded-lg border bg-muted/50 overflow-hidden",children:[o&&s.jsx("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted border-b text-[10px] text-muted-foreground font-mono uppercase",children:s.jsx("span",{children:o})}),s.jsx("pre",{className:"p-3 overflow-x-auto text-sm leading-relaxed m-0",children:s.jsx("code",{className:e,...t,children:r})})]})},blockquote:({children:e})=>s.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-4 italic text-muted-foreground my-3",children:e}),a:({href:e,children:r})=>s.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80 transition-colors",children:r}),table:({children:e})=>s.jsx("div",{className:"overflow-x-auto my-3 rounded-lg border",children:s.jsx("table",{className:"w-full text-sm border-collapse",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"bg-muted border-b",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left font-medium text-foreground",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 border-b border-muted",children:e}),hr:()=>s.jsx("hr",{className:"my-4 border-border"}),strong:({children:e})=>s.jsx("strong",{className:"font-semibold text-foreground",children:e})},children:a}),l&&s.jsx("span",{className:"inline-block w-0.5 h-4 bg-foreground/70 ml-0.5 align-text-bottom animate-pulse"})]})}export{c as M};
1
+ import{C as s,M as m,E as d,F as n}from"./index-om9XIKI1.js";function c({content:a,isStreaming:l}){return s.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none leading-relaxed",children:[s.jsx(m,{remarkPlugins:[n],rehypePlugins:[d],components:{p:({children:e})=>s.jsx("p",{className:"mb-3 last:mb-0",children:e}),h1:({children:e})=>s.jsx("h1",{className:"text-xl font-semibold mt-4 mb-2",children:e}),h2:({children:e})=>s.jsx("h2",{className:"text-lg font-semibold mt-3 mb-2",children:e}),h3:({children:e})=>s.jsx("h3",{className:"text-base font-semibold mt-2 mb-1",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:e}),ol:({children:e})=>s.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:e}),li:({children:e})=>s.jsx("li",{className:"marker:text-muted-foreground",children:e}),code:({className:e,children:r,...t})=>{if(!(e?.includes("hljs")||e?.includes("language-")))return s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-sm font-mono text-foreground",...t,children:r});const o=e?.match(/language-(\w+)/)?.[1];return s.jsxs("div",{className:"relative my-3 rounded-lg border bg-muted/50 overflow-hidden",children:[o&&s.jsx("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted border-b text-[10px] text-muted-foreground font-mono uppercase",children:s.jsx("span",{children:o})}),s.jsx("pre",{className:"p-3 overflow-x-auto text-sm leading-relaxed m-0",children:s.jsx("code",{className:e,...t,children:r})})]})},blockquote:({children:e})=>s.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-4 italic text-muted-foreground my-3",children:e}),a:({href:e,children:r})=>s.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80 transition-colors",children:r}),table:({children:e})=>s.jsx("div",{className:"overflow-x-auto my-3 rounded-lg border",children:s.jsx("table",{className:"w-full text-sm border-collapse",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"bg-muted border-b",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left font-medium text-foreground",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 border-b border-muted",children:e}),hr:()=>s.jsx("hr",{className:"my-4 border-border"}),strong:({children:e})=>s.jsx("strong",{className:"font-semibold text-foreground",children:e})},children:a}),l&&s.jsx("span",{className:"inline-block w-0.5 h-4 bg-foreground/70 ml-0.5 align-text-bottom animate-pulse"})]})}export{c as M};
@@ -1 +1 @@
1
- import{J as m,C as e,g as w,D as d,e as v,x as p,h as f,c as y,f as C,L as k,S,u as I}from"./index-DsMUdp1X.js";import{M as g}from"./MarkdownMessage-DL1aUod4.js";import{C as T}from"./ChatInputBlock-BYpIR_ls.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,u]=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(()=>u(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,u)=>{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}-${u}`)})})]})}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 L(t){if(!t||isNaN(t))return null;try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return null}}function D(){const t=m(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(),u=!!s.toolCalls?.length,i=L(s.timestamp),x=o||!r&&!l&&(n||u);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&&u&&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}),u&&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 J(){const{activeSessionId:t,isStreaming:s}=m(),r=m(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(D,{})})}),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 B(){const{sessionId:t}=I.useParams(),s=m(o=>o.switchSession),r=m(o=>o.loadSessions),a=m(o=>o.sessionsLoaded);return d.useEffect(()=>{a||r()},[a,r]),d.useEffect(()=>{t&&s(t)},[t,s]),e.jsx(J,{})}export{B as component};
1
+ import{J as m,C as e,g as w,D as d,e as v,x as p,h as f,c as y,f as C,L as k,S,u as I}from"./index-om9XIKI1.js";import{M as g}from"./MarkdownMessage-CFmUlx03.js";import{C as T}from"./ChatInputBlock-BsakEj7f.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,u]=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(()=>u(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,u)=>{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}-${u}`)})})]})}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 L(t){if(!t||isNaN(t))return null;try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return null}}function D(){const t=m(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(),u=!!s.toolCalls?.length,i=L(s.timestamp),x=o||!r&&!l&&(n||u);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&&u&&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}),u&&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 J(){const{activeSessionId:t,isStreaming:s}=m(),r=m(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(D,{})})}),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 B(){const{sessionId:t}=I.useParams(),s=m(o=>o.switchSession),r=m(o=>o.loadSessions),a=m(o=>o.sessionsLoaded);return d.useEffect(()=>{a||r()},[a,r]),d.useEffect(()=>{t&&s(t)},[t,s]),e.jsx(J,{})}export{B as component};
@@ -1 +1 @@
1
- import{K as c,J as a,D as o,y as u,C as i}from"./index-DsMUdp1X.js";function f(){const s=c(),n=a(e=>e.sessionsLoaded),t=a(e=>e.sessions),r=o.useRef(!1);return o.useEffect(()=>{if(n)if(t.length>0)s({to:"/chat/$sessionId",params:{sessionId:t[0].id},replace:!0});else{if(r.current)return;r.current=!0,u({title:"",source:"api_server"}).then(e=>{s({to:"/chat/$sessionId",params:{sessionId:e.id},replace:!0})}).catch(()=>{r.current=!1})}},[n,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{f as component};
1
+ import{K as c,J as a,D as o,y as u,C as i}from"./index-om9XIKI1.js";function f(){const s=c(),n=a(e=>e.sessionsLoaded),t=a(e=>e.sessions),r=o.useRef(!1);return o.useEffect(()=>{if(n)if(t.length>0)s({to:"/chat/$sessionId",params:{sessionId:t[0].id},replace:!0});else{if(r.current)return;r.current=!0,u({title:"",source:"api_server"}).then(e=>{s({to:"/chat/$sessionId",params:{sessionId:e.id},replace:!0})}).catch(()=>{r.current=!1})}},[n,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{f as component};
@@ -1 +1 @@
1
- import{K as a,C as e}from"./index-DsMUdp1X.js";import{C as n}from"./ChatInputBlock-BYpIR_ls.js";function o(){const t=a();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-semibold tracking-tight text-foreground text-center",children:"What can I help you with?"}),e.jsx("div",{className:"w-full",children:e.jsx(n,{onCreateSession:s=>{t({to:"/chat/$sessionId",params:{sessionId:s}})}})})]})})}export{o as component};
1
+ import{K as a,C as e}from"./index-om9XIKI1.js";import{C as n}from"./ChatInputBlock-BsakEj7f.js";function o(){const t=a();return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-4",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-2xl mx-auto",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-semibold tracking-tight text-foreground text-center",children:"What can I help you with?"}),e.jsx("div",{className:"w-full",children:e.jsx(n,{onCreateSession:s=>{t({to:"/chat/$sessionId",params:{sessionId:s}})}})})]})})}export{o as component};