Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit fc75263

Browse files
committed
use triggeLLM instead of syncPool
1 parent 0248375 commit fc75263

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Hex } from "viem";
22

33
import { PoolSummary, ProjectBanner } from "@/components";
4-
import { syncPool } from "@/mainAll";
4+
import { triggerLLM } from "@/mainAll";
55
import { Button, Icon, IconType } from "@/primitives";
66

77
import { EvaluationList } from "~checker/components";
@@ -44,9 +44,11 @@ export const ApplicationEvaluationOverviewPage = ({
4444
};
4545

4646
const syncAndRefresh = async () => {
47-
await syncPool({
47+
await triggerLLM({
4848
chainId,
4949
alloPoolId: poolId,
50+
alloApplicationId: applicationId,
51+
signature: "0xdeadbeef",
5052
});
5153
dispatch(goToApplicationEvaluationOverviewAction({ projectId: applicationId }));
5254
};

src/features/checker/services/checker/api.ts

+33
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ export interface SyncPoolBody {
66
alloPoolId: string;
77
}
88

9+
export interface TriggerLLMBody {
10+
chainId: number;
11+
alloPoolId: string;
12+
alloApplicationId: string;
13+
signature: string;
14+
}
15+
916
export async function submitEvaluation(
1017
evaluationBody: EvaluationBody,
1118
): Promise<{ evaluationId: string }> {
@@ -59,3 +66,29 @@ export async function syncPool(syncPoolBody: SyncPoolBody): Promise<boolean> {
5966
throw error;
6067
}
6168
}
69+
70+
export async function triggerLLM(triggerLLMBody: TriggerLLMBody): Promise<boolean> {
71+
const url = `${CHECKER_ENDPOINT}/api/evaluate/llm`;
72+
73+
try {
74+
const response = await fetch(url, {
75+
method: "POST",
76+
headers: {
77+
"Content-Type": "application/json",
78+
},
79+
body: JSON.stringify({
80+
...triggerLLMBody,
81+
}),
82+
});
83+
84+
if (!response.ok) {
85+
const errorData = await response.json();
86+
throw new Error(`Error: ${response.status} - ${errorData.message || "Unknown error"}`);
87+
}
88+
89+
return true;
90+
} catch (error) {
91+
console.error("Error triggering LLM:", error);
92+
throw error;
93+
}
94+
}

0 commit comments

Comments
 (0)