修复:会话消息的工具调用里展开后无法显示新文件的内容

This commit is contained in:
xintaofei
2026-03-29 11:34:32 +08:00
parent 6df6fc1ac0
commit d653a20779
2 changed files with 85 additions and 39 deletions

View File

@@ -203,6 +203,17 @@ function inferFromInput(
const hasPath = hasAnyKey(parsed, ["file_path", "notebook_path", "path"])
if (hasPath) {
// Check write-specific input keys first — they take priority over
// kind/title because ACP ToolKind::Edit ("edit") is a category that
// covers both Edit and Write tools. Without this, a Write tool call
// (with {content, file_path}) would be classified as "edit" due to
// its kind, then rendered with EditToolInput which expects
// old_string/new_string and produces blank output for new files.
if (
hasAnyKey(parsed, ["content", "new_source", "cell_type", "edit_mode"])
) {
return "write"
}
if (
normalizedKind === "read" ||
normalizedKind === "edit" ||
@@ -219,11 +230,6 @@ function inferFromInput(
) {
return normalizedTitle
}
if (
hasAnyKey(parsed, ["content", "new_source", "cell_type", "edit_mode"])
) {
return "write"
}
return "read"
}