mirror of
https://github.com/csunny/DB-GPT.git
synced 2026-07-16 17:15:22 +00:00
feat(connector): wire HITL ConfirmDialog into chat composer
- useConfirmPolling activated when a connector is attached and Agent is streaming - Render ConfirmDialog at bottom of Playground; backend pending-confirms now reach the user as a bottom-right modal - 300s backend timeout matches dialog countdown — auto-deny on lapse
This commit is contained in:
@@ -14,6 +14,8 @@ import ManusRightPanel, {
|
||||
} from '@/new-components/chat/content/ManusRightPanel';
|
||||
import { MessagePart, ToolPart, ToolStatus } from '@/new-components/chat/content/OpenCodeSessionTurn';
|
||||
import { ConnectorInstance, AttachedConnector } from '@/new-components/connector/types';
|
||||
import { useConfirmPolling } from '@/new-components/connector/useConfirmPolling';
|
||||
import ConfirmDialog from '@/new-components/connector/ConfirmDialog';
|
||||
import { useConnectors } from '@/hooks/use-connector-api';
|
||||
import axios from '@/utils/ctx-axios';
|
||||
import { sendSpacePostRequest } from '@/utils/request';
|
||||
@@ -582,6 +584,11 @@ const Playground: NextPage = () => {
|
||||
const [connectorSearchQuery, setConnectorSearchQuery] = useState('');
|
||||
const { connectors: connectorsList } = useConnectors();
|
||||
|
||||
const isConfirmPollingActive = loading && selectedConnectors.length > 0;
|
||||
const { pendingConfirmation, approve, deny, dismiss } = useConfirmPolling({
|
||||
isActive: isConfirmPollingActive,
|
||||
});
|
||||
|
||||
const [selectedStepId, setSelectedStepId] = useState<string | null>(null);
|
||||
const [rightPanelCollapsed, setRightPanelCollapsed] = useState(false);
|
||||
const [rightPanelView, setRightPanelView] = useState<PanelView>('execution');
|
||||
@@ -3875,6 +3882,12 @@ const Playground: NextPage = () => {
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
<ConfirmDialog
|
||||
confirmation={pendingConfirmation}
|
||||
onApprove={approve}
|
||||
onDeny={deny}
|
||||
onDismiss={dismiss}
|
||||
/>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user