refac
This commit is contained in:
@@ -1052,8 +1052,7 @@ async def terminal_event_handler(
|
|||||||
"""Emit terminal:* events for Open Terminal tools.
|
"""Emit terminal:* events for Open Terminal tools.
|
||||||
|
|
||||||
- display_file → emits 'terminal:display_file' to open the file preview.
|
- display_file → emits 'terminal:display_file' to open the file preview.
|
||||||
- write_file / replace_file_content → emits 'terminal:write_file' or
|
- write_file → emits 'terminal:write_file' to silently refresh the file browser.
|
||||||
'terminal:replace_file_content' to silently refresh the file browser.
|
|
||||||
"""
|
"""
|
||||||
if not event_emitter:
|
if not event_emitter:
|
||||||
return
|
return
|
||||||
@@ -1079,7 +1078,7 @@ async def terminal_event_handler(
|
|||||||
"data": {"path": path},
|
"data": {"path": path},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
elif tool_function_name in ("write_file", "replace_file_content"):
|
elif tool_function_name == "write_file":
|
||||||
await event_emitter(
|
await event_emitter(
|
||||||
{
|
{
|
||||||
"type": f"terminal:{tool_function_name}",
|
"type": f"terminal:{tool_function_name}",
|
||||||
|
|||||||
@@ -451,7 +451,7 @@
|
|||||||
if (!data?.path) return;
|
if (!data?.path) return;
|
||||||
if (type === 'terminal:display_file') {
|
if (type === 'terminal:display_file') {
|
||||||
displayFileHandler(data.path, { showControls, showFileNavPath });
|
displayFileHandler(data.path, { showControls, showFileNavPath });
|
||||||
} else if (type === 'terminal:write_file' || type === 'terminal:replace_file_content') {
|
} else if (type === 'terminal:write_file') {
|
||||||
showFileNavDir.set(data.path);
|
showFileNavDir.set(data.path);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -338,7 +338,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['write_file', 'replace_file_content'].includes(data?.name) && data?.params?.path) {
|
if (['write_file'].includes(data?.name) && data?.params?.path) {
|
||||||
showFileNavDir.set(res?.path ?? data.params.path);
|
showFileNavDir.set(res?.path ?? data.params.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user