diff --git a/app/api/assistant/[assistant_id]/route.ts b/app/api/assistant/[assistant_id]/route.ts index dd1ed51..45458f9 100644 --- a/app/api/assistant/[assistant_id]/route.ts +++ b/app/api/assistant/[assistant_id]/route.ts @@ -23,7 +23,7 @@ export async function GET( const { assistant_id } = await params; // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/assistant/${assistant_id}`, { diff --git a/app/api/collections/[collection_id]/route.ts b/app/api/collections/[collection_id]/route.ts index 2f42cf8..76f80e9 100644 --- a/app/api/collections/[collection_id]/route.ts +++ b/app/api/collections/[collection_id]/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server'; -const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; +const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // GET /api/collections/[collection_id] - Get a specific collection export async function GET( diff --git a/app/api/collections/jobs/[job_id]/route.ts b/app/api/collections/jobs/[job_id]/route.ts index f5fc414..0f8962f 100644 --- a/app/api/collections/jobs/[job_id]/route.ts +++ b/app/api/collections/jobs/[job_id]/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server'; -const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; +const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // GET /api/collections/jobs/[job_id] - Get collection job status export async function GET( diff --git a/app/api/collections/route.ts b/app/api/collections/route.ts index edade40..0b57c27 100644 --- a/app/api/collections/route.ts +++ b/app/api/collections/route.ts @@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { @@ -52,7 +52,7 @@ export async function POST(request: NextRequest) { const body = await request.json(); // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/collections/`, { diff --git a/app/api/configs/[config_id]/route.ts b/app/api/configs/[config_id]/route.ts index efb8f18..c6a00e2 100644 --- a/app/api/configs/[config_id]/route.ts +++ b/app/api/configs/[config_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ config_id: string }> } ) { const { config_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -30,7 +30,7 @@ export async function PATCH( { params }: { params: Promise<{ config_id: string }> } ) { const { config_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -60,7 +60,7 @@ export async function DELETE( { params }: { params: Promise<{ config_id: string }> } ) { const { config_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { diff --git a/app/api/configs/[config_id]/versions/[version_number]/route.ts b/app/api/configs/[config_id]/versions/[version_number]/route.ts index a3b309c..175053e 100644 --- a/app/api/configs/[config_id]/versions/[version_number]/route.ts +++ b/app/api/configs/[config_id]/versions/[version_number]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ config_id: string; version_number: string }> } ) { const { config_id, version_number } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -33,7 +33,7 @@ export async function DELETE( { params }: { params: Promise<{ config_id: string; version_number: string }> } ) { const { config_id, version_number } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { diff --git a/app/api/configs/[config_id]/versions/route.ts b/app/api/configs/[config_id]/versions/route.ts index 85d7f96..12768fe 100644 --- a/app/api/configs/[config_id]/versions/route.ts +++ b/app/api/configs/[config_id]/versions/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ config_id: string }> } ) { const { config_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -30,7 +30,7 @@ export async function POST( { params }: { params: Promise<{ config_id: string }> } ) { const { config_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { diff --git a/app/api/configs/route.ts b/app/api/configs/route.ts index ea286a9..4c0d510 100644 --- a/app/api/configs/route.ts +++ b/app/api/configs/route.ts @@ -1,7 +1,7 @@ import { NextResponse, NextRequest } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -36,7 +36,7 @@ export async function POST(request: NextRequest) { ) } const body=await request.json(); - const backendUrl=process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl=process.env.BACKEND_URL || 'http://localhost:8000'; const response=await fetch(`${backendUrl}/api/v1/configs/`, { method:'POST', diff --git a/app/api/document/[document_id]/route.ts b/app/api/document/[document_id]/route.ts index 125812b..f244967 100644 --- a/app/api/document/[document_id]/route.ts +++ b/app/api/document/[document_id]/route.ts @@ -6,7 +6,7 @@ export async function GET(request: Request, ) { const { document_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { @@ -44,7 +44,7 @@ export async function DELETE(request: Request, { params }: { params: Promise<{ document_id: string }> } ) { const { document_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { diff --git a/app/api/document/route.ts b/app/api/document/route.ts index 89aa062..d63edc6 100644 --- a/app/api/document/route.ts +++ b/app/api/document/route.ts @@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { @@ -52,7 +52,7 @@ export async function POST(request: NextRequest) { const formData = await request.formData(); // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/documents/`, { diff --git a/app/api/evaluations/[id]/route.ts b/app/api/evaluations/[id]/route.ts index 655033e..f65043b 100644 --- a/app/api/evaluations/[id]/route.ts +++ b/app/api/evaluations/[id]/route.ts @@ -48,7 +48,7 @@ export async function GET( } // Real backend mode - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const searchParams = request.nextUrl.searchParams; const exportFormat = searchParams.get('export_format') || 'row'; diff --git a/app/api/evaluations/datasets/[dataset_id]/route.ts b/app/api/evaluations/datasets/[dataset_id]/route.ts index a855063..bf65d09 100644 --- a/app/api/evaluations/datasets/[dataset_id]/route.ts +++ b/app/api/evaluations/datasets/[dataset_id]/route.ts @@ -16,7 +16,7 @@ export async function GET( } const { dataset_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const searchParams = request.nextUrl.searchParams.toString(); const queryString = searchParams ? `?${searchParams}` : ''; @@ -78,7 +78,7 @@ export async function DELETE( const { dataset_id } = await params; // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/evaluations/datasets/${dataset_id}`, { diff --git a/app/api/evaluations/datasets/route.ts b/app/api/evaluations/datasets/route.ts index 0952446..0a8a3a6 100644 --- a/app/api/evaluations/datasets/route.ts +++ b/app/api/evaluations/datasets/route.ts @@ -18,7 +18,7 @@ export async function GET(request: NextRequest) { } // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/evaluations/datasets`, { @@ -68,7 +68,7 @@ export async function POST(request: NextRequest) { const formData = await request.formData(); // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/evaluations/datasets`, { diff --git a/app/api/evaluations/route.ts b/app/api/evaluations/route.ts index 2742264..2ca8bb7 100644 --- a/app/api/evaluations/route.ts +++ b/app/api/evaluations/route.ts @@ -11,7 +11,7 @@ export async function GET(request: NextRequest) { return NextResponse.json({ error: 'Missing X-API-KEY' }, { status: 401 }); } - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const response = await fetch(`${backendUrl}/api/v1/evaluations`, { method: 'GET', @@ -44,7 +44,7 @@ export async function POST(request: NextRequest) { } const body = await request.json(); - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const response = await fetch(`${backendUrl}/api/v1/evaluations`, { method: 'POST', diff --git a/app/api/evaluations/stt/datasets/[dataset_id]/route.ts b/app/api/evaluations/stt/datasets/[dataset_id]/route.ts index 81bc62c..6d53bf8 100644 --- a/app/api/evaluations/stt/datasets/[dataset_id]/route.ts +++ b/app/api/evaluations/stt/datasets/[dataset_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ dataset_id: string }> } ) { const { dataset_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { @@ -47,7 +47,7 @@ export async function DELETE( { params }: { params: Promise<{ dataset_id: string }> } ) { const { dataset_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { diff --git a/app/api/evaluations/stt/datasets/route.ts b/app/api/evaluations/stt/datasets/route.ts index a725ccd..abc30c5 100644 --- a/app/api/evaluations/stt/datasets/route.ts +++ b/app/api/evaluations/stt/datasets/route.ts @@ -4,7 +4,7 @@ import { NextResponse, NextRequest } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -39,7 +39,7 @@ export async function POST(request: NextRequest) { ) } const body=await request.json(); - const backendUrl=process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl=process.env.BACKEND_URL || 'http://localhost:8000'; const response=await fetch(`${backendUrl}/api/v1/evaluations/stt/datasets`, { method:'POST', diff --git a/app/api/evaluations/stt/files/route.ts b/app/api/evaluations/stt/files/route.ts index 1228134..ab76667 100644 --- a/app/api/evaluations/stt/files/route.ts +++ b/app/api/evaluations/stt/files/route.ts @@ -17,7 +17,7 @@ export async function POST(request: NextRequest) { const formData = await request.formData(); // Get backend URL from environment variable - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; // Forward the request to the actual backend const response = await fetch(`${backendUrl}/api/v1/evaluations/stt/files`, { diff --git a/app/api/evaluations/stt/results/[result_id]/route.ts b/app/api/evaluations/stt/results/[result_id]/route.ts index 829e4d4..16d69d6 100644 --- a/app/api/evaluations/stt/results/[result_id]/route.ts +++ b/app/api/evaluations/stt/results/[result_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ result_id: string }> } ) { const { result_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -31,7 +31,7 @@ export async function PATCH( { params }: { params: Promise<{ result_id: string }> } ) { const { result_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { diff --git a/app/api/evaluations/stt/runs/[run_id]/route.ts b/app/api/evaluations/stt/runs/[run_id]/route.ts index 91cb672..49bac61 100644 --- a/app/api/evaluations/stt/runs/[run_id]/route.ts +++ b/app/api/evaluations/stt/runs/[run_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ run_id: string }> } ) { const { run_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); // Extract query parameters from the request URL diff --git a/app/api/evaluations/stt/runs/route.ts b/app/api/evaluations/stt/runs/route.ts index fb81867..e37b629 100644 --- a/app/api/evaluations/stt/runs/route.ts +++ b/app/api/evaluations/stt/runs/route.ts @@ -3,7 +3,7 @@ import { NextResponse, NextRequest } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -38,7 +38,7 @@ export async function POST(request: NextRequest) { ) } const body=await request.json(); - const backendUrl=process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl=process.env.BACKEND_URL || 'http://localhost:8000'; const response=await fetch(`${backendUrl}/api/v1/evaluations/stt/runs`, { method:'POST', diff --git a/app/api/evaluations/stt/samples/[sample_id]/route.ts b/app/api/evaluations/stt/samples/[sample_id]/route.ts index 79b6c14..a9794d3 100644 --- a/app/api/evaluations/stt/samples/[sample_id]/route.ts +++ b/app/api/evaluations/stt/samples/[sample_id]/route.ts @@ -5,7 +5,7 @@ export async function PATCH( { params }: { params: Promise<{ sample_id: string }> } ) { const { sample_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { diff --git a/app/api/evaluations/tts/datasets/[dataset_id]/route.ts b/app/api/evaluations/tts/datasets/[dataset_id]/route.ts index e7a3080..1ce25c7 100644 --- a/app/api/evaluations/tts/datasets/[dataset_id]/route.ts +++ b/app/api/evaluations/tts/datasets/[dataset_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ dataset_id: string }> } ) { const { dataset_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { @@ -64,7 +64,7 @@ export async function DELETE( { params }: { params: Promise<{ dataset_id: string }> } ) { const { dataset_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { diff --git a/app/api/evaluations/tts/datasets/route.ts b/app/api/evaluations/tts/datasets/route.ts index 4fe9f11..a7a5da3 100644 --- a/app/api/evaluations/tts/datasets/route.ts +++ b/app/api/evaluations/tts/datasets/route.ts @@ -1,7 +1,7 @@ import { NextResponse, NextRequest } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -31,7 +31,7 @@ export async function POST(request: NextRequest) { ); } const body = await request.json(); - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const response = await fetch(`${backendUrl}/api/v1/evaluations/tts/datasets`, { method: 'POST', diff --git a/app/api/evaluations/tts/results/[result_id]/route.ts b/app/api/evaluations/tts/results/[result_id]/route.ts index 126d21e..5620737 100644 --- a/app/api/evaluations/tts/results/[result_id]/route.ts +++ b/app/api/evaluations/tts/results/[result_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ result_id: string }> } ) { const { result_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -30,7 +30,7 @@ export async function PATCH( { params }: { params: Promise<{ result_id: string }> } ) { const { result_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); if (!apiKey) { diff --git a/app/api/evaluations/tts/runs/[run_id]/route.ts b/app/api/evaluations/tts/runs/[run_id]/route.ts index e782d4a..5ebbe00 100644 --- a/app/api/evaluations/tts/runs/[run_id]/route.ts +++ b/app/api/evaluations/tts/runs/[run_id]/route.ts @@ -5,7 +5,7 @@ export async function GET( { params }: { params: Promise<{ run_id: string }> } ) { const { run_id } = await params; - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); const { searchParams } = new URL(request.url); diff --git a/app/api/evaluations/tts/runs/route.ts b/app/api/evaluations/tts/runs/route.ts index 9cd9143..37d4719 100644 --- a/app/api/evaluations/tts/runs/route.ts +++ b/app/api/evaluations/tts/runs/route.ts @@ -1,7 +1,7 @@ import { NextResponse, NextRequest } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { @@ -31,7 +31,7 @@ export async function POST(request: NextRequest) { ); } const body = await request.json(); - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const response = await fetch(`${backendUrl}/api/v1/evaluations/tts/runs`, { method: 'POST', diff --git a/app/api/languages/route.ts b/app/api/languages/route.ts index 00a56f4..50b7805 100644 --- a/app/api/languages/route.ts +++ b/app/api/languages/route.ts @@ -1,7 +1,7 @@ import { NextResponse } from 'next/server'; export async function GET(request: Request) { - const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:8000'; + const backendUrl = process.env.BACKEND_URL || 'http://localhost:8000'; const apiKey = request.headers.get('X-API-KEY'); try { diff --git a/instructions/CLAUDE.md b/instructions/CLAUDE.md index 2f93f99..dbe1573 100644 --- a/instructions/CLAUDE.md +++ b/instructions/CLAUDE.md @@ -5,6 +5,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview Kaapi Konsole is a Next.js 16 application by Tech4Dev for LLM development and evaluation. It provides: + - LLM response evaluation against QnA datasets - Git-like version control for prompt templates - Configuration management with A/B testing @@ -53,11 +54,13 @@ npm run lint ``` **Coming Soon Routes** (placeholders): + - `/model-testing`, `/speech-to-text`, `/text-to-speech`, `/guardrails`, `/redteaming` ### Component Organization **Shared Components** (`/app/components/`): + - `Sidebar.tsx` - Main navigation (240px collapsible) - `TabNavigation.tsx` - Reusable tab switcher - `ConfigModal.tsx` - Modal for viewing evaluation configs @@ -67,6 +70,7 @@ npm run lint - `utils.ts` - Date formatting, color utilities **Prompt Editor Components** (`/app/components/prompt-editor/`): + - `Header.tsx` - Top nav with branch controls - `EditorView.tsx` - WYSIWYG prompt editor - `DiffView.tsx` - Side-by-side diff visualization @@ -78,11 +82,13 @@ npm run lint ### State Management Pattern **No global state library** - uses React `useState` exclusively: + - Component-level state with props drilling - LocalStorage for persistence (API keys, sidebar state) - No Context API or Redux/Zustand **LocalStorage Keys:** + - `kaapi_api_keys` - API key storage - `sidebar-expanded-menus` - Sidebar expansion state @@ -98,7 +104,7 @@ GET /api/evaluations/datasets/[dataset_id] GET /api/assistant/[assistant_id] → Fetch assistant config ``` -**Backend URL**: Configured via `NEXT_PUBLIC_BACKEND_URL` (default: `http://localhost:8000`) +**Backend URL**: Configured via `BACKEND_URL` (default: `http://localhost:8000`) **Authentication**: Custom header `X-API-KEY` passed from client @@ -109,6 +115,7 @@ GET /api/assistant/[assistant_id] → Fetch assistant config **Complex Type Hierarchies** in `/app/components/types.ts`: **Evaluation Types:** + - `EvalJob` - Main evaluation job entity - `ScoreObject` - Union type supporting 3 formats: - `NewScoreObjectV2` (with `traces[]` array) @@ -120,6 +127,7 @@ GET /api/assistant/[assistant_id] → Fetch assistant config **Type Guards**: `isNewScoreObjectV2()`, `isLegacyScoreObject()` for runtime type checking **Prompt Editor Types** in `/app/configurations/prompt-editor/types.ts`: + - `Commit` - Git-like commit with branch/parent relationships - `Config` - LLM configuration blob with versioning - `Tool` - Vector store tool definition @@ -131,18 +139,21 @@ GET /api/assistant/[assistant_id] → Fetch assistant config **Current Design**: Vercel-style minimalist black/white theme **Color Management**: + - All colors defined in `/app/lib/colors.ts` as TypeScript object - Synchronized with CSS variables in `globals.css` - Dark mode support via `prefers-color-scheme` media query - See `COLOR_SCHEME.md` for quick preset options **Styling Approach**: + 1. Tailwind CSS for layout and spacing 2. Inline styles for colors (referencing `colors` object) 3. Hover states managed via React event handlers 4. No custom Tailwind classes or extended theme **Color Palette**: + ```typescript bg: { primary: '#ffffff', secondary: '#fafafa' } text: { primary: '#171717', secondary: '#737373' } @@ -156,6 +167,7 @@ status: { success: '#16a34a', error: '#dc2626', warning: '#f59e0b' } ### 1. LLM Evaluation Pipeline **Workflow**: + 1. Upload CSV with `question,answer` columns 2. Configure experiment (model, instructions, vector stores) 3. Backend creates evaluation job @@ -163,10 +175,12 @@ status: { success: '#16a34a', error: '#dc2626', warning: '#f59e0b' } 5. Results displayed with detailed metrics **Evaluation Modes**: + - Config-based: Specify model, instructions, tools - Assistant-based: Use pre-configured assistant ID **Metrics Display**: + - Summary scores (avg ± std for numeric, distribution for categorical) - Per-item traces with expandable Q&A pairs - Color-coded scores with dynamic thresholds @@ -175,12 +189,14 @@ status: { success: '#16a34a', error: '#dc2626', warning: '#f59e0b' } ### 2. Git-like Prompt Version Control **Core Concepts** (see `/configurations/prompt-editor/page.tsx`): + - **Commits**: Versioned prompt snapshots with author/message/timestamp - **Branches**: Parallel development streams (e.g., main, experiment-v2) - **Diffs**: Myers algorithm for side-by-side change visualization - **Merges**: Branch integration with duplicate commit detection **Implementation Details**: + - All commits stored in-memory (no backend persistence yet) - `createBranch()` preserves uncommitted changes when branching from HEAD - `switchBranch()` loads latest commit from target branch @@ -192,6 +208,7 @@ status: { success: '#16a34a', error: '#dc2626', warning: '#f59e0b' } ### 3. Configuration Management & A/B Testing **Config Structure**: + ```javascript { id: string, @@ -207,6 +224,7 @@ status: { success: '#16a34a', error: '#dc2626', warning: '#f59e0b' } ``` **Features**: + - Multi-version configs (auto-incremented) - "Use Current Prompt" syncs from editor - History tab shows all saved configs @@ -265,16 +283,19 @@ See `CONFIG_AB.md` for complete feature specification. ## Backend Integration **Environment Variables**: + ```bash -NEXT_PUBLIC_BACKEND_URL=http://localhost:8000 # Backend API base URL +BACKEND_URL=http://localhost:8000 # Backend API base URL ``` **Authentication**: + - API keys stored in localStorage - Passed via `X-API-KEY` header - No JWT/OAuth implementation **Dataset Upload**: + - CSV format: `question,expected_answer` columns - Duplication factor supported (1-10) - Backend handles file processing