update applying current ai insight from dashboard-cpsp
This commit is contained in:
1 parent
31272035e9
commit
b87f20e3b3
27 files changed
+5300
-343
No files matched your search
@@ -1,5 +1,10 @@
|
||||
import type {
|
||||
AIInsight,
|
||||
InsightApiResponse,
|
||||
InsightCachedParams,
|
||||
InsightGenerateJob,
|
||||
InsightGenerateParams,
|
||||
InsightJobStatus,
|
||||
ChickenCounting,
|
||||
ChickenWeight,
|
||||
ActiveSite,
|
||||
@@ -264,5 +269,25 @@ export const api = {
|
||||
insights: {
|
||||
list: async (query?: CycleFilter) =>
|
||||
unwrapList(await get<Paginated<AIInsight> | AIInsight[]>('/ai-insights/', query)),
|
||||
generate: (body: InsightGenerateParams) => {
|
||||
if (body.kandang_id == null) {
|
||||
return Promise.reject(
|
||||
new Error('kandang_id wajib - insight tidak boleh untuk semua kandang')
|
||||
);
|
||||
}
|
||||
return post<InsightApiResponse>('/ai-insights/generate/', body);
|
||||
},
|
||||
generateAsync: (body: InsightGenerateParams) => {
|
||||
if (body.kandang_id == null) {
|
||||
return Promise.reject(
|
||||
new Error('kandang_id wajib - insight tidak boleh untuk semua kandang')
|
||||
);
|
||||
}
|
||||
return post<InsightGenerateJob>('/ai-insights/generate/', { ...body, async: true });
|
||||
},
|
||||
jobStatus: (jobId: string) =>
|
||||
get<InsightJobStatus>(`/ai-insights/jobs/${encodeURIComponent(jobId)}/`),
|
||||
cached: (params: InsightCachedParams) =>
|
||||
get<InsightApiResponse>('/ai-insights/cached/', params),
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user