feat: 查标第 1 步——上传投标分册 → 检查 → 逐条处理 → 复查沿用
后端 - check 模块:检查预览、发起、进度、取消、记录;六个阶段(准备投标文件、响应匹配、规则、证据校验、 状态沿用、汇总);问题列表、处理、撤销、批量处理(只限提示级)。 - 每条清单项的检查结论 check_item_result(C9,迁移 0005):「已响应」也带投标原文出处; 没有校验通过的证据不能判已响应(C3)。级别从清单项算,不让模型定;说明不写整改建议。 - 响应匹配先只有第三层:内存 BM25 检索候选句 + check.match v1 提示词,检索不到不调模型, 漏答记 missing_answer,模型临时错误只影响那一批。 - 计费:免费版不记流水;专业版 24 小时内复查免扣(记一行 0);expected_charge 不一致时拒绝不扣点; 失败、取消退回;投标文件读不出文字按输入问题失败、不扣点。 - 投标分册:类型(volume_kind)和版本;电子投标平台加密格式在上传时拦下。 - 解析流水线前几个阶段拆到 document/pipeline/normalize.py,解析和检查共用。 - ops 模块:反馈接口;致命问题确认无误的说明自动进误报反馈(U4)。 - SK1:Valkey 客户端短超时、SSE 连接池上限。SK2:CI 加 Gotenberg、直接跑 init-roles.sh。 前端 - 上传投标文件并检查页、查标页(进度、覆盖范围、按级别筛选、逐条处理和行内说明、撤销、原文抽屉、 已处理、本次已解决);项目头抽成公共组件,加「查标」标签页;工作台「下一步」覆盖查标阶段。 契约、文档:openapi.yaml 加 item-results、volume_kind、coverage 字段;data-model、api-design §10、 架构 §8 / §13(SK14)、AGENTS.md 同步。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import { subscribeEvents, type BdEvent } from "@bid-doctor/api-client";
|
||||
import type { QueryClient } from "@tanstack/vue-query";
|
||||
import { apiOptions } from "./api";
|
||||
import { qk } from "./keys";
|
||||
import { TERMINAL_JOB, type ParseJob, type ProjectListItem } from "./queries";
|
||||
import { TERMINAL_JOB, type CheckRun, type ParseJob, type ProjectListItem } from "./queries";
|
||||
|
||||
type ProjectPage = { items: ProjectListItem[]; next_cursor: string | null };
|
||||
|
||||
@@ -47,6 +47,25 @@ function onEvent(qc: QueryClient, e: BdEvent) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((e.type === "job.progress" || e.type === "job.finished") && job && jobId && job.kind === "check_run") {
|
||||
qc.setQueryData<CheckRun>(qk.checkRun(jobId), (old) =>
|
||||
!old || TERMINAL_JOB.has(old.status) || (job.progress ?? 0) < old.progress
|
||||
? old
|
||||
: { ...old, status: job.status ?? old.status, stage: (job.stage as CheckRun["stage"]) ?? old.stage, progress: job.progress ?? old.progress },
|
||||
);
|
||||
if (e.type === "job.finished") {
|
||||
void qc.invalidateQueries({ queryKey: qk.checkRun(jobId) });
|
||||
void qc.invalidateQueries({ queryKey: qk.findings(jobId) });
|
||||
void qc.invalidateQueries({ queryKey: qk.projects });
|
||||
void qc.invalidateQueries({ queryKey: qk.quota });
|
||||
if (e.project_id) {
|
||||
void qc.invalidateQueries({ queryKey: qk.project(e.project_id) });
|
||||
void qc.invalidateQueries({ queryKey: qk.checkPreview(e.project_id) });
|
||||
void qc.invalidateQueries({ queryKey: qk.checkRuns(e.project_id) });
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (e.type) {
|
||||
case "quota.changed":
|
||||
void qc.invalidateQueries({ queryKey: qk.quota });
|
||||
|
||||
@@ -9,4 +9,10 @@ export const qk = {
|
||||
parseJob: (id: string) => ["parse-job", id] as const,
|
||||
checklist: (projectId: string) => ["checklist", projectId] as const,
|
||||
checklistItems: (projectId: string) => ["checklist-items", projectId] as const,
|
||||
projectDocuments: (projectId: string) => ["project-documents", projectId] as const,
|
||||
checkPreview: (projectId: string) => ["check-preview", projectId] as const,
|
||||
checkRuns: (projectId: string) => ["check-runs", projectId] as const,
|
||||
checkRun: (id: string) => ["check-run", id] as const,
|
||||
findings: (runId: string) => ["findings", runId] as const,
|
||||
itemResults: (runId: string) => ["item-results", runId] as const,
|
||||
};
|
||||
|
||||
@@ -155,6 +155,36 @@ export const PARSE_STEPS: readonly { label: string; stages: readonly string[] }[
|
||||
export const parseStepIndex = (stage: string | null | undefined) =>
|
||||
stage ? PARSE_STEPS.findIndex((s) => s.stages.includes(stage)) : -1;
|
||||
|
||||
/** 检查阶段:服务端的 6 个 stage 合成界面上的 4 步 */
|
||||
export const CHECK_STEPS: readonly { label: string; stages: readonly string[] }[] = [
|
||||
{ label: "读取投标文件", stages: ["prepare_bid"] },
|
||||
{ label: "逐条找响应", stages: ["match"] },
|
||||
{ label: "核对出处", stages: ["rules", "verify"] },
|
||||
{ label: "沿用处理状态、汇总", stages: ["carry_over", "summarize"] },
|
||||
];
|
||||
export const checkStepIndex = (stage: string | null | undefined) =>
|
||||
stage ? CHECK_STEPS.findIndex((s) => s.stages.includes(stage)) : -1;
|
||||
|
||||
export const VOLUME_KIND: Dict<Schemas["VolumeKind"]> = {
|
||||
whole: "整本",
|
||||
qualification: "资格证明",
|
||||
commercial: "商务",
|
||||
technical: "技术",
|
||||
price: "报价",
|
||||
other: "其他",
|
||||
};
|
||||
export const VOLUME_KINDS = Object.keys(VOLUME_KIND) as Schemas["VolumeKind"][];
|
||||
|
||||
/** 级别(§7.5):样式类沿用设计规范的 fatal / major / hint */
|
||||
export const SEVERITY: Dict<Schemas["Severity"]> = { fatal: "致命", important: "重要", hint: "提示" };
|
||||
export const SEVERITY_CLASS: Dict<Schemas["Severity"]> = { fatal: "fatal", important: "major", hint: "hint" };
|
||||
export const FINDING_ACTION: Dict<Schemas["FindingStatus"]> = {
|
||||
pending: "待处理",
|
||||
confirmed_ok: "确认无误",
|
||||
modified: "已修改",
|
||||
ignored: "已忽略",
|
||||
};
|
||||
|
||||
export const READY_TIP = "只表示致命问题都已处理,不代表投标文件没有问题。";
|
||||
|
||||
/* ---------- 时间 ---------- */
|
||||
|
||||
@@ -21,6 +21,10 @@ export type ChecklistItem = Schemas["ChecklistItem"] & Required<Pick<Schemas["Ch
|
||||
export type Citation = Schemas["Citation"];
|
||||
export type MarkingRule = Schemas["MarkingRule"];
|
||||
export type SessionInfo = Schemas["SessionInfo"];
|
||||
export type CheckPreview = Schemas["CheckPreview"];
|
||||
export type CheckRun = Schemas["CheckRun"];
|
||||
export type Finding = Schemas["Finding"];
|
||||
export type CheckItemResult = Schemas["CheckItemResult"];
|
||||
|
||||
export const fetchMe = () => unwrap(api.GET("/me"));
|
||||
|
||||
@@ -90,3 +94,41 @@ export function useChecklistItems(projectId: MaybeRefOrGetter<string>) {
|
||||
}>,
|
||||
});
|
||||
}
|
||||
|
||||
export function useProjectDocuments(projectId: MaybeRefOrGetter<string>) {
|
||||
return useQuery({
|
||||
queryKey: computed(() => qk.projectDocuments(toValue(projectId))),
|
||||
queryFn: () => unwrap(api.GET("/projects/{project_id}/documents", { params: { path: { project_id: toValue(projectId) } } })),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCheckPreview(projectId: MaybeRefOrGetter<string>) {
|
||||
return useQuery({
|
||||
queryKey: computed(() => qk.checkPreview(toValue(projectId))),
|
||||
queryFn: () => unwrap(api.GET("/projects/{project_id}/check-preview", { params: { path: { project_id: toValue(projectId) } } })),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCheckRuns(projectId: MaybeRefOrGetter<string>) {
|
||||
return useQuery({
|
||||
queryKey: computed(() => qk.checkRuns(toValue(projectId))),
|
||||
queryFn: () => unwrap(api.GET("/projects/{project_id}/check-runs", { params: { path: { project_id: toValue(projectId) } } })),
|
||||
});
|
||||
}
|
||||
|
||||
/** 检查进度:和解析一样,事件流推送为主、每 5 秒轮询兜底,结束后停止轮询。 */
|
||||
export function useCheckRun(id: MaybeRefOrGetter<string>) {
|
||||
return useQuery({
|
||||
queryKey: computed(() => qk.checkRun(toValue(id))),
|
||||
queryFn: () => unwrap(api.GET("/check-runs/{run_id}", { params: { path: { run_id: toValue(id) } } })),
|
||||
refetchInterval: (query) => (query.state.data && TERMINAL_JOB.has(query.state.data.status) ? false : 5000),
|
||||
});
|
||||
}
|
||||
|
||||
export function useFindings(runId: MaybeRefOrGetter<string>, enabled: MaybeRefOrGetter<boolean>) {
|
||||
return useQuery({
|
||||
queryKey: computed(() => qk.findings(toValue(runId))),
|
||||
queryFn: () => unwrap(api.GET("/check-runs/{run_id}/findings", { params: { path: { run_id: toValue(runId) } } })),
|
||||
enabled: computed(() => toValue(enabled)),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user