修复LLM审计回调类型
This commit is contained in:
@@ -67,7 +67,9 @@ async function rerunHumanCopyCase(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await optimizeRenweiCopy(payload, {
|
const result = await optimizeRenweiCopy(payload, {
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const resultVersion = await repository.createOptimizationResultVersion({
|
const resultVersion = await repository.createOptimizationResultVersion({
|
||||||
case_id: detail.case.id,
|
case_id: detail.case.id,
|
||||||
@@ -187,7 +189,9 @@ async function rerunArticleCase(
|
|||||||
payload.fact_card ??
|
payload.fact_card ??
|
||||||
existingFactCard ??
|
existingFactCard ??
|
||||||
(await extractCandidateFactCard(articleInput, {
|
(await extractCandidateFactCard(articleInput, {
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
processSummary.push(
|
processSummary.push(
|
||||||
@@ -205,7 +209,9 @@ async function rerunArticleCase(
|
|||||||
const result = await runOptimizationWorkflow({
|
const result = await runOptimizationWorkflow({
|
||||||
input: articleInput,
|
input: articleInput,
|
||||||
factCard: savedFactCard,
|
factCard: savedFactCard,
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const optimizedArticle = await repository.saveOptimizedArticle(
|
const optimizedArticle = await repository.saveOptimizedArticle(
|
||||||
job.id,
|
job.id,
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ export async function POST(request: Request) {
|
|||||||
const llmAuditSummary: LlmAuditSummary[] = [];
|
const llmAuditSummary: LlmAuditSummary[] = [];
|
||||||
try {
|
try {
|
||||||
const result = await optimizeRenweiCopy(payload, {
|
const result = await optimizeRenweiCopy(payload, {
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const resultVersion = await repository.createOptimizationResultVersion({
|
const resultVersion = await repository.createOptimizationResultVersion({
|
||||||
case_id: optimizationCase.id,
|
case_id: optimizationCase.id,
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ export async function POST(request: Request, context: RouteContext) {
|
|||||||
onProgress: (event) => {
|
onProgress: (event) => {
|
||||||
recordWorkflowProgress(jobId, event);
|
recordWorkflowProgress(jobId, event);
|
||||||
},
|
},
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const optimizedArticle = await repository.saveOptimizedArticle(
|
const optimizedArticle = await repository.saveOptimizedArticle(
|
||||||
jobId,
|
jobId,
|
||||||
|
|||||||
@@ -109,7 +109,9 @@ export async function POST(request: Request) {
|
|||||||
const factCard = optimizationFactCardSchema.parse(
|
const factCard = optimizationFactCardSchema.parse(
|
||||||
payload.fact_card ??
|
payload.fact_card ??
|
||||||
(await extractCandidateFactCard(normalized.articleInput, {
|
(await extractCandidateFactCard(normalized.articleInput, {
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
processSummary.push(
|
processSummary.push(
|
||||||
@@ -136,7 +138,9 @@ export async function POST(request: Request) {
|
|||||||
stage = stageForEvent(event, stage);
|
stage = stageForEvent(event, stage);
|
||||||
send(event);
|
send(event);
|
||||||
},
|
},
|
||||||
onAuditSummary: (summary) => llmAuditSummary.push(summary),
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
stage = "final";
|
stage = "final";
|
||||||
|
|||||||
@@ -56,7 +56,11 @@ export async function POST(request: Request) {
|
|||||||
try {
|
try {
|
||||||
const candidateFactCard = await extractCandidateFactCard(
|
const candidateFactCard = await extractCandidateFactCard(
|
||||||
normalized.articleInput,
|
normalized.articleInput,
|
||||||
{ onAuditSummary: (summary) => llmAuditSummary.push(summary) },
|
{
|
||||||
|
onAuditSummary: (summary) => {
|
||||||
|
llmAuditSummary.push(summary);
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
const duration = Date.now() - factStartedAt;
|
const duration = Date.now() - factStartedAt;
|
||||||
timing.total_ms = duration;
|
timing.total_ms = duration;
|
||||||
|
|||||||
Reference in New Issue
Block a user