refac
This commit is contained in:
1 parent
97c5f52bbc
commit
64e6c9f010
4 files changed
+6
-9
No files matched your search
@@ -258,12 +258,7 @@ def build_terminal_file_tool_result(
|
|||||||
if isinstance(tool_result, (list, tuple)) and tool_result and isinstance(tool_result[0], dict):
|
if isinstance(tool_result, (list, tuple)) and tool_result and isinstance(tool_result[0], dict):
|
||||||
tool_result = tool_result[0]
|
tool_result = tool_result[0]
|
||||||
|
|
||||||
if (
|
if tool_function_name != 'display_file' or not isinstance(tool_result, dict) or tool_result.get('exists') is False:
|
||||||
tool_function_name != 'display_file'
|
|
||||||
or tool_function_params.get('inline') is not True
|
|
||||||
or not isinstance(tool_result, dict)
|
|
||||||
or tool_result.get('exists') is False
|
|
||||||
):
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
tool_id = (tool or {}).get('tool_id', '')
|
tool_id = (tool or {}).get('tool_id', '')
|
||||||
@@ -284,7 +279,7 @@ def build_terminal_file_tool_result(
|
|||||||
**tool_result,
|
**tool_result,
|
||||||
'type': 'file',
|
'type': 'file',
|
||||||
'source': 'open_terminal',
|
'source': 'open_terminal',
|
||||||
'displayed': True,
|
**({'displayed': True} if tool_function_params.get('inline') is True else {}),
|
||||||
'terminal_selector': terminal_selector,
|
'terminal_selector': terminal_selector,
|
||||||
**({'terminal_id': terminal_id} if terminal_id else {}),
|
**({'terminal_id': terminal_id} if terminal_id else {}),
|
||||||
**({'terminal_url': server_url} if server_url and not terminal_id else {}),
|
**({'terminal_url': server_url} if server_url and not terminal_id else {}),
|
||||||
|
|||||||
@@ -1144,6 +1144,7 @@
|
|||||||
const terminalEventHandler = (type: string, data: any) => {
|
const terminalEventHandler = (type: string, data: any) => {
|
||||||
if (type === 'terminal:display_file') {
|
if (type === 'terminal:display_file') {
|
||||||
if (!data?.path) return;
|
if (!data?.path) return;
|
||||||
|
if ($settings?.terminalFileDisplay === 'inline') return;
|
||||||
displayFileHandler(data.path, { showControls, showFileNavPath }, { page: data?.page });
|
displayFileHandler(data.path, { showControls, showFileNavPath }, { page: data?.page });
|
||||||
} else if (type === 'terminal:write_file' || type === 'terminal:replace_file_content') {
|
} else if (type === 'terminal:write_file' || type === 'terminal:replace_file_content') {
|
||||||
if (!data?.path) return;
|
if (!data?.path) return;
|
||||||
|
|||||||
@@ -163,7 +163,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</ConsecutiveDetailsGroup>
|
</ConsecutiveDetailsGroup>
|
||||||
{:else if displayItem.type === 'file'}
|
{:else if displayItem.type === 'file'}
|
||||||
<TerminalOutputFile item={displayItem.item} {chatId} />
|
{#if displayItem.item?.displayed || $settings?.terminalFileDisplay === 'inline'}
|
||||||
|
<TerminalOutputFile item={displayItem.item} {chatId} />
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
{@const detailToken = displayItem.token}
|
{@const detailToken = displayItem.token}
|
||||||
{#if detailToken.attributes?.type === 'tool_calls'}
|
{#if detailToken.attributes?.type === 'tool_calls'}
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ function getInlineFileFromToolOutput(callItem?: OutputItem, resultItem?: OutputI
|
|||||||
typeof result !== 'object' ||
|
typeof result !== 'object' ||
|
||||||
result.type !== 'file' ||
|
result.type !== 'file' ||
|
||||||
result.source !== 'open_terminal' ||
|
result.source !== 'open_terminal' ||
|
||||||
result.displayed !== true ||
|
|
||||||
result.exists === false ||
|
result.exists === false ||
|
||||||
!result.path ||
|
!result.path ||
|
||||||
!result.terminal_selector
|
!result.terminal_selector
|
||||||
|
|||||||
Reference in new issue
Block a user