@@ -227,9 +227,10 @@ function contentCharLen(content?: DisplayContent): number {
227227 <span class =" tool-call-name" >{{ tc.name }}</span >
228228 <span class =" tool-call-summary" >
229229 <span v-if =" inlineArgs(tc)" class =" tool-call-inline-args" :title =" inlineArgs(tc)" >{{ inlineArgs(tc) }}</span >
230- <!-- 子任务进行中:不必先展开 tool_call,直接从这里进思考过程 -->
230+ <!-- 子任务进行中且未展开:不必先展开 tool_call,直接从这里进思考过程。
231+ 展开后详情区已有同样的入口,这里就不再重复 -->
231232 <span
232- v-if =" isToolRunning(tc.id) && findToolResult(tc.id)?.thinkId && thinksUrlPrefix"
233+ v-if =" isToolRunning(tc.id) && !isToolCallExpanded(tc.id) && findToolResult(tc.id)?.thinkId && thinksUrlPrefix"
233234 class =" think-toggle think-toggle-running"
234235 @click.stop =" openThink(findToolResult(tc.id)!.thinkId!, findToolResult(tc.id)!.taskId, { live: true })"
235236 >
@@ -238,25 +239,30 @@ function contentCharLen(content?: DisplayContent): number {
238239 <span v-else-if =" toolResultPreviewMap.get(tc.id)" class =" tool-call-result-preview" :title =" toolResultPreviewMap.get(tc.id)" >↳ {{ toolResultPreviewMap.get(tc.id) }}</span >
239240 </span >
240241 </button >
242+ <!-- inner 包一层:grid-template-rows: 0fr 的折叠动画只能约束单个子元素 -->
241243 <div class =" tool-call-detail" :class =" { show: isToolCallExpanded(tc.id) }" >
242- <div class =" tool-call-args" >{{ JSON.stringify(tc.args, null, 2) }}</div >
243- <template v-if =" findToolResult (tc .id )" >
244- <div class =" tool-call-result" >
245- <div class =" tool-call-result-top" >
246- <div class =" tool-call-result-label" >{{ isToolRunning(tc.id) ? L.thinking : L.toolResult }}</div >
247- <span v-if =" !isToolRunning(tc.id)" class =" msg-char-len" :title =" `${contentCharLen(findToolResult(tc.id)!.message.content)} chars`" >{{ contentCharLen(findToolResult(tc.id)!.message.content) }} chars</span >
248- <div v-if =" findToolResult(tc.id)?.thinkId && thinksUrlPrefix"
249- class =" think-toggle" :class =" { 'think-toggle-running': isToolRunning(tc.id) }"
250- @click =" openThink(findToolResult(tc.id)!.thinkId!, findToolResult(tc.id)!.taskId, { live: isToolRunning(tc.id) })" >
251- <span v-if =" isToolRunning(tc.id)" class =" think-live-dot" /><span v-else >▸</span ><span >{{ L.think }}</span >
244+ <div class =" tool-call-detail-inner" >
245+ <div class =" tool-call-args" >{{ JSON.stringify(tc.args, null, 2) }}</div >
246+ <template v-if =" findToolResult (tc .id )" >
247+ <!-- 进行中时没有结果体,只剩一个入口按钮:去掉水平内边距,让它与上方 args 块左对齐 -->
248+ <div class =" tool-call-result" :class =" { 'is-running': isToolRunning(tc.id) }" >
249+ <div class =" tool-call-result-top" >
250+ <!-- 进行中时不显示标题:按钮本身就写着"思考中" -->
251+ <div v-if =" !isToolRunning(tc.id)" class =" tool-call-result-label" >{{ L.toolResult }}</div >
252+ <span v-if =" !isToolRunning(tc.id)" class =" msg-char-len" :title =" `${contentCharLen(findToolResult(tc.id)!.message.content)} chars`" >{{ contentCharLen(findToolResult(tc.id)!.message.content) }} chars</span >
253+ <div v-if =" findToolResult(tc.id)?.thinkId && thinksUrlPrefix"
254+ class =" think-toggle" :class =" { 'think-toggle-running': isToolRunning(tc.id) }"
255+ @click =" openThink(findToolResult(tc.id)!.thinkId!, findToolResult(tc.id)!.taskId, { live: isToolRunning(tc.id) })" >
256+ <span v-if =" isToolRunning(tc.id)" class =" think-live-dot" /><span v-else >▸</span ><span >{{ isToolRunning(tc.id) ? L.thinking : L.think }}</span >
257+ </div >
252258 </div >
259+ <!-- 进行中的占位没有 content,不渲染结果体 -->
260+ <ContentParts v-if =" ! isToolRunning (tc .id )" :content =" findToolResult (tc .id )! .message .content "
261+ text-class="md-content tool-result-content"
262+ @open-image =" openLightbox " />
253263 </div >
254- <!-- 进行中的占位没有 content,不渲染结果体 -->
255- <ContentParts v-if =" ! isToolRunning (tc .id )" :content =" findToolResult (tc .id )! .message .content "
256- text-class="md-content tool-result-content"
257- @open-image =" openLightbox " />
258- </div >
259- </template >
264+ </template >
265+ </div >
260266 </div >
261267 </div >
262268 </div >
@@ -459,14 +465,18 @@ function contentCharLen(content?: DisplayContent): number {
459465:deep(.inline-audio audio ) { max-width : 100% ; border-radius : 6px ; }
460466
461467/* Tool calls */
468+ /* 宽度由布局给定,不由内容决定:否则折叠态是 "grep" 的窄宽度,
469+ 展开态是 args JSON 最长行的宽度,切换时整块会横向跳变。 */
462470.msg-tool-calls {
463471 background : var (--chatui-bg-ai );
464472 border : 1px solid var (--chatui-border );
465473 border-radius : 8px ;
466474 padding : 10px 12px ;
467475 margin-top : 6px ;
468476 font-size : 12px ;
477+ width : 100% ;
469478 max-width : 90% ;
479+ box-sizing : border-box ;
470480}
471481.msg-role.has-think {
472482 display : flex ;
@@ -478,6 +488,8 @@ function contentCharLen(content?: DisplayContent): number {
478488 border-radius : 6px ;
479489 margin-top : 6px ;
480490 overflow : hidden ;
491+ /* min-width 默认是 max-content,不归零会让长内容顶穿上面的宽度约束 */
492+ min-width : 0 ;
481493}
482494.tool-call-header {
483495 width : 100% ;
@@ -521,6 +533,9 @@ function contentCharLen(content?: DisplayContent): number {
521533 overflow : hidden ;
522534 padding-top : 2px ;
523535}
536+ /* 按钮按内容宽度收缩。注意不能改父级的 align-items:摘要行要靠 stretch 拿到
537+ 确定宽度,text-overflow: ellipsis 才生效。 */
538+ .tool-call-summary > .think-toggle { align-self : flex-start ; }
524539.tool-call-inline-args {
525540 font-family : monospace ;
526541 font-size : 11px ;
@@ -540,13 +555,29 @@ function contentCharLen(content?: DisplayContent): number {
540555 opacity : 0.85 ;
541556}
542557.tool-call-header.expanded .tool-call-result-preview { display : none ; }
543- .tool-call-detail { display : none ; }
544- .tool-call-detail.show { display : block ; }
558+ /* 展开只改变高度,从不改变宽度 */
559+ .tool-call-detail {
560+ display : grid ;
561+ grid-template-rows : 0fr ;
562+ transition : grid-template-rows 0.18s ease ;
563+ min-width : 0 ;
564+ }
565+ .tool-call-detail.show { grid-template-rows : 1fr ; }
566+ .tool-call-detail-inner {
567+ min-height : 0 ;
568+ min-width : 0 ;
569+ overflow : hidden ;
570+ }
571+ @media (prefers-reduced-motion: reduce) {
572+ .tool-call-detail { transition : none ; }
573+ }
545574.tool-call-args {
546575 font-family : monospace ;
547576 font-size : 11px ;
548577 white-space : pre-wrap ;
549- word-break : break-all ;
578+ /* anywhere 而非 break-all:优先在正常断点折行,只在长 token 无处可断时才切开 */
579+ overflow-wrap : anywhere;
580+ min-width : 0 ;
550581 color : var (--chatui-fg-primary );
551582 background : var (--chatui-bg-code );
552583 padding : 6px 8px ;
@@ -558,6 +589,8 @@ function contentCharLen(content?: DisplayContent): number {
558589 padding : 8px ;
559590 border-top : 1px solid var (--chatui-border );
560591}
592+ /* 进行中:只有入口按钮,与上方 args 块共用左基线 */
593+ .tool-call-result.is-running { padding : 8px 0 ; }
561594.tool-call-result-top {
562595 display : flex ;
563596 align-items : center ;
0 commit comments