Merge pull request #1502 from KrishavRajSingh/fix/toolview

show presentaion view if target file is slide file
This commit is contained in:
Marko Kraemer 2025-08-29 22:06:50 -07:00 committed by GitHub
commit e14b392221
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 7 deletions

View File

@ -188,16 +188,14 @@ export function useToolView(toolName: string): ToolViewComponent {
return useMemo(() => toolViewRegistry.get(toolName), [toolName]); return useMemo(() => toolViewRegistry.get(toolName), [toolName]);
} }
interface ToolOutput {
file_path?: string;
}
export function ToolView({ name = 'default', assistantContent, toolContent, ...props }: ToolViewProps) { export function ToolView({ name = 'default', assistantContent, toolContent, ...props }: ToolViewProps) {
const toolToolData = extractToolData(toolContent); const toolToolData = extractToolData(toolContent);
// find the file path from the tool output // find the file path from the tool arguments
const output = toolToolData.toolResult.toolOutput as ToolOutput; const toolArguments = toolToolData.arguments || {};
const filePath = output.file_path; const filePath = toolArguments.file_path || toolArguments.target_file;
// check if the file path is a presentation slide // check if the file path is a presentation slide
const { isValid: isPresentationSlide, presentationName, slideNumber } = parsePresentationSlidePath(filePath); const { isValid: isPresentationSlide, presentationName, slideNumber } = parsePresentationSlidePath(filePath);
@ -210,7 +208,7 @@ export function ToolView({ name = 'default', assistantContent, toolContent, ...p
'delete-slide', 'delete-slide',
'delete-presentation', 'delete-presentation',
'presentation-styles', 'presentation-styles',
'present_presentation', 'present-presentation',
] ]
const isAlreadyPresentationTool = presentationTools.includes(name); const isAlreadyPresentationTool = presentationTools.includes(name);