mirror of https://github.com/kortix-ai/suna.git
Merge pull request #1502 from KrishavRajSingh/fix/toolview
show presentaion view if target file is slide file
This commit is contained in:
commit
e14b392221
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue