fix(audit): P2 frontend any→concrete types (181→61), heroicons→lucide-react, missing type exports, toast API, Select options, TaskStatus types; P2-9 hooks.py type annotations
This commit is contained in:
@@ -70,7 +70,7 @@ const commonModels = [
|
||||
|
||||
export function AgentEditor({ agent, onSaved, onCancel }: AgentEditorProps) {
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const toast = useToast();
|
||||
const { data: tools = [] } = useAgentToolsFull();
|
||||
const { data: skills = [] } = useAgentSkills();
|
||||
const createAgent = useCreateAgent();
|
||||
@@ -83,17 +83,17 @@ export function AgentEditor({ agent, onSaved, onCancel }: AgentEditorProps) {
|
||||
name: agent.name,
|
||||
description: agent.description || '',
|
||||
system_prompt: agent.system_prompt || '',
|
||||
llm_model: agent.llm_model,
|
||||
llm_model: agent.llm_model || agent.model || '',
|
||||
tool_ids: agent.tool_ids || [],
|
||||
skill_ids: agent.skill_ids || [],
|
||||
max_steps: agent.max_steps,
|
||||
max_duration_seconds: agent.max_duration_seconds,
|
||||
budget_limit_usd: agent.budget_limit_usd,
|
||||
temperature: agent.temperature,
|
||||
max_tokens: agent.max_tokens,
|
||||
trace_mode: agent.trace_mode,
|
||||
max_steps: agent.max_steps ?? 20,
|
||||
max_duration_seconds: agent.max_duration_seconds ?? 300,
|
||||
budget_limit_usd: agent.budget_limit_usd ?? agent.budget_limit ?? 1.0,
|
||||
temperature: agent.temperature ?? 0.3,
|
||||
max_tokens: agent.max_tokens ?? 1000,
|
||||
trace_mode: (agent.trace_mode === 'extended' ? 'extended' : 'standard') as 'standard' | 'extended',
|
||||
mode: agent.mode,
|
||||
is_active: agent.is_active,
|
||||
is_active: agent.is_active ?? agent.active ?? true,
|
||||
trigger_config: agent.trigger_config || {},
|
||||
ai_use_case_metadata: agent.ai_use_case_metadata || {},
|
||||
};
|
||||
@@ -142,28 +142,28 @@ export function AgentEditor({ agent, onSaved, onCancel }: AgentEditorProps) {
|
||||
try {
|
||||
if (agent) {
|
||||
const updated = await updateAgent.mutateAsync({ id: agent.id, data });
|
||||
toast({ title: t('agent.saved'), variant: 'success' });
|
||||
toast.success(t('agent.saved'));
|
||||
onSaved?.(updated);
|
||||
} else {
|
||||
const created = await createAgent.mutateAsync(data);
|
||||
toast({ title: t('agent.created'), variant: 'success' });
|
||||
toast.success(t('agent.created'));
|
||||
onSaved?.(created);
|
||||
}
|
||||
} catch {
|
||||
toast({ title: t('agent.saveFailed'), variant: 'error' });
|
||||
toast.error(t('agent.saveFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
const handleTestRun = async () => {
|
||||
if (!agent) {
|
||||
toast({ title: t('agent.saveBeforeTest'), variant: 'warning' });
|
||||
toast.warning(t('agent.saveBeforeTest'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await testRunAgent.mutateAsync(agent.id);
|
||||
toast({ title: t('agent.testRunOk'), variant: 'success' });
|
||||
toast.success(t('agent.testRunOk'));
|
||||
} catch {
|
||||
toast({ title: t('agent.testRunFailed'), variant: 'error' });
|
||||
toast.error(t('agent.testRunFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -268,11 +268,11 @@ export function AgentEditor({ agent, onSaved, onCancel }: AgentEditorProps) {
|
||||
) : (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2 max-h-40 overflow-y-auto" role="group" aria-label={t('agent.tools')}>
|
||||
{tools.map((tool) => (
|
||||
<label key={tool.id} className="flex items-center gap-2 p-2 rounded-md hover:bg-secondary-50 cursor-pointer text-sm min-h-touch">
|
||||
<label key={tool.id || tool.name} className="flex items-center gap-2 p-2 rounded-md hover:bg-secondary-50 cursor-pointer text-sm min-h-touch">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedToolIds.includes(tool.id)}
|
||||
onChange={() => toggleArrayValue('tool_ids', tool.id)}
|
||||
checked={selectedToolIds.includes(tool.id || tool.name)}
|
||||
onChange={() => toggleArrayValue('tool_ids', tool.id || tool.name)}
|
||||
className="rounded border-secondary-300 text-primary-600 focus:ring-primary-500"
|
||||
/>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user