This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-24 18:10:08 -04:00
1 parent cf4ac9c8db
commit 6cb2449ab7
2 files changed
+10 -2

No files matched your search

+5 -1
View File
@@ -960,6 +960,7 @@ def add_terminal_display_file_inline_param(spec: dict) -> dict:
spec['description'] = ( spec['description'] = (
f"{spec.get('description', '')} " f"{spec.get('description', '')} "
"Set inline=true when the file should be shown inline in the chat message instead of opening the file viewer. " "Set inline=true when the file should be shown inline in the chat message instead of opening the file viewer. "
"Set page for PDF, DOCX, and PPTX files when you want the preview to open at a specific 1-based page or slide. "
"After display_file succeeds, do not display the same file again or emit Markdown for it." "After display_file succeeds, do not display the same file again or emit Markdown for it."
).strip() ).strip()
parameters = spec.setdefault('parameters', {'type': 'object', 'properties': {}, 'required': []}) parameters = spec.setdefault('parameters', {'type': 'object', 'properties': {}, 'required': []})
@@ -1442,12 +1443,15 @@ async def get_terminal_tools(
async def make_tool_function(fn_name, srv_data, hdrs, cks): async def make_tool_function(fn_name, srv_data, hdrs, cks):
async def tool_function(**kwargs): async def tool_function(**kwargs):
params = dict(kwargs)
if fn_name == 'display_file':
params.pop('page', None)
return await execute_tool_server( return await execute_tool_server(
url=srv_data['url'], url=srv_data['url'],
headers=hdrs, headers=hdrs,
cookies=cks, cookies=cks,
name=fn_name, name=fn_name,
params=kwargs, params=params,
server_data=srv_data, server_data=srv_data,
) )
+5 -1
View File
@@ -495,6 +495,10 @@
$settings?.terminalFileDisplay === 'inline' && $settings?.terminalFileDisplay === 'inline' &&
isDirectTerminalServer(data.server?.url); isDirectTerminalServer(data.server?.url);
const params = defaultInline ? { ...data.params, inline: true } : data?.params; const params = defaultInline ? { ...data.params, inline: true } : data?.params;
const serverParams = data?.name === 'display_file' && params ? { ...params } : params;
if (serverParams && data?.name === 'display_file') {
delete serverParams.page;
}
console.log('executeTool', data, toolServer); console.log('executeTool', data, toolServer);
@@ -503,7 +507,7 @@
token, token,
toolServer.url, toolServer.url,
data?.name, data?.name,
params, serverParams,
toolServerData, toolServerData,
chatId chatId
); );