15 lines
422 B
JavaScript
15 lines
422 B
JavaScript
// ── API Calls ──
|
|
|
|
async function apiChat(model, messages, systemPrompt) {
|
|
return fetch('/api/chat', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ model, messages, systemPrompt })
|
|
});
|
|
}
|
|
|
|
async function apiHistory(sessionId = 'null', limit = 50) {
|
|
const resp = await fetch(`/api/history?sessionId=${sessionId}&limit=${limit}`);
|
|
return resp.json();
|
|
}
|