diff --git a/frontend/src/create/settings/Settings.svelte b/frontend/src/create/settings/Settings.svelte index 4b4de05..9817bb8 100644 --- a/frontend/src/create/settings/Settings.svelte +++ b/frontend/src/create/settings/Settings.svelte @@ -98,15 +98,29 @@ saving = false; } - let testResult: { ok: boolean; detail: string } | null = null; + interface TestResult { ok: boolean; detail: string; busy?: boolean } + let wooTest: TestResult | null = null; + let inferenceTest: TestResult | null = null; async function testWoo() { - testResult = null; + wooTest = { ok: false, detail: 'Working…', busy: true }; try { const res = await fetch('/api/v1/settings/test-woo', { method: 'POST' }); - testResult = await res.json(); + const body = await res.json(); + wooTest = { ok: !!body.ok, detail: body.detail || (body.ok ? 'Connected & synced' : 'failed') }; } catch { - testResult = { ok: false, detail: 'network error' }; + wooTest = { ok: false, detail: 'network error' }; + } + } + + async function testInference() { + inferenceTest = { ok: false, detail: 'Working…', busy: true }; + try { + const res = await fetch('/api/v1/admin/test-inference', { method: 'POST' }); + const body = await res.json(); + inferenceTest = { ok: !!body.ok, detail: body.detail || (body.ok ? 'reachable' : 'failed') }; + } catch { + inferenceTest = { ok: false, detail: 'network error' }; } } @@ -177,13 +191,23 @@ - - {#if testResult} -
- {testResult.ok ? 'Connected & synced' : testResult.detail} -
- {/if} {#if message}{message}
{/if} + +{wooTest.detail}
+ {/if} +{inferenceTest.detail}
+ {/if} +