diff --git a/ui/desktop/src/components/ToolCallConfirmation.tsx b/ui/desktop/src/components/ToolCallConfirmation.tsx index 487902ccf0..a91f75955b 100644 --- a/ui/desktop/src/components/ToolCallConfirmation.tsx +++ b/ui/desktop/src/components/ToolCallConfirmation.tsx @@ -1,18 +1,25 @@ import { ActionRequired } from '../api'; import { defineMessages, useIntl } from '../i18n'; +import { snakeToTitleCase } from '../utils'; import ToolApprovalButtons from './ToolApprovalButtons'; const i18n = defineMessages({ - allowToolCall: { - id: 'toolConfirmation.allowToolCall', - defaultMessage: 'Do you allow this tool call?', + allowToolCallWithName: { + id: 'toolConfirmation.allowToolCallWithName', + defaultMessage: 'Allow {toolName}?', }, - gooseWouldLikeToCall: { - id: 'toolConfirmation.gooseWouldLikeToCall', - defaultMessage: 'Goose would like to call the above tool. Allow?', + gooseWouldLikeToCallWithName: { + id: 'toolConfirmation.gooseWouldLikeToCallWithName', + defaultMessage: 'Goose would like to call {toolName}. Allow?', }, }); +function formatToolName(fullName: string): string { + const delimiterIndex = fullName.lastIndexOf('__'); + const shortName = delimiterIndex === -1 ? fullName : fullName.substring(delimiterIndex + 2); + return snakeToTitleCase(shortName); +} + type ToolConfirmationData = Extract; interface ToolConfirmationProps { @@ -29,13 +36,14 @@ export default function ToolConfirmation({ const intl = useIntl(); const data = actionRequiredContent.data as ToolConfirmationData; const { id, toolName, prompt } = data; + const displayName = formatToolName(toolName); return (
{prompt - ? intl.formatMessage(i18n.allowToolCall) - : intl.formatMessage(i18n.gooseWouldLikeToCall)} + ? intl.formatMessage(i18n.allowToolCallWithName, { toolName: displayName }) + : intl.formatMessage(i18n.gooseWouldLikeToCallWithName, { toolName: displayName })}