llmpt 1.3.8 → 1.3.9
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/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## v1.3.4 (2026-06-16)
|
|
4
4
|
|
|
5
|
-
### 修复
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
5
|
+
### 重构 & 修复
|
|
6
|
+
- 引入 `normalizeMessage` 函数,在渲染前将各 Provider 格式统一为内部标准结构,消除双套渲染逻辑
|
|
7
|
+
- 新增统一的 `ToolUseBlock` 组件,OpenAI `tool_calls` 与 Anthropic `tool_use` ContentPart 共用同一套折叠交互
|
|
8
|
+
- `ContentBlock` text 类型去除内嵌 toggle bar,`textMode` prop 由外层 `MessageBlock` 统一下发
|
|
9
|
+
- 修复:Anthropic `tool_result` 消息(role=user)正确显示为 TOOL 角色
|
|
10
|
+
- 修复:Anthropic `tool_use` ContentPart 现在显示函数名并支持折叠(之前始终展开且无名称)
|
|
11
|
+
- 修复:Anthropic `tool_result` 内容读取 `block.content` 字段(之前错误读取 `block.text` 导致内容为空)
|
|
12
|
+
- 修复:Anthropic assistant ContentPart[] 中 text 块 toggle 与 OpenAI 纯字符串路径行为一致
|
|
9
13
|
|
|
10
14
|
---
|
|
11
15
|
|
|
@@ -6,13 +6,13 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,D as n,E as r,O
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
`),children:(0,K.jsx)(`div`,{className:`messages-list`,children:s.map((e,t)=>(0,K.jsx)(
|
|
9
|
+
`),children:(0,K.jsx)(`div`,{className:`messages-list`,children:s.map((e,t)=>(0,K.jsx)(be,{message:e},t))})}),(0,K.jsxs)(Y,{title:`Response`,defaultOpen:!0,badge:t?`${t}`:r?`live`:void 0,copyText:(u?typeof u==`string`?u:u.map(e=>e.text||``).join(`
|
|
10
10
|
|
|
11
|
-
`):``)||void 0,children:[l&&(0,K.jsx)(Ee,{content:l}),u?(0,K.jsx)(
|
|
11
|
+
`):``)||void 0,children:[l&&(0,K.jsx)(Ee,{content:l}),u?(0,K.jsx)(be,{message:{role:`assistant`,content:u},isStreaming:r}):e.error?(0,K.jsxs)(`div`,{className:`msg system`,style:{marginBottom:0},children:[(0,K.jsx)(`span`,{className:`msg-role`,style:{background:`var(--red)`,color:`#fff`},children:`ERROR`}),(0,K.jsxs)(`div`,{className:`content-block`,children:[`[`,e.error.code,`] `,e.error.message]})]}):(0,K.jsx)(`div`,{style:{color:`var(--text-tertiary)`,fontSize:`13px`,padding:`4px 0`},children:r?(0,K.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:`8px`,color:`var(--text-tertiary)`,fontSize:`12px`},children:[`接收中 `,(0,K.jsxs)(`span`,{className:`streaming-dots`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{})]})]}):`No response content`})]}),f.length>0&&(0,K.jsx)(Y,{title:`Tool Calls`,defaultOpen:!0,badge:`${f.length}`,copyText:f.map(e=>`${e.name}(${JSON.stringify(e.arguments,null,2)})`).join(`
|
|
12
12
|
|
|
13
|
-
`),children:(0,K.jsx)(`div`,{style:{display:`grid`,gap:`4px`},children:f.map((e,t)=>(0,K.jsx)(De,{toolCall:e},t))})}),d.length>0&&(0,K.jsx)(Y,{title:`Tools Definition`,defaultOpen:!1,badge:`${d.length}`,copyText:JSON.stringify(d,null,2),children:(0,K.jsx)(Oe,{tools:d})}),(0,K.jsx)(Y,{title:`Raw JSON`,defaultOpen:!1,copyText:JSON.stringify(e,null,2),children:(0,K.jsx)(Q,{data:e})})]})}function _e(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e}ms`}function ve({usage:e,duration:t,ttfb:n,isStreaming:r}){let i=(e?.cachedTokens||0)+(e?.cacheReadTokens||0)+(e?.cacheWriteTokens||0)>0;return(0,K.jsx)(`div`,{className:`token-usage-bar`,children:(0,K.jsx)(`div`,{className:`token-bar`,children:r?(0,K.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:`6px`,fontSize:`11px`,color:`var(--text-tertiary)`},children:[`接收中 `,(0,K.jsxs)(`span`,{className:`streaming-dots`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{})]})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`tok-group`,children:(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`合计`}),(0,K.jsx)(`span`,{className:`tok-val`,style:{color:`var(--text)`,fontSize:`12px`},children:e.totalTokens.toLocaleString()})]})}),(0,K.jsxs)(`span`,{className:`tok-group`,children:[(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-arrow`,style:{color:`var(--blue)`},children:`↑`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.promptTokens.toLocaleString()})]}),(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-arrow`,style:{color:`var(--green)`},children:`↓`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.completionTokens.toLocaleString()})]}),(e.reasoningTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--indigo)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`推理`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.reasoningTokens.toLocaleString()})]})]}),i&&(0,K.jsxs)(`span`,{className:`tok-group`,children:[(e.cachedTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--cyan)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`缓存命中`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.cachedTokens.toLocaleString()})]}),(e.cacheReadTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--cyan)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`缓存读`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.cacheReadTokens.toLocaleString()})]}),(e.cacheWriteTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--amber)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`缓存写`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.cacheWriteTokens.toLocaleString()})]})]}),(0,K.jsxs)(`span`,{className:`tok-group`,children:[n>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`首字`}),(0,K.jsx)(`span`,{className:`tok-val`,children:_e(n)})]}),t>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`耗时`}),(0,K.jsx)(`span`,{className:`tok-val`,children:_e(t)})]}),t>0&&(e.completionTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`速度`}),(0,K.jsxs)(`span`,{className:`tok-val`,children:[Math.round(e.completionTokens/(t/1e3)),` tok/s`]})]})]})]}):(0,K.jsx)(`span`,{style:{color:`var(--text-tertiary)`,fontSize:`11px`},children:`无 token 数据`})})})}function Y({title:e,defaultOpen:t,badge:n,copyText:r,children:i}){let[a,o]=(0,V.useState)(he[e]??t);return(0,K.jsxs)(`div`,{className:`section`,children:[(0,K.jsxs)(`div`,{className:`section-header`,onClick:()=>{let t=!a;o(t),he[e]=t},children:[(0,K.jsx)(`span`,{className:`chevron${a?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`title`,children:e}),n&&(0,K.jsx)(`span`,{className:`badge`,children:n}),r!==void 0&&r!==``&&(0,K.jsx)(Z,{getText:()=>r,className:`copy-btn`,stopPropagation:!0})]}),a&&(0,K.jsx)(`div`,{className:`section-body open`,children:i})]})}function ye(
|
|
13
|
+
`),children:(0,K.jsx)(`div`,{style:{display:`grid`,gap:`4px`},children:f.map((e,t)=>(0,K.jsx)(De,{toolCall:e},t))})}),d.length>0&&(0,K.jsx)(Y,{title:`Tools Definition`,defaultOpen:!1,badge:`${d.length}`,copyText:JSON.stringify(d,null,2),children:(0,K.jsx)(Oe,{tools:d})}),(0,K.jsx)(Y,{title:`Raw JSON`,defaultOpen:!1,copyText:JSON.stringify(e,null,2),children:(0,K.jsx)(Q,{data:e})})]})}function _e(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e}ms`}function ve({usage:e,duration:t,ttfb:n,isStreaming:r}){let i=(e?.cachedTokens||0)+(e?.cacheReadTokens||0)+(e?.cacheWriteTokens||0)>0;return(0,K.jsx)(`div`,{className:`token-usage-bar`,children:(0,K.jsx)(`div`,{className:`token-bar`,children:r?(0,K.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:`6px`,fontSize:`11px`,color:`var(--text-tertiary)`},children:[`接收中 `,(0,K.jsxs)(`span`,{className:`streaming-dots`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{}),(0,K.jsx)(`span`,{})]})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`tok-group`,children:(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`合计`}),(0,K.jsx)(`span`,{className:`tok-val`,style:{color:`var(--text)`,fontSize:`12px`},children:e.totalTokens.toLocaleString()})]})}),(0,K.jsxs)(`span`,{className:`tok-group`,children:[(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-arrow`,style:{color:`var(--blue)`},children:`↑`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.promptTokens.toLocaleString()})]}),(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-arrow`,style:{color:`var(--green)`},children:`↓`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.completionTokens.toLocaleString()})]}),(e.reasoningTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--indigo)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`推理`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.reasoningTokens.toLocaleString()})]})]}),i&&(0,K.jsxs)(`span`,{className:`tok-group`,children:[(e.cachedTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--cyan)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`缓存命中`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.cachedTokens.toLocaleString()})]}),(e.cacheReadTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--cyan)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`缓存读`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.cacheReadTokens.toLocaleString()})]}),(e.cacheWriteTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-dot`,style:{background:`var(--amber)`}}),(0,K.jsx)(`span`,{className:`tok-label`,children:`缓存写`}),(0,K.jsx)(`span`,{className:`tok-val`,children:e.cacheWriteTokens.toLocaleString()})]})]}),(0,K.jsxs)(`span`,{className:`tok-group`,children:[n>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`首字`}),(0,K.jsx)(`span`,{className:`tok-val`,children:_e(n)})]}),t>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`耗时`}),(0,K.jsx)(`span`,{className:`tok-val`,children:_e(t)})]}),t>0&&(e.completionTokens||0)>0&&(0,K.jsxs)(`span`,{className:`tok-item`,children:[(0,K.jsx)(`span`,{className:`tok-label`,children:`速度`}),(0,K.jsxs)(`span`,{className:`tok-val`,children:[Math.round(e.completionTokens/(t/1e3)),` tok/s`]})]})]})]}):(0,K.jsx)(`span`,{style:{color:`var(--text-tertiary)`,fontSize:`11px`},children:`无 token 数据`})})})}function Y({title:e,defaultOpen:t,badge:n,copyText:r,children:i}){let[a,o]=(0,V.useState)(he[e]??t);return(0,K.jsxs)(`div`,{className:`section`,children:[(0,K.jsxs)(`div`,{className:`section-header`,onClick:()=>{let t=!a;o(t),he[e]=t},children:[(0,K.jsx)(`span`,{className:`chevron${a?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`title`,children:e}),n&&(0,K.jsx)(`span`,{className:`badge`,children:n}),r!==void 0&&r!==``&&(0,K.jsx)(Z,{getText:()=>r,className:`copy-btn`,stopPropagation:!0})]}),a&&(0,K.jsx)(`div`,{className:`section-body open`,children:i})]})}function ye(e){let t=e.role,n=e.content;if(t===`user`&&Array.isArray(n)&&n.length>0&&n.every(e=>e.type===`tool_result`)){let e=n[0],t=e.content??e.text;return{role:`tool`,content:typeof t==`string`?t:JSON.stringify(t??``),tool_call_id:e.tool_use_id}}return{role:t,content:n,tool_call_id:e.tool_call_id,tool_calls:e.tool_calls}}function be({message:e,isStreaming:t}){let{role:n,content:r,tool_calls:i}=ye(e),a=n===`assistant`,o=typeof r==`string`,s=!o&&Array.isArray(r)&&r.some(e=>e.type===`text`||e.type===`input_text`||e.type===`output_text`),c=o&&r.trim().length>0||s,[l,u]=(0,V.useState)(a?`markdown`:`raw`),d=()=>typeof r==`string`?r:Array.isArray(r)?r.map(e=>e.text||e.thinking||``).filter(Boolean).join(`
|
|
14
14
|
|
|
15
|
-
`):``,f=i===`user`?`user`:i===`assistant`?`assistant`:i===`system`||i===`developer`?`system`:i===`tool`?`tool_result`:``,p=e.tool_calls,m=o?r.trim().length>0:Array.isArray(r)&&r.length>0,[h,g]=(0,V.useState)(i===`tool`);return(0,K.jsxs)(`div`,{className:`msg ${f}`,children:[(0,K.jsxs)(`div`,{className:`msg-header-row`,children:[(0,K.jsxs)(`span`,{className:`msg-role msg-role-toggle`,onClick:()=>g(e=>!e),title:h?`展开`:`收起`,children:[(0,K.jsx)(`span`,{className:`msg-collapse-arrow${h?``:` open`}`,children:`▶`}),i.toUpperCase()]}),c&&(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginLeft:`8px`,marginTop:0,display:h?`none`:void 0},children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${l===`raw`?` active`:``}`,onClick:()=>u(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${l===`markdown`?` active`:``}`,onClick:()=>u(`markdown`),children:`渲染`})]}),(0,K.jsx)(`span`,{style:{marginLeft:`auto`},children:(0,K.jsx)(Z,{getText:d})})]}),!h&&(0,K.jsxs)(K.Fragment,{children:[o?(0,K.jsx)(we,{text:r,mode:l}):Array.isArray(r)?(0,K.jsx)(`div`,{children:r.map((e,n)=>(0,K.jsx)(xe,{block:e,mode:s?l:void 0,isStreaming:t&&n===r.length-1},n))}):r?(0,K.jsx)(Q,{data:r}):null,p&&p.length>0&&(0,K.jsx)(`div`,{className:`msg-tool-calls`,children:p.map(e=>(0,K.jsx)(be,{toolCall:e},e.id))})]}),h&&(m||p&&p.length>0)&&(0,K.jsx)(`div`,{className:`msg-collapsed-hint`,children:[m?o?`${r.slice(0,60).replace(/\n/g,` `)}…`:`${r.length} 块`:``,p?.length?`${p.length} tool_call`:``].filter(Boolean).join(` · `)})]})}function be({toolCall:e}){let[t,n]=(0,V.useState)(!1),r=e.function.arguments;try{r=JSON.parse(e.function.arguments)}catch{}let i=typeof r==`object`&&r?Object.keys(r).length:0;return(0,K.jsxs)(`div`,{className:`tool-block`,children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${t?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:e.function.name}),!t&&i>0&&(0,K.jsxs)(`span`,{className:`tb-desc`,children:[`(`,i,` args)`]})]}),t&&(0,K.jsx)(`div`,{className:`tool-block-body open`,children:typeof r==`object`?(0,K.jsx)(Q,{data:r}):(0,K.jsx)(`pre`,{className:`text-raw`,children:String(r)})})]})}function xe({block:e,mode:t,isStreaming:n}){let[r]=(0,V.useState)(`markdown`),i=t??r;if(e.type===`text`||e.type===`input_text`||e.type===`output_text`)return(0,K.jsx)(`div`,{className:`content-block`,children:(0,K.jsx)(X,{text:e.text||``,mode:i,isStreaming:n})});if(e.type===`thinking`)return(0,K.jsx)(Te,{content:e.thinking||``});if(e.type===`tool_use`)return(0,K.jsx)(Se,{block:e});if(e.type===`tool_result`){let t=e.content??e.text;return(0,K.jsxs)(`div`,{className:`content-block block-framed`,style:{borderColor:`var(--purple)`,background:`var(--purple-bg)`},children:[(0,K.jsxs)(`span`,{className:`tool-use-label`,style:{color:`var(--purple)`,background:`color-mix(in srgb, var(--purple) 15%, transparent)`},children:[`↩ tool_result: `,e.tool_use_id||``]}),(0,K.jsx)(`div`,{className:`content-block-text`,children:typeof t==`string`?t:(0,K.jsx)(Q,{data:t})})]})}return(0,K.jsx)(Q,{data:e})}function Se({block:e}){let[t,n]=(0,V.useState)(!1),r=e.input&&typeof e.input==`object`?Object.keys(e.input).length:0;return(0,K.jsxs)(`div`,{className:`tool-block`,style:{margin:`4px 0`},children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${t?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:e.name||`tool_use`}),!t&&r>0&&(0,K.jsxs)(`span`,{className:`tb-desc`,children:[`(`,r,` args)`]}),e.id&&(0,K.jsx)(`span`,{style:{marginLeft:`auto`,opacity:.45,fontSize:`11px`,fontFamily:`var(--mono)`},children:e.id})]}),t&&(0,K.jsx)(`div`,{className:`tool-block-body open`,children:(0,K.jsx)(Q,{data:e.input})})]})}function X({text:e,mode:t,isStreaming:n,sans:r,compact:i,className:a}){return e?(0,K.jsxs)(`div`,{className:`text-pane${a?` `+a:``}`,children:[(0,K.jsx)(`pre`,{className:`text-raw${r?` sans`:``}`,style:{display:t===`raw`?void 0:`none`},children:e}),(0,K.jsx)(`div`,{style:{display:t===`markdown`?void 0:`none`},children:i?(0,K.jsx)(`div`,{className:`text-raw sans`,style:{whiteSpace:`pre-wrap`},children:e}):(0,K.jsx)(me,{text:e,isStreaming:n})})]}):null}function Ce({text:e}){let[t,n]=(0,V.useState)(`raw`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginBottom:`6px`},children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${t===`raw`?` active`:``}`,onClick:()=>n(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${t===`markdown`?` active`:``}`,onClick:()=>n(`markdown`),children:`渲染`})]}),(0,K.jsx)(X,{text:e,mode:t,sans:!0})]})}function we({text:e,mode:t}){return e?(0,K.jsx)(X,{text:e,mode:t}):null}function Te({content:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(`raw`),a=e.slice(0,80).replace(/\n/g,` `);return(0,K.jsxs)(`div`,{className:`thinking-block content-block`,children:[(0,K.jsxs)(`div`,{className:`thinking-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsxs)(`span`,{className:`thinking-label`,children:[(0,K.jsx)(`span`,{className:`thinking-arrow`,children:t?`▼`:`▶`}),(0,K.jsx)(`span`,{children:`Thinking`})]}),t?(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginTop:0,marginLeft:`4px`},onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`raw`?` active`:``}`,onClick:()=>i(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`markdown`?` active`:``}`,onClick:()=>i(`markdown`),children:`渲染`})]}):(0,K.jsxs)(`span`,{className:`thinking-preview`,children:[a,`…`]}),(0,K.jsx)(Z,{getText:()=>e,stopPropagation:!0,className:`copy-btn`})]}),t&&(0,K.jsx)(X,{text:e,mode:r,sans:!0})]})}function Ee({content:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(`raw`),a=e.slice(0,80).replace(/\n/g,` `);return(0,K.jsxs)(`div`,{className:`thinking-block content-block`,style:{marginBottom:`8px`},children:[(0,K.jsxs)(`div`,{className:`thinking-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsxs)(`span`,{className:`thinking-label`,children:[(0,K.jsx)(`span`,{className:`thinking-arrow`,children:t?`▼`:`▶`}),(0,K.jsx)(`span`,{children:`Thinking`})]}),t?(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginTop:0,marginLeft:`4px`},onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`raw`?` active`:``}`,onClick:()=>i(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`markdown`?` active`:``}`,onClick:()=>i(`markdown`),children:`渲染`})]}):(0,K.jsxs)(`span`,{className:`thinking-preview`,children:[a,`…`]}),(0,K.jsx)(Z,{getText:()=>e,stopPropagation:!0,className:`copy-btn`})]}),t&&(0,K.jsx)(X,{text:e,mode:r,sans:!0})]})}function De({toolCall:e}){let[t,n]=(0,V.useState)(!1),r=typeof e.arguments==`object`?Object.keys(e.arguments||{}).length:0;return(0,K.jsxs)(`div`,{className:`tool-block`,children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${t?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:e.name}),!t&&r>0&&(0,K.jsxs)(`span`,{className:`tb-desc`,children:[`(`,r,` args)`]})]}),t&&(0,K.jsxs)(`div`,{className:`tool-block-body open`,children:[(0,K.jsx)(Q,{data:e.arguments}),e.result!==void 0&&(0,K.jsxs)(`div`,{style:{marginTop:`10px`,paddingTop:`10px`,borderTop:`1px solid var(--border-light)`},children:[(0,K.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:600,color:`var(--orange)`,marginBottom:`6px`,textTransform:`uppercase`},children:`Result`}),(0,K.jsx)(Q,{data:e.result})]})]})]})}function Oe({tools:e}){return(0,K.jsx)(`div`,{style:{display:`grid`,gap:`4px`},children:e.map((e,t)=>(0,K.jsx)(ke,{tool:e},t))})}function ke({tool:e}){let[t,n]=(0,V.useState)(!1),r=e.function||e,i=r.name||e.name||`unknown`,a=r.description||e.description||``,o=r.parameters||e.input_schema||e.parameters,s=o?.required||[],c=o?.properties||{};return(0,K.jsxs)(`div`,{className:`tool-block`,children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${t?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:i}),(0,K.jsx)(`span`,{className:`tb-desc`,children:a})]}),t&&(0,K.jsxs)(`div`,{className:`tool-block-body open`,children:[a&&(0,K.jsx)(`div`,{className:`tb-full-desc`,children:a}),Object.keys(c).length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`tb-params-title`,children:`Parameters`}),Object.entries(c).map(([e,t])=>(0,K.jsxs)(`div`,{className:`tb-param`,children:[(0,K.jsxs)(`div`,{className:`tb-param-row1`,children:[(0,K.jsx)(`span`,{className:`tb-pname`,children:e}),t.type&&(0,K.jsx)(`span`,{className:`tb-ptype`,children:t.type}),s.includes(e)&&(0,K.jsx)(`span`,{className:`tb-prequired`,children:`required`})]}),t.description&&(0,K.jsx)(`div`,{className:`tb-pdesc`,children:t.description})]},e))]}):o?(0,K.jsx)(Q,{data:o}):null]})]})}function Z({getText:e,className:n=`copy-btn`,stopPropagation:i=!1}){let[a,o]=(0,V.useState)(!1);return(0,K.jsx)(`button`,{className:`${n}${a?` copied`:``}`,onClick:async t=>{i&&t.stopPropagation();try{await navigator.clipboard.writeText(e()),o(!0),setTimeout(()=>o(!1),1500)}catch{}},"data-tip":`复制`,children:a?(0,K.jsx)(r,{size:10}):(0,K.jsx)(t,{size:10})})}var Ae=0;function Q({data:e}){return Ae=0,(0,K.jsx)(`div`,{className:`json-view`,children:$(e,0)})}var je=new Set([`chunks`,`headers`,`tools`]);function $(e,t,n){if(t>50)return(0,K.jsx)(`span`,{className:`json-punct`,children:`…`});if(e===null)return(0,K.jsx)(`span`,{className:`jnull`,children:`null`});if(e===void 0)return(0,K.jsx)(`span`,{className:`jnull`,children:`undefined`});if(typeof e==`boolean`)return(0,K.jsx)(`span`,{className:`jb`,children:String(e)});if(typeof e==`number`)return(0,K.jsx)(`span`,{className:`jn`,children:e});if(typeof e==`string`)return(0,K.jsxs)(`span`,{className:`js`,children:[`"`,e.length>300?e.slice(0,300)+`…`:e,`"`]});if(typeof e!=`object`)return(0,K.jsx)(`span`,{children:String(e)});let r=Array.isArray(e),i=r?e.map((e,t)=>[t,e]):Object.entries(e),a=i.length;if(a===0)return(0,K.jsx)(`span`,{className:`json-punct`,children:r?`[]`:`{}`});if(a<=3&&t<2&&i.every(([,e])=>typeof e!=`object`||!e)){let e=i.map(([e,n],i)=>(0,K.jsxs)(`span`,{children:[!r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`jk`,children:[`"`,String(e),`"`]}),(0,K.jsx)(`span`,{className:`json-punct`,children:`: `})]}),$(n,t+1),i<a-1&&(0,K.jsx)(`span`,{className:`json-punct`,children:`, `})]},String(e)));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`json-punct`,children:r?`[`:`{`}),e,(0,K.jsx)(`span`,{className:`json-punct`,children:r?`]`:`}`})]})}let o=`jt`+ Ae++,s=`${a} ${r?`item`:`key`}${a===1?``:`s`}`,c=n!==void 0&&je.has(n),l=i.map(([e,n])=>(0,K.jsxs)(`div`,{className:`jt-line`,children:[!r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`jk`,children:[`"`,String(e),`"`]}),(0,K.jsx)(`span`,{className:`json-punct`,children:`: `})]}),$(n,t+1,String(e))]},String(e)));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`jt-toggle${c?``:` jt-open`}`,onClick:e=>Me(e,o),style:{cursor:`pointer`},children:c?`▶`:`▼`}),(0,K.jsx)(`span`,{className:`json-punct`,children:r?`[`:`{`}),(0,K.jsxs)(`span`,{className:`jt-summary${c?` jt-show`:``}`,id:`${o}s`,children:[`… `,s]}),(0,K.jsx)(`div`,{className:`jt-children${c?``:` jt-open`}`,id:o,children:l}),(0,K.jsx)(`div`,{className:`jt-close${c?` jt-hidden`:``}`,id:`${o}c`,children:(0,K.jsx)(`span`,{className:`json-punct`,children:r?`]`:`}`})})]})}function Me(e,t){e.stopPropagation();let n=document.getElementById(t),r=document.getElementById(t+`s`),i=document.getElementById(t+`c`),a=e.currentTarget;n&&(n.classList.contains(`jt-open`)?(n.classList.remove(`jt-open`),a.classList.remove(`jt-open`),a.textContent=`▶`,r?.classList.add(`jt-show`),i?.classList.add(`jt-hidden`)):(n.classList.add(`jt-open`),a.classList.add(`jt-open`),a.textContent=`▼`,r?.classList.remove(`jt-show`),i?.classList.remove(`jt-hidden`)))}function Ne(e){let t=e.request.body,n=[];if(typeof t.system==`string`&&t.system.trim())n.push(t.system);else if(Array.isArray(t.system)){let e=t.system.map(e=>typeof e==`string`?e:e?.type===`text`&&e.text||``).filter(Boolean).join(`
|
|
15
|
+
`):``,f=n===`user`?`user`:n===`assistant`?`assistant`:n===`system`||n===`developer`?`system`:n===`tool`?`tool_result`:``,p=o?r.trim().length>0:Array.isArray(r)&&r.length>0,[m,h]=(0,V.useState)(n===`tool`);return(0,K.jsxs)(`div`,{className:`msg ${f}`,children:[(0,K.jsxs)(`div`,{className:`msg-header-row`,children:[(0,K.jsxs)(`span`,{className:`msg-role msg-role-toggle`,onClick:()=>h(e=>!e),title:m?`展开`:`收起`,children:[(0,K.jsx)(`span`,{className:`msg-collapse-arrow${m?``:` open`}`,children:`▶`}),n.toUpperCase()]}),c&&!m&&(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginLeft:`8px`,marginTop:0},children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${l===`raw`?` active`:``}`,onClick:()=>u(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${l===`markdown`?` active`:``}`,onClick:()=>u(`markdown`),children:`渲染`})]}),(0,K.jsx)(`span`,{style:{marginLeft:`auto`},children:(0,K.jsx)(Z,{getText:d})})]}),!m&&(0,K.jsxs)(K.Fragment,{children:[o?(0,K.jsx)(we,{text:r,mode:l}):Array.isArray(r)?(0,K.jsx)(`div`,{children:r.map((e,n)=>(0,K.jsx)(Se,{block:e,textMode:s?l:`markdown`,isStreaming:t&&n===r.length-1},n))}):r?(0,K.jsx)(Q,{data:r}):null,i&&i.length>0&&(0,K.jsx)(`div`,{className:`msg-tool-calls`,children:i.map(e=>(0,K.jsx)(xe,{name:e.function.name,callId:e.id,rawArgs:e.function.arguments},e.id))})]}),m&&(p||i&&i.length>0)&&(0,K.jsx)(`div`,{className:`msg-collapsed-hint`,children:[p?o?`${r.slice(0,60).replace(/\n/g,` `)}…`:`${r.length} 块`:``,i?.length?`${i.length} tool_call`:``].filter(Boolean).join(` · `)})]})}function xe({name:e,callId:t,rawArgs:n,block:r}){let[i,a]=(0,V.useState)(!1),o=e??r?.name??`tool_use`,s=t??r?.id??``,c=r?.input??n;if(typeof c==`string`)try{c=JSON.parse(c)}catch{}let l=c&&typeof c==`object`?Object.keys(c).length:0;return(0,K.jsxs)(`div`,{className:`tool-block`,children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>a(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${i?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:o}),!i&&l>0&&(0,K.jsxs)(`span`,{className:`tb-desc`,children:[`(`,l,` args)`]}),s&&(0,K.jsx)(`span`,{style:{marginLeft:`auto`,opacity:.45,fontSize:`11px`,fontFamily:`var(--mono)`},children:s})]}),i&&(0,K.jsx)(`div`,{className:`tool-block-body open`,children:typeof c==`object`?(0,K.jsx)(Q,{data:c}):(0,K.jsx)(`pre`,{className:`text-raw`,children:String(c)})})]})}function Se({block:e,textMode:t,isStreaming:n}){let r=t??`markdown`;if(e.type===`text`||e.type===`input_text`||e.type===`output_text`)return(0,K.jsx)(`div`,{className:`content-block`,children:(0,K.jsx)(X,{text:e.text||``,mode:r,isStreaming:n})});if(e.type===`thinking`)return(0,K.jsx)(Te,{content:e.thinking||``});if(e.type===`tool_use`)return(0,K.jsx)(xe,{block:e});if(e.type===`tool_result`){let t=e.content??e.text;return(0,K.jsxs)(`div`,{className:`content-block block-framed`,style:{borderColor:`var(--purple)`,background:`var(--purple-bg)`},children:[(0,K.jsxs)(`span`,{className:`tool-use-label`,style:{color:`var(--purple)`,background:`color-mix(in srgb, var(--purple) 15%, transparent)`},children:[`↩ tool_result: `,e.tool_use_id||``]}),(0,K.jsx)(`div`,{className:`content-block-text`,children:typeof t==`string`?t:(0,K.jsx)(Q,{data:t})})]})}return(0,K.jsx)(Q,{data:e})}function X({text:e,mode:t,isStreaming:n,sans:r,compact:i,className:a}){return e?(0,K.jsxs)(`div`,{className:`text-pane${a?` `+a:``}`,children:[(0,K.jsx)(`pre`,{className:`text-raw${r?` sans`:``}`,style:{display:t===`raw`?void 0:`none`},children:e}),(0,K.jsx)(`div`,{style:{display:t===`markdown`?void 0:`none`},children:i?(0,K.jsx)(`div`,{className:`text-raw sans`,style:{whiteSpace:`pre-wrap`},children:e}):(0,K.jsx)(me,{text:e,isStreaming:n})})]}):null}function Ce({text:e}){let[t,n]=(0,V.useState)(`raw`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginBottom:`6px`},children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${t===`raw`?` active`:``}`,onClick:()=>n(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${t===`markdown`?` active`:``}`,onClick:()=>n(`markdown`),children:`渲染`})]}),(0,K.jsx)(X,{text:e,mode:t,sans:!0})]})}function we({text:e,mode:t}){return e?(0,K.jsx)(X,{text:e,mode:t}):null}function Te({content:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(`raw`),a=e.slice(0,80).replace(/\n/g,` `);return(0,K.jsxs)(`div`,{className:`thinking-block content-block`,children:[(0,K.jsxs)(`div`,{className:`thinking-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsxs)(`span`,{className:`thinking-label`,children:[(0,K.jsx)(`span`,{className:`thinking-arrow`,children:t?`▼`:`▶`}),(0,K.jsx)(`span`,{children:`Thinking`})]}),t?(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginTop:0,marginLeft:`4px`},onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`raw`?` active`:``}`,onClick:()=>i(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`markdown`?` active`:``}`,onClick:()=>i(`markdown`),children:`渲染`})]}):(0,K.jsxs)(`span`,{className:`thinking-preview`,children:[a,`…`]}),(0,K.jsx)(Z,{getText:()=>e,stopPropagation:!0,className:`copy-btn`})]}),t&&(0,K.jsx)(X,{text:e,mode:r,sans:!0})]})}function Ee({content:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(`raw`),a=e.slice(0,80).replace(/\n/g,` `);return(0,K.jsxs)(`div`,{className:`thinking-block content-block`,style:{marginBottom:`8px`},children:[(0,K.jsxs)(`div`,{className:`thinking-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsxs)(`span`,{className:`thinking-label`,children:[(0,K.jsx)(`span`,{className:`thinking-arrow`,children:t?`▼`:`▶`}),(0,K.jsx)(`span`,{children:`Thinking`})]}),t?(0,K.jsxs)(`div`,{className:`text-toggle-bar`,style:{marginTop:0,marginLeft:`4px`},onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`raw`?` active`:``}`,onClick:()=>i(`raw`),children:`原文`}),(0,K.jsx)(`button`,{className:`text-toggle-btn${r===`markdown`?` active`:``}`,onClick:()=>i(`markdown`),children:`渲染`})]}):(0,K.jsxs)(`span`,{className:`thinking-preview`,children:[a,`…`]}),(0,K.jsx)(Z,{getText:()=>e,stopPropagation:!0,className:`copy-btn`})]}),t&&(0,K.jsx)(X,{text:e,mode:r,sans:!0})]})}function De({toolCall:e}){let[t,n]=(0,V.useState)(!1),r=typeof e.arguments==`object`?Object.keys(e.arguments||{}).length:0;return(0,K.jsxs)(`div`,{className:`tool-block`,children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${t?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:e.name}),!t&&r>0&&(0,K.jsxs)(`span`,{className:`tb-desc`,children:[`(`,r,` args)`]})]}),t&&(0,K.jsxs)(`div`,{className:`tool-block-body open`,children:[(0,K.jsx)(Q,{data:e.arguments}),e.result!==void 0&&(0,K.jsxs)(`div`,{style:{marginTop:`10px`,paddingTop:`10px`,borderTop:`1px solid var(--border-light)`},children:[(0,K.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:600,color:`var(--orange)`,marginBottom:`6px`,textTransform:`uppercase`},children:`Result`}),(0,K.jsx)(Q,{data:e.result})]})]})]})}function Oe({tools:e}){return(0,K.jsx)(`div`,{style:{display:`grid`,gap:`4px`},children:e.map((e,t)=>(0,K.jsx)(ke,{tool:e},t))})}function ke({tool:e}){let[t,n]=(0,V.useState)(!1),r=e.function||e,i=r.name||e.name||`unknown`,a=r.description||e.description||``,o=r.parameters||e.input_schema||e.parameters,s=o?.required||[],c=o?.properties||{};return(0,K.jsxs)(`div`,{className:`tool-block`,children:[(0,K.jsxs)(`div`,{className:`tool-block-header`,onClick:()=>n(e=>!e),children:[(0,K.jsx)(`span`,{className:`tb-arrow${t?` open`:``}`,children:`▶`}),(0,K.jsx)(`span`,{className:`tb-name`,children:i}),(0,K.jsx)(`span`,{className:`tb-desc`,children:a})]}),t&&(0,K.jsxs)(`div`,{className:`tool-block-body open`,children:[a&&(0,K.jsx)(`div`,{className:`tb-full-desc`,children:a}),Object.keys(c).length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`tb-params-title`,children:`Parameters`}),Object.entries(c).map(([e,t])=>(0,K.jsxs)(`div`,{className:`tb-param`,children:[(0,K.jsxs)(`div`,{className:`tb-param-row1`,children:[(0,K.jsx)(`span`,{className:`tb-pname`,children:e}),t.type&&(0,K.jsx)(`span`,{className:`tb-ptype`,children:t.type}),s.includes(e)&&(0,K.jsx)(`span`,{className:`tb-prequired`,children:`required`})]}),t.description&&(0,K.jsx)(`div`,{className:`tb-pdesc`,children:t.description})]},e))]}):o?(0,K.jsx)(Q,{data:o}):null]})]})}function Z({getText:e,className:n=`copy-btn`,stopPropagation:i=!1}){let[a,o]=(0,V.useState)(!1);return(0,K.jsx)(`button`,{className:`${n}${a?` copied`:``}`,onClick:async t=>{i&&t.stopPropagation();try{await navigator.clipboard.writeText(e()),o(!0),setTimeout(()=>o(!1),1500)}catch{}},"data-tip":`复制`,children:a?(0,K.jsx)(r,{size:10}):(0,K.jsx)(t,{size:10})})}var Ae=0;function Q({data:e}){return Ae=0,(0,K.jsx)(`div`,{className:`json-view`,children:$(e,0)})}var je=new Set([`chunks`,`headers`,`tools`]);function $(e,t,n){if(t>50)return(0,K.jsx)(`span`,{className:`json-punct`,children:`…`});if(e===null)return(0,K.jsx)(`span`,{className:`jnull`,children:`null`});if(e===void 0)return(0,K.jsx)(`span`,{className:`jnull`,children:`undefined`});if(typeof e==`boolean`)return(0,K.jsx)(`span`,{className:`jb`,children:String(e)});if(typeof e==`number`)return(0,K.jsx)(`span`,{className:`jn`,children:e});if(typeof e==`string`)return(0,K.jsxs)(`span`,{className:`js`,children:[`"`,e.length>300?e.slice(0,300)+`…`:e,`"`]});if(typeof e!=`object`)return(0,K.jsx)(`span`,{children:String(e)});let r=Array.isArray(e),i=r?e.map((e,t)=>[t,e]):Object.entries(e),a=i.length;if(a===0)return(0,K.jsx)(`span`,{className:`json-punct`,children:r?`[]`:`{}`});if(a<=3&&t<2&&i.every(([,e])=>typeof e!=`object`||!e)){let e=i.map(([e,n],i)=>(0,K.jsxs)(`span`,{children:[!r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`jk`,children:[`"`,String(e),`"`]}),(0,K.jsx)(`span`,{className:`json-punct`,children:`: `})]}),$(n,t+1),i<a-1&&(0,K.jsx)(`span`,{className:`json-punct`,children:`, `})]},String(e)));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`json-punct`,children:r?`[`:`{`}),e,(0,K.jsx)(`span`,{className:`json-punct`,children:r?`]`:`}`})]})}let o=`jt`+ Ae++,s=`${a} ${r?`item`:`key`}${a===1?``:`s`}`,c=n!==void 0&&je.has(n),l=i.map(([e,n])=>(0,K.jsxs)(`div`,{className:`jt-line`,children:[!r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`jk`,children:[`"`,String(e),`"`]}),(0,K.jsx)(`span`,{className:`json-punct`,children:`: `})]}),$(n,t+1,String(e))]},String(e)));return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`jt-toggle${c?``:` jt-open`}`,onClick:e=>Me(e,o),style:{cursor:`pointer`},children:c?`▶`:`▼`}),(0,K.jsx)(`span`,{className:`json-punct`,children:r?`[`:`{`}),(0,K.jsxs)(`span`,{className:`jt-summary${c?` jt-show`:``}`,id:`${o}s`,children:[`… `,s]}),(0,K.jsx)(`div`,{className:`jt-children${c?``:` jt-open`}`,id:o,children:l}),(0,K.jsx)(`div`,{className:`jt-close${c?` jt-hidden`:``}`,id:`${o}c`,children:(0,K.jsx)(`span`,{className:`json-punct`,children:r?`]`:`}`})})]})}function Me(e,t){e.stopPropagation();let n=document.getElementById(t),r=document.getElementById(t+`s`),i=document.getElementById(t+`c`),a=e.currentTarget;n&&(n.classList.contains(`jt-open`)?(n.classList.remove(`jt-open`),a.classList.remove(`jt-open`),a.textContent=`▶`,r?.classList.add(`jt-show`),i?.classList.add(`jt-hidden`)):(n.classList.add(`jt-open`),a.classList.add(`jt-open`),a.textContent=`▼`,r?.classList.remove(`jt-show`),i?.classList.remove(`jt-hidden`)))}function Ne(e){let t=e.request.body,n=[];if(typeof t.system==`string`&&t.system.trim())n.push(t.system);else if(Array.isArray(t.system)){let e=t.system.map(e=>typeof e==`string`?e:e?.type===`text`&&e.text||``).filter(Boolean).join(`
|
|
16
16
|
|
|
17
17
|
`);e.trim()&&n.push(e)}let r=e.request.body.messages||[];for(let e of r)if(e.role===`system`||e.role===`developer`){let t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>e.text||``).filter(Boolean).join(`
|
|
18
18
|
|
package/dist/web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>LLM Proxy Trace</title>
|
|
7
7
|
|
|
8
8
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'><circle cx='12' cy='12' r='10'/><path d='M12 6v6l4 2'/></svg>" />
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-DqhCy40Z.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/markdown-DsSlw-Z4.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-BnH7jZBV.js">
|