feat(frontend): streamline task creation and preview workflows
- remove prompt and preview generation from task creation - create tasks as inactive and route directly to edit page - add generated message history UX to edit task - update entity/task views and related test coverage
This commit is contained in:
@@ -8,25 +8,29 @@ import {
|
||||
VirtualEntityCreateDto,
|
||||
} from '../api/entitiesApi'
|
||||
|
||||
const DEFAULT_CONTEXT_WINDOW_DAYS = 3
|
||||
|
||||
const initialFormState: VirtualEntityCreateDto = {
|
||||
name: '',
|
||||
email: '',
|
||||
jobTitle: '',
|
||||
personality: '',
|
||||
contextWindowDays: DEFAULT_CONTEXT_WINDOW_DAYS,
|
||||
}
|
||||
|
||||
export default function EntitiesPage() {
|
||||
const navigate = useNavigate()
|
||||
const queryClient = useQueryClient()
|
||||
const { data: entities = [] } = useQuery({ queryKey: ['entities'], queryFn: getEntities })
|
||||
const [dialogOpen, setDialogOpen] = useState(false)
|
||||
const [form, setForm] = useState<VirtualEntityCreateDto>({
|
||||
name: '',
|
||||
email: '',
|
||||
jobTitle: '',
|
||||
personality: '',
|
||||
contextWindowDays: 3,
|
||||
})
|
||||
const [form, setForm] = useState<VirtualEntityCreateDto>(initialFormState)
|
||||
|
||||
const createMutation = useMutation({
|
||||
mutationFn: createEntity,
|
||||
onSuccess: (createdEntity) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['entities'] })
|
||||
setDialogOpen(false)
|
||||
setForm({ name: '', email: '', jobTitle: '', personality: '', contextWindowDays: 3 })
|
||||
setForm(initialFormState)
|
||||
navigate(`/entities/${createdEntity.id}`)
|
||||
},
|
||||
})
|
||||
@@ -140,20 +144,6 @@ export default function EntitiesPage() {
|
||||
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="entity-context-window" className="mb-1 block text-sm font-medium text-slate-200">
|
||||
Default Email Context Window (days)
|
||||
</label>
|
||||
<input
|
||||
id="entity-context-window"
|
||||
type="number"
|
||||
value={form.contextWindowDays}
|
||||
onChange={(e) => setForm({ ...form, contextWindowDays: Number(e.target.value) })}
|
||||
className="block w-full rounded border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100"
|
||||
min={1}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 pt-2">
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user