abbashkyt-creator 7d8ce0e322 V0.1
2026-03-14 04:02:22 +03:00

21 lines
739 B
TypeScript

const BASE = 'http://localhost:8000'
export const testAI = async (title: string, ai_target: string) => {
const res = await fetch(`${BASE}/api/ai/test`, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title, ai_target }),
})
if (!res.ok) throw new Error('AI test failed')
return res.json() as Promise<{ verdict: string; reason: string }>
}
export const fetchAILog = async (limit = 50, since_id = 0) => {
const res = await fetch(`${BASE}/api/ai/debug/log?limit=${limit}&since_id=${since_id}`)
if (!res.ok) throw new Error('Failed to fetch AI log')
return res.json()
}
export const clearAILog = async () => {
await fetch(`${BASE}/api/ai/debug/log`, { method: 'DELETE' })
}