deploy: push latest version to production
This commit is contained in:
BIN
platform/backend/app/__pycache__/main.cpython-311.pyc
Normal file
BIN
platform/backend/app/__pycache__/main.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
@@ -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 });
|
||||
}
|
||||
}
|
||||
24
platform/web/app/api/analytics/agent-verification/route.ts
Normal file
24
platform/web/app/api/analytics/agent-verification/route.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
43
platform/web/app/api/analytics/daily-card-calendar/route.ts
Normal file
43
platform/web/app/api/analytics/daily-card-calendar/route.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
24
platform/web/app/api/analytics/gemini-usage/route.ts
Normal file
24
platform/web/app/api/analytics/gemini-usage/route.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
29
platform/web/app/api/analytics/market-coverage/route.ts
Normal file
29
platform/web/app/api/analytics/market-coverage/route.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user