Spaces:
Sleeping
Sleeping
File size: 1,681 Bytes
f871fed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
/**
* Research API Client
* Functions for interacting with the multi-agent research pipeline
*/
import { apiClient } from './client'
import type {
ResearchRequest,
ResearchProgress,
ResearchResult,
ResearchSummary
} from '../types/research'
/**
* Start a new research task (async)
*/
export async function startResearch(request: ResearchRequest): Promise<ResearchProgress> {
const response = await apiClient.post<ResearchProgress>('/research/start', request)
return response.data
}
/**
* Get the status of a research task
*/
export async function getResearchStatus(taskId: string): Promise<ResearchProgress> {
const response = await apiClient.get<ResearchProgress>(`/research/status/${taskId}`)
return response.data
}
/**
* Get the result of a completed research task
*/
export async function getResearchResult(taskId: string): Promise<ResearchResult> {
const response = await apiClient.get<ResearchResult>(`/research/result/${taskId}`)
return response.data
}
/**
* Get history of research tasks
*/
export async function getResearchHistory(limit = 20, offset = 0): Promise<ResearchSummary[]> {
const response = await apiClient.get<ResearchSummary[]>('/research/history', {
params: { limit, offset }
})
return response.data
}
/**
* Run a synchronous (quick) research task
*/
export async function quickResearch(request: ResearchRequest): Promise<ResearchResult> {
const response = await apiClient.post<ResearchResult>('/research/quick', request)
return response.data
}
/**
* Delete a research task
*/
export async function deleteResearch(taskId: string): Promise<void> {
await apiClient.delete(`/research/${taskId}`)
}
|