feat(reader): autonomous Wikipedia import and reading with media, tables and settings
This commit is contained in:
1 parent
52db766b23
commit
dee9b8d10b
9 files changed
+1659
-24
No files matched your search
@@ -230,6 +230,26 @@ export const api = {
|
||||
detail = errData.detail || detail;
|
||||
} catch (_) {}
|
||||
throw new Error(detail);
|
||||
},
|
||||
async fetchWikipedia({ query = '', lang = 'simple', time_budget = '10-15', topic = 'random', force = false } = {}) {
|
||||
const resp = await fetch('/api/books/fetch-wikipedia', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
query: query,
|
||||
lang: lang,
|
||||
time_budget: time_budget,
|
||||
topic: topic,
|
||||
force: force
|
||||
})
|
||||
});
|
||||
if (resp.ok) return await resp.json();
|
||||
let detail = 'Не удалось загрузить статью из Wikipedia';
|
||||
try {
|
||||
const errData = await resp.json();
|
||||
detail = errData.detail || detail;
|
||||
} catch (_) {}
|
||||
throw new Error(detail);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user