| | |
| | const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:8000/api'; |
| |
|
| | |
| | |
| | |
| | |
| | export async function runQuery(query, accessToken, topK = 3) { |
| | const res = await fetch(`${API_BASE}/query-secure`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ |
| | query, |
| | access_token: accessToken, |
| | top_k: topK |
| | }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | export async function reindex(docsDir, outputPath = 'data/chunks.jsonl') { |
| | const res = await fetch(`${API_BASE}/ingest`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ docs_dir: docsDir, output_path: outputPath }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | export async function syncPinecone(chunksPath = 'data/chunks.jsonl') { |
| | const res = await fetch(`${API_BASE}/sync-pinecone`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ chunks_path: chunksPath }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | export async function getStatus(chunksPath = 'data/chunks.jsonl') { |
| | const res = await fetch(`${API_BASE}/status?chunks_path=${encodeURIComponent(chunksPath)}`); |
| | return res.json(); |
| | } |
| |
|
| | export async function healthCheck() { |
| | const res = await fetch(`${API_BASE}/health`); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | export async function clearIndex() { |
| | const res = await fetch(`${API_BASE}/clear-index`, { |
| | method: 'DELETE' |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | export async function embedChunks(chunks) { |
| | const res = await fetch(`${API_BASE}/embed-chunks`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ chunks }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | export async function exchangeDropboxCode(code, redirectUri) { |
| | const res = await fetch(`${API_BASE}/dropbox/token`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ code, redirect_uri: redirectUri }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | export async function getDropboxFolder(path, accessToken) { |
| | const res = await fetch(`${API_BASE}/dropbox/folder`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ path, access_token: accessToken }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | export async function getDropboxFile(filePath, accessToken) { |
| | const res = await fetch(`${API_BASE}/dropbox/file`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ path: filePath, access_token: accessToken }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | export async function evalParsing(filePath, accessToken) { |
| | const res = await fetch(`${API_BASE}/eval/parsing`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ path: filePath, access_token: accessToken }) |
| | }); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | export async function getSupportedFormats() { |
| | const res = await fetch(`${API_BASE}/eval/formats`); |
| | return res.json(); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | export async function parseWithDocling(files, accessToken) { |
| | const res = await fetch(`${API_BASE}/parse-docling`, { |
| | method: 'POST', |
| | headers: { 'Content-Type': 'application/json' }, |
| | body: JSON.stringify({ files, access_token: accessToken }) |
| | }); |
| | return res.json(); |
| | } |
| |
|