mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
Merge pull request #231 from stephan271c/add-pause-button
feat: Add a stop button to halt agent execution when processing.
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
|||||||
ImageIcon,
|
ImageIcon,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
FileText,
|
FileText,
|
||||||
|
Square,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useElectronAgent } from '@/hooks/use-electron-agent';
|
import { useElectronAgent } from '@/hooks/use-electron-agent';
|
||||||
@@ -83,6 +84,7 @@ export function AgentView() {
|
|||||||
isConnected,
|
isConnected,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
clearHistory,
|
clearHistory,
|
||||||
|
stopExecution,
|
||||||
error: agentError,
|
error: agentError,
|
||||||
} = useElectronAgent({
|
} = useElectronAgent({
|
||||||
sessionId: currentSessionId || '',
|
sessionId: currentSessionId || '',
|
||||||
@@ -914,21 +916,33 @@ export function AgentView() {
|
|||||||
<Paperclip className="w-4 h-4" />
|
<Paperclip className="w-4 h-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Send Button */}
|
{/* Send / Stop Button */}
|
||||||
<Button
|
{isProcessing ? (
|
||||||
onClick={handleSend}
|
<Button
|
||||||
disabled={
|
onClick={stopExecution}
|
||||||
(!input.trim() &&
|
disabled={!isConnected}
|
||||||
selectedImages.length === 0 &&
|
className="h-11 px-4 rounded-xl"
|
||||||
selectedTextFiles.length === 0) ||
|
variant="destructive"
|
||||||
isProcessing ||
|
data-testid="stop-agent"
|
||||||
!isConnected
|
title="Stop generation"
|
||||||
}
|
>
|
||||||
className="h-11 px-4 rounded-xl"
|
<Square className="w-4 h-4 fill-current" />
|
||||||
data-testid="send-message"
|
</Button>
|
||||||
>
|
) : (
|
||||||
<Send className="w-4 h-4" />
|
<Button
|
||||||
</Button>
|
onClick={handleSend}
|
||||||
|
disabled={
|
||||||
|
(!input.trim() &&
|
||||||
|
selectedImages.length === 0 &&
|
||||||
|
selectedTextFiles.length === 0) ||
|
||||||
|
!isConnected
|
||||||
|
}
|
||||||
|
className="h-11 px-4 rounded-xl"
|
||||||
|
data-testid="send-message"
|
||||||
|
>
|
||||||
|
<Send className="w-4 h-4" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Keyboard hint */}
|
{/* Keyboard hint */}
|
||||||
|
|||||||
Reference in New Issue
Block a user