import { QueryRequest, QueryResponse } from '@/types'; const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000/api/v1'; export async function queryVideos(request: QueryRequest): Promise { const response = await fetch(`${API_BASE_URL}/query`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(request), }); if (!response.ok) { throw new Error(`查询失败: ${response.statusText}`); } return response.json(); } export async function exportData(format: 'xlsx' | 'csv'): Promise { const response = await fetch(`${API_BASE_URL}/export?format=${format}`); if (!response.ok) { throw new Error(`导出失败: ${response.statusText}`); } return response.blob(); }