mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 06:16:42 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
9d9ca17ee7
commit
922a652c7e
1 changed files with 17 additions and 19 deletions
|
|
@ -78,9 +78,17 @@ export function SkillTestPanel({
|
||||||
mutationFn: async (): Promise<TestResult> => {
|
mutationFn: async (): Promise<TestResult> => {
|
||||||
if (stateless) {
|
if (stateless) {
|
||||||
// Modo preview sem persistência: chama AI direto via edge function
|
// Modo preview sem persistência: chama AI direto via edge function
|
||||||
|
const runTest = useMutation({
|
||||||
|
mutationFn: async (): Promise<TestResult> => {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
|
const requestBody: Record<string, unknown> = { test_input: input };
|
||||||
|
if (stateless) {
|
||||||
|
requestBody.markdown_content = stateless.markdown_content;
|
||||||
|
} else {
|
||||||
|
requestBody.skill_version_id = skillVersionId;
|
||||||
|
}
|
||||||
const { data, error } = await supabase.functions.invoke("test-skill-dry-run", {
|
const { data, error } = await supabase.functions.invoke("test-skill-dry-run", {
|
||||||
body: { skill_version_id: skillVersionId, test_input: input },
|
body: requestBody,
|
||||||
});
|
});
|
||||||
if (error) {
|
if (error) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -90,18 +98,8 @@ export function SkillTestPanel({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return data as TestResult;
|
return data as TestResult;
|
||||||
}
|
|
||||||
const { data, error } = await supabase.functions.invoke("test-skill-dry-run", {
|
|
||||||
body: { skill_version_id: skillVersionId, test_input: input },
|
|
||||||
});
|
|
||||||
if (error) throw new Error(error.message);
|
|
||||||
return data as TestResult;
|
|
||||||
},
|
},
|
||||||
onSuccess: (r) => {
|
|
||||||
setResult(r);
|
|
||||||
qc.invalidateQueries({ queryKey: ["skill-test-runs", skillVersionId] });
|
|
||||||
},
|
|
||||||
onError: (e: unknown) => {
|
|
||||||
setResult({
|
setResult({
|
||||||
status: "error",
|
status: "error",
|
||||||
duration_ms: 0,
|
duration_ms: 0,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue