This repository was archived by the owner on Feb 10, 2025. It is now read-only.
File tree 2 files changed +37
-2
lines changed
pages/ApplicationEvaluationOverviewPage
2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Hex } from "viem" ;
2
2
3
3
import { PoolSummary , ProjectBanner } from "@/components" ;
4
- import { syncPool } from "@/mainAll" ;
4
+ import { triggerLLM } from "@/mainAll" ;
5
5
import { Button , Icon , IconType } from "@/primitives" ;
6
6
7
7
import { EvaluationList } from "~checker/components" ;
@@ -44,9 +44,11 @@ export const ApplicationEvaluationOverviewPage = ({
44
44
} ;
45
45
46
46
const syncAndRefresh = async ( ) => {
47
- await syncPool ( {
47
+ await triggerLLM ( {
48
48
chainId,
49
49
alloPoolId : poolId ,
50
+ alloApplicationId : applicationId ,
51
+ signature : "0xdeadbeef" ,
50
52
} ) ;
51
53
dispatch ( goToApplicationEvaluationOverviewAction ( { projectId : applicationId } ) ) ;
52
54
} ;
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ export interface SyncPoolBody {
6
6
alloPoolId : string ;
7
7
}
8
8
9
+ export interface TriggerLLMBody {
10
+ chainId : number ;
11
+ alloPoolId : string ;
12
+ alloApplicationId : string ;
13
+ signature : string ;
14
+ }
15
+
9
16
export async function submitEvaluation (
10
17
evaluationBody : EvaluationBody ,
11
18
) : Promise < { evaluationId : string } > {
@@ -59,3 +66,29 @@ export async function syncPool(syncPoolBody: SyncPoolBody): Promise<boolean> {
59
66
throw error ;
60
67
}
61
68
}
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
+ }
You can’t perform that action at this time.
0 commit comments