fix(approval): 完整展示写入内容并隐藏内部滚动条

This commit is contained in:
JOJO 2026-04-11 18:59:40 +08:00
parent c6c90da64a
commit 6a21a642d0
3 changed files with 10 additions and 11 deletions

View File

@ -114,7 +114,7 @@ def _build_tool_approval_preview(web_terminal, function_name: str, arguments: Di
content = str(args.get("content") or "")
preview["file_path"] = args.get("file_path")
preview["append"] = bool(args.get("append", False))
preview["content_preview"] = content[:4000]
preview["content_preview"] = content
preview["content_length"] = len(content)
preview["summary"] = f"write_file: {args.get('file_path') or ''} ({'append' if preview['append'] else 'overwrite'})"
return preview

View File

@ -19,7 +19,7 @@
<div v-if="isEditPreview(item)" class="approval-edit-preview">
<div class="approval-path">{{ item.preview?.file_path || item.preview?.resolved_path }}</div>
<div class="tool-result-diff scrollable approval-diff">
<div class="tool-result-diff approval-diff">
<div
class="diff-line diff-remove"
v-for="(line, idx) in getEditOldLines(item)"
@ -39,7 +39,7 @@
<div v-else-if="isWritePreview(item)" class="approval-edit-preview">
<div class="approval-path">{{ item.preview?.file_path }}</div>
<div class="tool-result-diff scrollable approval-diff">
<div class="tool-result-diff approval-diff">
<div
class="diff-line diff-add"
v-for="(line, idx) in getWriteLines(item)"
@ -47,9 +47,6 @@
>
+ {{ line }}
</div>
<div class="approval-note" v-if="isWriteTruncated(item)">
内容过长已截断展示
</div>
</div>
</div>
@ -172,9 +169,4 @@ const getEditNewLines = (item: any): string[] => {
return rows.map((row: any) => String(row?.content ?? ''));
};
const isWriteTruncated = (item: any): boolean => {
const text = String(item?.preview?.content_preview || '');
const length = Number(item?.preview?.content_length || 0);
return length > text.length;
};
</script>

View File

@ -190,6 +190,13 @@
border-radius: 6px;
padding: 8px;
background: rgba(0, 0, 0, 0.01);
scrollbar-width: none;
-ms-overflow-style: none;
}
.approval-diff::-webkit-scrollbar {
width: 0;
height: 0;
}
.approval-kv {