| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| async function bayanAnalyze(text, signal) { |
| const response = await fetch(`${CONFIG.API_BASE}/api/analyze`, { |
| method: 'POST', |
| headers: { 'Content-Type': 'application/json' }, |
| body: JSON.stringify({ text }), |
| signal, |
| }); |
| if (!response.ok) { |
| throw new Error(`Analyze API error: ${response.status}`); |
| } |
| return await response.json(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async function bayanSummarize(text, length = 2, fullText = true) { |
| const response = await fetch(`${CONFIG.API_BASE}/api/summarize`, { |
| method: 'POST', |
| headers: { 'Content-Type': 'application/json' }, |
| body: JSON.stringify({ text, length, full_text: fullText }), |
| }); |
| if (!response.ok) { |
| throw new Error(`Summarize API error: ${response.status}`); |
| } |
| return await response.json(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| async function bayanDialect(text, signal) { |
| const response = await fetch(`${CONFIG.API_BASE}/api/dialect`, { |
| method: 'POST', |
| headers: { 'Content-Type': 'application/json' }, |
| body: JSON.stringify({ text }), |
| signal, |
| }); |
| if (!response.ok) { |
| throw new Error(`Dialect API error: ${response.status}`); |
| } |
| return await response.json(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async function bayanQuran(text, language = 'تدقيق الايات', signal, topN = 1) { |
| const body = { text, language }; |
| if (topN > 1) body.top_n = topN; |
| const response = await fetch(`${CONFIG.API_BASE}/api/quran`, { |
| method: 'POST', |
| headers: { 'Content-Type': 'application/json' }, |
| body: JSON.stringify(body), |
| signal, |
| }); |
| |
| |
| if (!response.ok && response.status !== 404) { |
| throw new Error(`Quran API error: ${response.status}`); |
| } |
| return await response.json(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async function bayanAutocomplete(context, n = 3, signal) { |
| const response = await fetch(`${CONFIG.API_BASE}/api/autocomplete`, { |
| method: 'POST', |
| headers: { 'Content-Type': 'application/json' }, |
| body: JSON.stringify({ context, n }), |
| signal, |
| }); |
| if (!response.ok) { |
| throw new Error(`Autocomplete API error: ${response.status}`); |
| } |
| return await response.json(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| async function bayanHealthCheck() { |
| const response = await fetch(`${CONFIG.API_BASE}/api/health`, { |
| method: 'GET', |
| }); |
| if (!response.ok) { |
| throw new Error(`Health check error: ${response.status}`); |
| } |
| return await response.json(); |
| } |
|
|