deploy: push latest version to production
Some checks failed
2026 World Cup Quant Platform - Production Deployment / Code Quality, Security Gate & Testing (push) Failing after 4m12s
2026 World Cup Quant Platform - Production Deployment / Deploy to Production VM via Gitea CD (push) Has been skipped

This commit is contained in:
QuantBot
2026-06-26 14:06:37 +08:00
parent 9a0fa72738
commit 64cae96d0d
16 changed files with 447 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
type RouteContext = {
params: Promise<{ date: string }>;
};
export async function GET(_request: Request, { params }: RouteContext) {
const { date } = await params;
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
return NextResponse.json({ message: '日期格式必須為 YYYY-MM-DD' }, { status: 400 });
}
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/agent-daily-review/${encodeURIComponent(date)}`, {
method: 'GET',
cache: 'no-store',
headers: { 'Content-Type': 'application/json' },
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json({ generated_at: new Date().toISOString(), ...data });
} catch (error) {
const message = error instanceof Error ? error.message : 'NemoTron 反方稽核暫時無法連線';
return NextResponse.json({ message }, { status: 502 });
}
}

View File

@@ -0,0 +1,24 @@
import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
export async function GET() {
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/agent-verification`, {
method: 'GET',
cache: 'no-store',
headers: { 'Content-Type': 'application/json' },
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json({ generated_at: new Date().toISOString(), ...data });
} catch (error) {
const message = error instanceof Error ? error.message : 'AI 驗證服務暫時無法連線';
return NextResponse.json({ message }, { status: 502 });
}
}

View File

@@ -0,0 +1,43 @@
import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
export const dynamic = 'force-dynamic';
export async function GET(request: Request) {
const url = new URL(request.url);
const startDate = url.searchParams.get('start_date') || '2026-06-11';
const endDate = url.searchParams.get('end_date');
if (!/^\d{4}-\d{2}-\d{2}$/.test(startDate)) {
return NextResponse.json({ message: '開始日期格式必須為 YYYY-MM-DD' }, { status: 400 });
}
if (endDate && !/^\d{4}-\d{2}-\d{2}$/.test(endDate)) {
return NextResponse.json({ message: '結束日期格式必須為 YYYY-MM-DD' }, { status: 400 });
}
const params = new URLSearchParams({ start_date: startDate });
if (endDate) params.set('end_date', endDate);
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/daily-card-calendar?${params.toString()}`, {
method: 'GET',
cache: 'no-store',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : '日期推薦摘要服務暫時無法連線';
return NextResponse.json({ message }, { status: 502 });
}
}

View File

@@ -0,0 +1,28 @@
import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
export const dynamic = 'force-dynamic';
export async function GET() {
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/daily-card-calendar/status`, {
method: 'GET',
cache: 'no-store',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : '日期推薦摘要快取狀態暫時無法讀取';
return NextResponse.json({ message }, { status: 502 });
}
}

View File

@@ -0,0 +1,24 @@
import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
export async function GET() {
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/gemini-usage`, {
method: 'GET',
cache: 'no-store',
headers: { 'Content-Type': 'application/json' },
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json({ generated_at: new Date().toISOString(), ...data });
} catch (error) {
const message = error instanceof Error ? error.message : 'Gemini 用量服務暫時無法連線';
return NextResponse.json({ message }, { status: 502 });
}
}

View File

@@ -0,0 +1,29 @@
import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
export async function GET(request: Request) {
const url = new URL(request.url);
const daysAhead = url.searchParams.get('days_ahead') || '2';
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/market-coverage?days_ahead=${encodeURIComponent(daysAhead)}`, {
method: 'GET',
cache: 'no-store',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : '盤口覆蓋率暫時無法連線';
return NextResponse.json({ message }, { status: 502 });
}
}