ChatJio / frontend /src /api /chat.js
sehscape's picture
deploy: initial ChatJio deployment for HuggingFace Spaces
f3269f9
Raw
History Blame Contribute Delete
378 Bytes
const API_BASE = 'http://localhost:8000';
export async function askQuestion(query, confirmed = false) {
const res = await fetch(`${API_BASE}/chat`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query, confirmed }),
});
if (!res.ok) {
throw new Error(`Server error: ${res.status}`);
}
return res.json();
}