本次提交完成了一次全面的架构重构,实现了以数据库为中心的、支持多供应商的LLM配置体系。
**核心变更**:
1. **数据库驱动配置**: 废弃了所有基于本地文件的配置方案 (`analysis-config.json`),将LLM Provider和分析模块的配置作为结构化数据存入数据库的`system_config`表中,由`data-persistence-service`统一管理。
2. **Schema-in-Code**: 在`common-contracts`中定义了所有配置的Rust Structs,作为整个系统的“单一事实源”,确保了端到端的类型安全。
3. **服务职责重构**:
* `data-persistence-service`吸收了配置管理功能,成为配置的“守门人”。
* `config-service-rs`服务已被彻底移除。
* `report-generator-service`重构为可以为每个任务动态创建使用不同Provider配置的LLM客户端。
4. **前端功能增强**:
* 新增了独立的`/llm-config`页面,用于对LLM Providers及其可用模型进行完整的CRUD管理,并支持模型自动发现。
* 重构了旧的`/config`页面,为分析模块提供了级联选择器来精确指定所需的Provider和Model。
此次重构极大地提升了系统的灵活性和可扩展性,完全对齐了“配置即数据”的现代化设计原则。
23 lines
685 B
TypeScript
23 lines
685 B
TypeScript
import { NextRequest } from 'next/server';
|
|
|
|
const BACKEND_BASE = process.env.BACKEND_INTERNAL_URL || process.env.NEXT_PUBLIC_BACKEND_URL;
|
|
|
|
export async function POST(req: NextRequest) {
|
|
if (!BACKEND_BASE) {
|
|
return new Response('BACKEND_INTERNAL_URL/NEXT_PUBLIC_BACKEND_URL 未配置', { status: 500 });
|
|
}
|
|
const body = await req.text();
|
|
const resp = await fetch(`${BACKEND_BASE}/data-requests`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body,
|
|
});
|
|
const text = await resp.text();
|
|
return new Response(text, {
|
|
status: resp.status,
|
|
headers: { 'Content-Type': resp.headers.get('Content-Type') || 'application/json' },
|
|
});
|
|
}
|
|
|
|
|