Skip to content

Commit d9bb4cb

Browse files
committed
ai-plugin: Allow multiple tool calls to happen
Signed-off-by: ashu8912 <[email protected]>
1 parent ef4dc01 commit d9bb4cb

File tree

5 files changed

+715
-6
lines changed

5 files changed

+715
-6
lines changed

ai-assistant/src/ContentRenderer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ const TableWrapper: React.FC<{ children: React.ReactNode }> = React.memo(({ chil
100100
// Extract table rows from children
101101
const tableElement = React.Children.only(children) as React.ReactElement;
102102
const tableChildren = tableElement.props.children;
103-
103+
104104
if (!tableChildren) {
105105
// No children found, return table as is
106106
return <Box sx={{ overflowX: 'auto', width: '100%', mb: 2 }}>{children}</Box>;
107107
}
108-
108+
109109
const tbody = React.Children.toArray(tableChildren).find(
110110
(child: any) => child?.type === 'tbody' || child?.props?.component === 'tbody'
111111
);

ai-assistant/src/components/common/InlineToolConfirmation.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ const InlineToolConfirmation: React.FC<InlineToolConfirmationProps> = ({
134134
}
135135
});
136136

137-
onApprove(selectedToolIds);
137+
// Call onApprove and wait for it to complete
138+
await onApprove(selectedToolIds);
138139
} catch (error) {
139140
console.error('Error during tool approval:', error);
141+
} finally {
142+
// Always reset the approving state, whether success or error
140143
setIsApproving(false);
141144
}
142145
};
@@ -147,9 +150,12 @@ const InlineToolConfirmation: React.FC<InlineToolConfirmationProps> = ({
147150
setIsDenying(true);
148151

149152
try {
150-
onDeny();
153+
// Call onDeny and wait for it to complete
154+
await onDeny();
151155
} catch (error) {
152156
console.error('Error during tool denial:', error);
157+
} finally {
158+
// Always reset the denying state
153159
setIsDenying(false);
154160
}
155161
};

ai-assistant/src/components/mcpOutput/MCPOutputDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ const ErrorDisplay: React.FC<{ data: any; onRetry?: () => void; width: string }>
12761276
size="small"
12771277
onClick={onRetry}
12781278
startIcon={<Icon icon="mdi:refresh" />}
1279-
sx={{mr: 0.5}}
1279+
sx={{ mr: 0.5 }}
12801280
>
12811281
Retry Tool
12821282
</Button>

0 commit comments

Comments
 (0)