ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов 2.12.23: декомпозиция deep-turn пайплайна ассистента в runtime-адаптеры
This commit is contained in:
@@ -797,6 +797,7 @@ function buildRunSummary(run) {
|
||||
llm_provider: llmProvider,
|
||||
model,
|
||||
use_mock: toBooleanSafe(run.report.use_mock),
|
||||
analysis_date: toStringSafe(run.report.analysis_date),
|
||||
prompt_version: toStringSafe(run.report.prompt_version),
|
||||
schema_version: toStringSafe(run.report.schema_version),
|
||||
suite_id: toStringSafe(run.report.suite_id),
|
||||
|
||||
+31
-2
@@ -90,7 +90,32 @@ function normalizeCaseIds(value) {
|
||||
.filter((item) => item.length > 0);
|
||||
return normalized.length > 0 ? normalized : undefined;
|
||||
}
|
||||
function normalizeAnalysisDate(value) {
|
||||
if (typeof value !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
const trimmed = value.trim();
|
||||
const match = trimmed.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
const year = Number(match[1]);
|
||||
const month = Number(match[2]);
|
||||
const day = Number(match[3]);
|
||||
if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day)) {
|
||||
return undefined;
|
||||
}
|
||||
const candidate = new Date(Date.UTC(year, month - 1, day));
|
||||
if (candidate.getUTCFullYear() !== year ||
|
||||
candidate.getUTCMonth() + 1 !== month ||
|
||||
candidate.getUTCDate() !== day) {
|
||||
return undefined;
|
||||
}
|
||||
return `${match[1]}-${match[2]}-${match[3]}`;
|
||||
}
|
||||
function buildEvalPayloadFromBody(body) {
|
||||
const analysisDate = normalizeAnalysisDate(body.analysis_date) ??
|
||||
normalizeAnalysisDate(body.analysisDate);
|
||||
return {
|
||||
normalizeConfig: (body.normalizeConfig ?? {}),
|
||||
caseIds: normalizeCaseIds(body.caseIds),
|
||||
@@ -103,7 +128,8 @@ function buildEvalPayloadFromBody(body) {
|
||||
? body.compare_with_report_file
|
||||
: typeof body.comparisonBaselineReportFile === "string"
|
||||
? body.comparisonBaselineReportFile
|
||||
: undefined
|
||||
: undefined,
|
||||
analysisDate
|
||||
};
|
||||
}
|
||||
function resolveReadablePath(inputPath) {
|
||||
@@ -245,6 +271,7 @@ function snapshotJob(job) {
|
||||
eval_target: job.eval_target,
|
||||
run_id: job.run_id,
|
||||
case_set_file: job.case_set_file,
|
||||
analysis_date: job.analysis_date,
|
||||
total_cases: job.total_cases,
|
||||
completed_cases: job.completed_cases,
|
||||
error: job.error,
|
||||
@@ -258,7 +285,8 @@ function snapshotJob(job) {
|
||||
: toRecord(job.report.metrics) && typeof toRecord(job.report.metrics)?.score_index === "number"
|
||||
? Number(toRecord(job.report.metrics)?.score_index)
|
||||
: null,
|
||||
cases_total: typeof job.report.cases_total === "number" ? Number(job.report.cases_total) : null
|
||||
cases_total: typeof job.report.cases_total === "number" ? Number(job.report.cases_total) : null,
|
||||
analysis_date: toStringSafe(job.report.analysis_date) ?? job.analysis_date
|
||||
}
|
||||
: null
|
||||
};
|
||||
@@ -310,6 +338,7 @@ function buildEvalRouter(services) {
|
||||
eval_target: payload.evalTarget,
|
||||
run_id: runId,
|
||||
case_set_file: runtimeCaseSetFile,
|
||||
analysis_date: payload.analysisDate ?? null,
|
||||
total_cases: caseSeeds.length,
|
||||
completed_cases: 0,
|
||||
cases: caseSeeds.map((item) => ({
|
||||
|
||||
Reference in New Issue
Block a user