This commit is contained in:
team3
2026-06-12 17:18:42 +02:00
parent cfc666055c
commit 78d5833fe4
38 changed files with 1854 additions and 740 deletions

View File

@@ -59,6 +59,47 @@ export async function deleteBausteine(topic) {
await fetch(`${BASE}/bausteine?topic=${encodeURIComponent(topic)}`, { method: 'DELETE' })
}
// --- Baustein-Lernen: Vertiefung, Chat, Prüfung ---
export async function fetchBausteinLernstand(topic) {
const res = await fetch(`${BASE}/bausteine/lernstand?topic=${encodeURIComponent(topic)}`)
return jsonOrThrow(res)
}
export async function fetchVertiefung(topic, baustein) {
const res = await fetch(
`${BASE}/bausteine/vertiefung?topic=${encodeURIComponent(topic)}&baustein=${encodeURIComponent(baustein)}`
)
return jsonOrThrow(res)
}
export async function createVertiefung({ topic, baustein, section, provider }) {
const res = await fetch(`${BASE}/bausteine/vertiefung`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ topic, baustein, section, provider }),
})
return jsonOrThrow(res)
}
export async function chatBaustein({ topic, baustein, section, messages, provider }) {
const res = await fetch(`${BASE}/bausteine/chat`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ topic, baustein, section, messages, provider }),
})
return jsonOrThrow(res)
}
export async function pruefeBaustein({ topic, baustein, section, messages, provider }) {
const res = await fetch(`${BASE}/bausteine/pruefung`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ topic, baustein, section, messages, provider }),
})
return jsonOrThrow(res)
}
export async function fetchTopicFortschritt(topic) {
const res = await fetch(`${BASE}/topics/fortschritt?topic=${encodeURIComponent(topic)}`)
return res.json()
@@ -114,20 +155,6 @@ export async function deleteTopic(name) {
await fetch(`${BASE}/topics?topic=${encodeURIComponent(name)}`, { method: 'DELETE' })
}
export async function fetchProgress(id) {
const res = await fetch(`${BASE}/guides/${id}/progress`)
return res.json()
}
export async function setProgress(id, chapter, done) {
const res = await fetch(`${BASE}/guides/${id}/progress`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ chapter, done }),
})
return res.json()
}
export async function chatGuide(id, { section, outline, messages, provider = 'claude' }) {
const res = await fetch(`${BASE}/guides/${id}/chat`, {
method: 'POST',