Files
Jyotisha/frontend/src/lib/consult/prep-log.ts
T
jesse-uxandGrok (agent loop) a0e223e20c 发问准备可以并行,三个开关先保持关闭(BUG-1337~1339)
开流前的注销检查可以和读会话、解析模型同时进行;审核改到扣点前等待,不再挡住第一行;模型版本可以短缓存;两个领域可以一起算。本机没有数据库中位数,也没有带星盘网络库的镜像,所以默认仍是关闭、缓存 0、领域逐个算。

自测:tsc 0 错;lint 0 error;相关测试失败 0、取消 0。test:db 未跑。

Co-Authored-By: Grok (agent loop)
2026-10-14 07:23:58 +08:00

35 lines
958 B
TypeScript

import type { ModerationResult } from "@/lib/moderation";
export const CONSULT_PREP_AGENT_VERSION = "consultation-prep-v1";
export class ConsultationInputBlockedError extends Error {
readonly result: ModerationResult;
constructor(result: ModerationResult) {
super("content_blocked");
this.name = "ConsultationInputBlockedError";
this.result = result;
}
}
export type ConsultPrepPhase = {
phase: string;
durationMs: number;
status: "completed" | "failed" | "skipped";
};
/** Closed observability event. The question text is not a field. */
export function consultPrepObservabilityEvent(input: {
requestId: string;
sessionId: string;
phases: readonly ConsultPrepPhase[];
}) {
return {
requestId: input.requestId,
sessionId: input.sessionId,
agentVersion: CONSULT_PREP_AGENT_VERSION,
contractPhases: input.phases.map((phase) => ({ ...phase })),
billingSettlementResult: "not_applicable" as const,
};
}