added chat streaming

This commit is contained in:
Storme-bit
2026-04-05 23:47:01 -07:00
parent 9af77438b3
commit 4bd84ded04
3 changed files with 95 additions and 3 deletions

View File

@@ -13,6 +13,17 @@ async function complete(prompt, options ={}) {
return res.json();
}
async function completeStream(prompt, options={}) {
const res = await fetch(`${BASE_URL}/complete/stream`, {
method: 'POST',
headers: { 'Content-Type': 'application/json'},
body: JSON.stringify({prompt, ...options}),
})
if (!res.ok) throw new Error(`Inference service error: ${res.status}`);
return res;
}
module.exports = {
complete
complete,
completeStream
}