@@ -6,6 +6,7 @@ import Image from "next/image";
66import Link from "next/link" ;
77import { useParams } from "next/navigation" ;
88import { useEffect , useState , useRef } from "react" ;
9+ import { env } from "next-runtime-env" ;
910
1011export default function GPRunResult ( ) {
1112 const [ data , setData ] = useState ( null ) ; // Stores full run data if needed later
@@ -30,7 +31,7 @@ export default function GPRunResult() {
3031 // --- Function to Fetch Status and Control SSE (Defined early) ---
3132 const fetchData = ( ) => {
3233 const backendBaseUrl =
33- process . env . NEXT_PUBLIC_BACKEND_BASE_URL ?? "http://localhost:5002" ;
34+ env ( " NEXT_PUBLIC_BACKEND_BASE_URL" ) ?? "http://localhost:5002" ;
3435 console . log ( "Fetching execution status for GP Run ID:" , id ) ;
3536 fetch ( `${ backendBaseUrl } /api/runs/run` , {
3637 method : "POST" ,
@@ -123,7 +124,7 @@ export default function GPRunResult() {
123124 const signal = sseAbortControllerRef . current . signal ;
124125
125126 const backendBaseUrl =
126- process . env . NEXT_PUBLIC_BACKEND_BASE_URL ?? "http://localhost:5002" ;
127+ env ( " NEXT_PUBLIC_BACKEND_BASE_URL" ) ?? "http://localhost:5002" ;
127128 const sseUrl = `${ backendBaseUrl . replace ( / \/ $ / , "" ) } /api/runs/logs` ; // Updated URL
128129
129130 try {
@@ -311,7 +312,7 @@ export default function GPRunResult() {
311312 // --- Fetch Static Content & Initial Status ---
312313 useEffect ( ( ) => {
313314 const minioBaseUrl =
314- process . env . NEXT_PUBLIC_MINIO_BASE_URL ?? "http://localhost:9000" ;
315+ env ( " NEXT_PUBLIC_MINIO_BASE_URL" ) ?? "http://localhost:9000" ;
315316 const fetchInputParams = ( ) => {
316317 fetch ( `${ minioBaseUrl } /code/${ id } /input.json` )
317318 . then ( ( response ) =>
@@ -356,7 +357,7 @@ export default function GPRunResult() {
356357 // --- Fetch Final Log Content ---
357358 const fetchLogsContent = ( ) => {
358359 const minioBaseUrl =
359- process . env . NEXT_PUBLIC_MINIO_BASE_URL ?? "http://localhost:9000" ;
360+ env ( " NEXT_PUBLIC_MINIO_BASE_URL" ) ?? "http://localhost:9000" ;
360361 fetch ( `${ minioBaseUrl } /code/${ id } /logbook.txt` )
361362 . then ( ( response ) =>
362363 response . ok
@@ -373,7 +374,7 @@ export default function GPRunResult() {
373374 // --- Fetch Final Best Fitness/Expression ---
374375 const fetchBestFitness = ( ) => {
375376 const minioBaseUrl =
376- process . env . NEXT_PUBLIC_MINIO_BASE_URL ?? "http://localhost:9000" ;
377+ env ( " NEXT_PUBLIC_MINIO_BASE_URL" ) ?? "http://localhost:9000" ;
377378 // GP results are often in best.txt as the expression
378379 fetch ( `${ minioBaseUrl } /code/${ id } /best.txt` )
379380 . then ( ( response ) =>
@@ -407,7 +408,7 @@ export default function GPRunResult() {
407408 const handleShareSubmit = ( e ) => {
408409 e . preventDefault ( ) ;
409410 const backendBaseUrl =
410- process . env . NEXT_PUBLIC_BACKEND_BASE_URL ?? "http://localhost:5002" ;
411+ env ( " NEXT_PUBLIC_BACKEND_BASE_URL" ) ?? "http://localhost:5002" ;
411412 fetch ( `${ backendBaseUrl } /api/runs/share` , {
412413 method : "POST" ,
413414 headers : { "Content-Type" : "application/json" } ,
@@ -467,7 +468,7 @@ export default function GPRunResult() {
467468 ? "Live Execution Logs"
468469 : "Final Generation Wise Logs" ;
469470 const minioBaseUrl =
470- process . env . NEXT_PUBLIC_MINIO_BASE_URL ?? "http://localhost:9000" ;
471+ env ( " NEXT_PUBLIC_MINIO_BASE_URL" ) ?? "http://localhost:9000" ;
471472
472473 return (
473474 < main className = "flex flex-col items-center justify-center min-h-screen font-[family-name:var(--font-geist-mono)] p-4 sm:p-8 bg-gray-100" >
@@ -644,7 +645,7 @@ export default function GPRunResult() {
644645 Code
645646 </ h3 >
646647 { /* ... Ask AI Button ... */ }
647- { process . env . NEXT_PUBLIC_AI === "true" && (
648+ { env ( " NEXT_PUBLIC_AI" ) === "true" && (
648649 < Link
649650 href = { `/explain/${ id } ` }
650651 className = "inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 text-xs sm:text-sm font-medium text-slate-700 border border-slate-300 shadow-sm transition-all duration-200 ease-in-out hover:bg-slate-200 focus:outline-none focus:ring-2 focus:ring-blue-500 active:bg-slate-300"
0 commit comments