mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-19 15:14:21 +01:00
fix: continue to use resumed session after confirmation is cancelled (#1548)
This commit is contained in:
@@ -2,9 +2,14 @@ import React, { useState } from 'react';
|
||||
import { ConfirmToolRequest } from '../utils/toolConfirm';
|
||||
import { snakeToTitleCase } from '../utils';
|
||||
|
||||
export default function ToolConfirmation({ toolConfirmationId, toolName }) {
|
||||
const [clicked, setClicked] = useState(false);
|
||||
const [status, setStatus] = useState('');
|
||||
export default function ToolConfirmation({
|
||||
isCancelledMessage,
|
||||
isClicked,
|
||||
toolConfirmationId,
|
||||
toolName,
|
||||
}) {
|
||||
const [clicked, setClicked] = useState(isClicked);
|
||||
const [status, setStatus] = useState('unknown');
|
||||
|
||||
const handleButtonClick = (confirmed) => {
|
||||
setClicked(true);
|
||||
@@ -12,7 +17,11 @@ export default function ToolConfirmation({ toolConfirmationId, toolName }) {
|
||||
ConfirmToolRequest(toolConfirmationId, confirmed);
|
||||
};
|
||||
|
||||
return (
|
||||
return isCancelledMessage ? (
|
||||
<div className="goose-message-content bg-bgSubtle rounded-2xl px-4 py-2 text-textStandard">
|
||||
Tool call confirmation is cancelled.
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="goose-message-content bg-bgSubtle rounded-2xl px-4 py-2 rounded-b-none text-textStandard">
|
||||
Goose would like to call the above tool. Allow?
|
||||
@@ -45,7 +54,9 @@ export default function ToolConfirmation({ toolConfirmationId, toolName }) {
|
||||
</svg>
|
||||
)}
|
||||
<span className="ml-2 text-textStandard">
|
||||
{snakeToTitleCase(toolName.substring(toolName.lastIndexOf('__') + 2))} is {status}
|
||||
{isClicked
|
||||
? 'Tool confirmation is not available'
|
||||
: `${snakeToTitleCase(toolName.substring(toolName.lastIndexOf('__') + 2))} is ${status}`}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user