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

Commit b9e09f1

Browse files
thelostone-mc0xKurt
authored andcommitted
use triggeLLM instead of syncPool
1 parent 74d059a commit b9e09f1

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
@@ -7,6 +7,13 @@ export interface SyncPoolBody {
77
alloPoolId: string;
88
}
99

10+
export interface TriggerLLMBody {
11+
chainId: number;
12+
alloPoolId: string;
13+
alloApplicationId: string;
14+
signature: string;
15+
}
16+
1017
export async function submitEvaluation(
1118
evaluationBody: EvaluationBody,
1219
): Promise<{ evaluationId: string }> {
@@ -61,6 +68,32 @@ export async function syncPool(syncPoolBody: SyncPoolBody): Promise<boolean> {
6168
}
6269
}
6370

71+
export async function triggerLLM(triggerLLMBody: TriggerLLMBody): Promise<boolean> {
72+
const url = `${CHECKER_ENDPOINT}/api/evaluate/llm`;
73+
74+
try {
75+
const response = await fetch(url, {
76+
method: "POST",
77+
headers: {
78+
"Content-Type": "application/json",
79+
},
80+
body: JSON.stringify({
81+
...triggerLLMBody,
82+
}),
83+
});
84+
85+
if (!response.ok) {
86+
const errorData = await response.json();
87+
throw new Error(`Error: ${response.status} - ${errorData.message || "Unknown error"}`);
88+
}
89+
90+
return true;
91+
} catch (error) {
92+
console.error("Error triggering LLM:", error);
93+
throw error;
94+
}
95+
}
96+
6497
export async function verifyCredentials(
6598
application: Partial<ProjectApplicationForManager>,
6699
): Promise<{ twitter: boolean; github: boolean }> {

0 commit comments

Comments
 (0)