mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
Add concurrent agent
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
import { Clock, Trash2, X } from 'lucide-react'
|
||||
import { Clock, GitBranch, Trash2, X } from 'lucide-react'
|
||||
import {
|
||||
useSchedules,
|
||||
useCreateSchedule,
|
||||
@@ -47,6 +47,7 @@ export function ScheduleModal({ projectName, isOpen, onClose }: ScheduleModalPro
|
||||
enabled: true,
|
||||
yolo_mode: false,
|
||||
model: null,
|
||||
max_concurrency: 3,
|
||||
})
|
||||
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
@@ -124,6 +125,7 @@ export function ScheduleModal({ projectName, isOpen, onClose }: ScheduleModalPro
|
||||
enabled: true,
|
||||
yolo_mode: false,
|
||||
model: null,
|
||||
max_concurrency: 3,
|
||||
})
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create schedule')
|
||||
@@ -242,6 +244,10 @@ export function ScheduleModal({ projectName, isOpen, onClose }: ScheduleModalPro
|
||||
{schedule.yolo_mode && (
|
||||
<span className="font-bold text-yellow-600">⚡ YOLO mode</span>
|
||||
)}
|
||||
<span className="flex items-center gap-1">
|
||||
<GitBranch size={12} />
|
||||
{schedule.max_concurrency}x
|
||||
</span>
|
||||
{schedule.model && <span>Model: {schedule.model}</span>}
|
||||
{schedule.crash_count > 0 && (
|
||||
<span className="text-red-600">Crashes: {schedule.crash_count}</span>
|
||||
@@ -369,6 +375,37 @@ export function ScheduleModal({ projectName, isOpen, onClose }: ScheduleModalPro
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{/* Concurrency slider */}
|
||||
<div className="mb-4">
|
||||
<label className="block text-sm font-bold text-gray-700 dark:text-gray-200 mb-2">
|
||||
Concurrent Agents (1-5)
|
||||
</label>
|
||||
<div className="flex items-center gap-3">
|
||||
<GitBranch
|
||||
size={16}
|
||||
className={newSchedule.max_concurrency > 1 ? 'text-[var(--color-neo-primary)]' : 'text-gray-400'}
|
||||
/>
|
||||
<input
|
||||
type="range"
|
||||
min={1}
|
||||
max={5}
|
||||
value={newSchedule.max_concurrency}
|
||||
onChange={(e) =>
|
||||
setNewSchedule((prev) => ({ ...prev, max_concurrency: Number(e.target.value) }))
|
||||
}
|
||||
className="flex-1 h-2 accent-[var(--color-neo-primary)] cursor-pointer"
|
||||
title={`${newSchedule.max_concurrency} concurrent agent${newSchedule.max_concurrency > 1 ? 's' : ''}`}
|
||||
aria-label="Set number of concurrent agents"
|
||||
/>
|
||||
<span className="text-sm font-bold min-w-[2rem] text-center text-gray-900 dark:text-white">
|
||||
{newSchedule.max_concurrency}x
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-xs text-gray-600 dark:text-gray-400 mt-1">
|
||||
Run {newSchedule.max_concurrency} agent{newSchedule.max_concurrency > 1 ? 's' : ''} in parallel for faster feature completion
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Model selection (optional) */}
|
||||
<div className="mb-6">
|
||||
<label className="block text-sm font-bold text-gray-700 dark:text-gray-200 mb-2">
|
||||
|
||||
@@ -503,6 +503,7 @@ export interface Schedule {
|
||||
enabled: boolean
|
||||
yolo_mode: boolean
|
||||
model: string | null
|
||||
max_concurrency: number // 1-5 concurrent agents
|
||||
crash_count: number
|
||||
created_at: string
|
||||
}
|
||||
@@ -514,6 +515,7 @@ export interface ScheduleCreate {
|
||||
enabled: boolean
|
||||
yolo_mode: boolean
|
||||
model: string | null
|
||||
max_concurrency: number // 1-5 concurrent agents
|
||||
}
|
||||
|
||||
export interface ScheduleUpdate {
|
||||
@@ -523,6 +525,7 @@ export interface ScheduleUpdate {
|
||||
enabled?: boolean
|
||||
yolo_mode?: boolean
|
||||
model?: string | null
|
||||
max_concurrency?: number
|
||||
}
|
||||
|
||||
export interface ScheduleListResponse {
|
||||
|
||||
Reference in New Issue
Block a user