feat: use the same permission flow for enable extensions (#2302)
This commit is contained in:
@@ -12,11 +12,9 @@ import {
|
||||
getToolResponses,
|
||||
getToolConfirmationContent,
|
||||
createToolErrorResponseMessage,
|
||||
getExtensionContent,
|
||||
} from '../types/message';
|
||||
import ToolCallConfirmation from './ToolCallConfirmation';
|
||||
import MessageCopyLink from './MessageCopyLink';
|
||||
import ExtensionConfirmation from './ExtensionConfirmation';
|
||||
|
||||
interface GooseMessageProps {
|
||||
messageHistoryIndex: number;
|
||||
@@ -58,9 +56,6 @@ export default function GooseMessage({
|
||||
const toolConfirmationContent = getToolConfirmationContent(message);
|
||||
const hasToolConfirmation = toolConfirmationContent !== undefined;
|
||||
|
||||
const extensionContent = getExtensionContent(message);
|
||||
const hasExtensionRequest = extensionContent !== undefined;
|
||||
|
||||
// Find tool responses that correspond to the tool requests in this message
|
||||
const toolResponsesMap = useMemo(() => {
|
||||
const responseMap = new Map();
|
||||
@@ -95,23 +90,12 @@ export default function GooseMessage({
|
||||
createToolErrorResponseMessage(toolConfirmationContent.id, 'The tool call is cancelled.')
|
||||
);
|
||||
}
|
||||
if (messageIndex == messageHistoryIndex - 1 && hasExtensionRequest) {
|
||||
appendMessage(
|
||||
createToolErrorResponseMessage(
|
||||
extensionContent.id,
|
||||
'The extension enablement is cancelled.'
|
||||
)
|
||||
);
|
||||
}
|
||||
}, [
|
||||
messageIndex,
|
||||
messageHistoryIndex,
|
||||
hasToolConfirmation,
|
||||
toolConfirmationContent,
|
||||
appendMessage,
|
||||
hasExtensionRequest,
|
||||
// Only include enableExtensionContent if it exists
|
||||
extensionContent?.id,
|
||||
]);
|
||||
|
||||
return (
|
||||
@@ -172,16 +156,6 @@ export default function GooseMessage({
|
||||
toolName={toolConfirmationContent.toolName}
|
||||
/>
|
||||
)}
|
||||
|
||||
{hasExtensionRequest && (
|
||||
<ExtensionConfirmation
|
||||
isCancelledMessage={messageIndex == messageHistoryIndex - 1}
|
||||
isClicked={messageIndex < messageHistoryIndex - 1}
|
||||
extensionConfirmationId={extensionContent.id}
|
||||
extensionName={extensionContent.extensionName}
|
||||
toolName={extensionContent.toolName}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* TODO(alexhancock): Re-enable link previews once styled well again */}
|
||||
|
||||
Reference in New Issue
Block a user