diff --git a/src/components/mika/skills/SkillCard.tsx b/src/components/mika/skills/SkillCard.tsx index 687071f..ad44797 100644 --- a/src/components/mika/skills/SkillCard.tsx +++ b/src/components/mika/skills/SkillCard.tsx @@ -191,11 +191,19 @@ export function SkillCard({ skill }: { skill: Skill }) {
- +
+ + {(skill as Skill & { is_default?: boolean }).is_default && ( + + Padrão + + )} +
{formatDistanceToNow(new Date(skill.updated_at), { addSuffix: true, locale: ptBR })}
+ diff --git a/src/components/mika/skills/SkillTestPanel.tsx b/src/components/mika/skills/SkillTestPanel.tsx index 98d9ddb..a2586f2 100644 --- a/src/components/mika/skills/SkillTestPanel.tsx +++ b/src/components/mika/skills/SkillTestPanel.tsx @@ -76,25 +76,23 @@ export function SkillTestPanel({ const runTest = useMutation({ mutationFn: async (): Promise => { + const start = Date.now(); + const requestBody: Record = { test_input: input }; if (stateless) { - // Modo preview sem persistência: chama AI direto via edge function - const start = Date.now(); - const { data, error } = await supabase.functions.invoke("test-skill-dry-run", { - body: { skill_version_id: skillVersionId, test_input: input }, - }); - if (error) { - return { - status: "error", - duration_ms: Date.now() - start, - error_message: error.message, - }; - } - return data as TestResult; + requestBody.markdown_content = stateless.markdown_content; + } else { + requestBody.skill_version_id = skillVersionId; } const { data, error } = await supabase.functions.invoke("test-skill-dry-run", { - body: { skill_version_id: skillVersionId, test_input: input }, + body: requestBody, }); - if (error) throw new Error(error.message); + if (error) { + return { + status: "error", + duration_ms: Date.now() - start, + error_message: error.message, + }; + } return data as TestResult; }, onSuccess: (r) => { @@ -110,6 +108,7 @@ export function SkillTestPanel({ }, }); + return ( diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 9e43fae..1061afc 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -694,6 +694,7 @@ export type Database = { current_version_id: string | null description: string id: string + is_default: boolean name: string status: string trigger_keywords: string @@ -706,6 +707,7 @@ export type Database = { current_version_id?: string | null description: string id?: string + is_default?: boolean name: string status?: string trigger_keywords: string @@ -718,6 +720,7 @@ export type Database = { current_version_id?: string | null description?: string id?: string + is_default?: boolean name?: string status?: string trigger_keywords?: string diff --git a/src/routes/painel.skills.index.tsx b/src/routes/painel.skills.index.tsx index 5c5f32b..bef09f0 100644 --- a/src/routes/painel.skills.index.tsx +++ b/src/routes/painel.skills.index.tsx @@ -67,10 +67,11 @@ function SkillsPage() {
{limits.data && limits.data.max_skills != null && ( - {limits.data.current_skills_count} de {limits.data.max_skills} skills + {limits.data.current_skills_count} de {limits.data.max_skills} skills personalizadas )} +