summary system backend implementation
This commit is contained in:
@@ -150,6 +150,32 @@ async function deleteEpisode(id) {
|
||||
if (!res.ok) throw new Error(`Failed to delete episode: ${res.status}`);
|
||||
}
|
||||
|
||||
async function getSummariesBySession(sessionId) {
|
||||
const res = await fetch(`${BASE_URL}/sessions/${sessionId}/summaries`);
|
||||
if (!res.ok) throw new Error(`Failed to fetch summaries: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function createSummary({ sessionId, projectId, content, tokenCount, episodeRange }) {
|
||||
const res = await fetch(`${BASE_URL}/summaries`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ sessionId, projectId, content, tokenCount, episodeRange }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to create summary: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function updateSummary(id, { content, tokenCount, episodeRange }) {
|
||||
const res = await fetch(`${BASE_URL}/summaries/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ content, tokenCount, episodeRange }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to update summary: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSessionByExternalId,
|
||||
createSession,
|
||||
@@ -168,4 +194,7 @@ module.exports = {
|
||||
getProject,
|
||||
getEpisodes,
|
||||
deleteEpisode,
|
||||
getSummariesBySession,
|
||||
createSummary,
|
||||
updateSummary,
|
||||
}
|
||||
Reference in New Issue
Block a user