Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(acceptance): screenshot attachments in feedback, decision-bar redesign & frosted dialogs (#17303)

Arvin Xu306e971505f4
diff --git a/apps/cli/src/commands/verify.ts b/apps/cli/src/commands/verify.ts
index ea347a852bb..29f18ee8521 100644
--- a/apps/cli/src/commands/verify.ts
+++ b/apps/cli/src/commands/verify.ts
@@ -523,7 +523,8 @@ export function registerVerifyCommand(program: Command) {
.description('Manage the Agent Run delivery checker (criteria, rubrics, plans, results)');
// `verify acceptance …` — subject-level acceptance aggregates.
- registerAcceptanceCommands(verify);
+ // Legacy spelling — the canonical group is the first-class `lh acceptance`.
+ registerAcceptanceCommands(verify, { deprecated: true });
// `verify install` — install the bundled agent-testing skill from this CLI
// package into the consumer repo. Distinct from `verify init` below, which
diff --git a/apps/cli/src/commands/verifyAcceptance.ts b/apps/cli/src/commands/verifyAcceptance.ts
index 5a880455ede..c1ba5ec7975 100644
--- a/apps/cli/src/commands/verifyAcceptance.ts
+++ b/apps/cli/src/commands/verifyAcceptance.ts
@@ -48,11 +48,19 @@ const userGlyph = (userReview?: { action: string; stale: boolean } | null): stri
return userReview.stale ? pc.dim('· pending') : pc.red('✗ rejected');
};
-export function registerAcceptanceCommands(verify: Command) {
- const acceptance = verify
+/**
+ * The acceptance command set. Registered twice: as the first-class
+ * `lh acceptance` (the canonical spelling — the acceptance is the human-review
+ * loop's front door, not a verify implementation detail) and as the legacy
+ * `lh verify acceptance` alias existing docs/skills still reference.
+ */
+export function registerAcceptanceCommands(parent: Command, options?: { deprecated?: boolean }) {
+ const acceptance = parent
.command('acceptance')
.description(
- 'Manage subject-level delivery acceptances (the cross-round union of verify sessions)',
+ options?.deprecated
+ ? 'Deprecated alias — use `lh acceptance`'
+ : 'Delivery acceptances: the cross-round review loop (checks, feedback, decision)',
);
acceptance
@@ -164,6 +172,108 @@ export function registerAcceptanceCommands(verify: Command) {
);
});
+ acceptance
+ .command('feedback <idOrSubject>')
+ .description(
+ "The user's review feedback — check rejects (with region notes & attachments) plus group-scoped notes",
+ )
+ .option('--actionable', 'Only standing feedback the next repair round must act on')
+ .option('--json [fields]', 'Output JSON')
+ .action(
+ async (idOrSubject: string, options: { actionable?: boolean; json?: boolean | string }) => {
+ const id = await resolveAcceptanceId(idOrSubject);
+ const client = await getTrpcClient();
+ const bundle = await client.acceptance.getBundle.query({ id });
+
+ const currentRoundIndex = bundle.rounds.at(-1)?.run.roundIndex ?? 0;
+
+ interface FeedbackEntry {
+ actionable: boolean;
+ annotations?: { comment?: string }[];
+ category?: string;
+ checkId?: string;
+ checkSeq?: number;
+ comment: string;
+ createdAt?: string;
+ fileIds?: string[];
+ kind: 'check' | 'group';
+ roundIndex: number;
+ title?: string;
+ }
+
+ const entries: FeedbackEntry[] = [];
+ for (const check of bundle.checks) {
+ for (const review of check.reviews) {
+ if (review.action !== 'reject') continue;
+ // Standing = this reject is the check's latest verdict and no newer
+ // round has consumed it yet.
+ const standing = Boolean(
+ check.userReview &&
+ check.userReview.action === 'reject' &&
+ !check.userReview.stale &&
+ check.reviews.at(-1) === review,
+ );
+ entries.push({
+ actionable: standing,
+ annotations: review.annotations?.map((a) => ({ comment: a.comment })),
+ checkId: check.id,
+ checkSeq: check.seq,
+ comment: review.comment ?? '',
+ createdAt: review.createdAt,
+ fileIds: review.fileIds,
+ kind: 'check',
+ roundIndex: review.roundIndex,
+ title: check.title,
+ });
+ }
+ }
+ for (const round of bundle.rounds) {
+ for (const entry of round.run.decisionDetail?.groupFeedback ?? []) {
+ const roundIndex = round.run.roundIndex ?? 0;
+ entries.push({
+ actionable: roundIndex >= currentRoundIndex,
+ category: entry.category,
+ comment: entry.comment,
+ createdAt: entry.createdAt,
+ fileIds: entry.fileIds,
+ kind: 'group',
+ roundIndex,
+ });
+ }
+ }
+ entries.sort((a, b) => (b.createdAt ?? '').localeCompare(a.createdAt ?? ''));
+
+ const shown = options.actionable ? entries.filter((entry) => entry.actionable) : entries;
+
+ if (options.json !== undefined) {
+ outputJson(
+ { acceptanceId: id, currentRoundIndex, entries: shown },
+ typeof options.json === 'string' ? options.json : undefined,
+ );
+ return;
+ }
+
+ if (shown.length === 0) {
+ console.log(pc.dim(options.actionable ? 'No actionable feedback.' : 'No feedback yet.'));
+ return;
+ }
+ for (const entry of shown) {
+ const marker = entry.actionable ? pc.red('▶ actionable') : pc.dim('· addressed');
+ const label =
+ entry.kind === 'check'
+ ? `C${entry.checkSeq} ${truncate(entry.title ?? '', 60)}`
+ : `group · ${entry.category || 'overall'}`;
+ console.log(`${marker} ${label} ${pc.dim(`(r${entry.roundIndex})`)}`);
+ if (entry.comment) console.log(` ${entry.comment}`);
+ for (const annotation of entry.annotations ?? []) {
+ if (annotation.comment) console.log(` ${pc.dim('region:')} ${annotation.comment}`);
+ }
+ if (entry.fileIds?.length)
+ console.log(` ${pc.dim(`attachments: ${entry.fileIds.join(', ')}`)}`);
+ }
+ },
+ );
+
acceptance
.command('accept <idOrSubject>')
.description('Accept the delivery — the terminal user decision that closes the acceptance')
diff --git a/apps/cli/src/program.ts b/apps/cli/src/program.ts
index 8ef7fee141c..6b523fe94a3 100644
--- a/apps/cli/src/program.ts
+++ b/apps/cli/src/program.ts
@@ -34,6 +34,7 @@ import { registerTopicCommand } from './commands/topic';
import { registerUpdateCommand } from './commands/update';
import { registerUserCommand } from './commands/user';
import { registerVerifyCommand } from './commands/verify';
+import { registerAcceptanceCommands } from './commands/verifyAcceptance';
import { cliVersion } from './pkg';
import { executeToolCall } from './tools';
@@ -96,6 +97,8 @@ export function createProgram() {
registerPluginCommand(program);
registerUserCommand(program);
registerVerifyCommand(program);
+ // First-class review-loop entry: `lh acceptance list|view|feedback|accept|reject`.
+ registerAcceptanceCommands(program);
registerConfigCommand(program);
registerEvalCommand(program);
registerMigrateCommand(program);
diff --git a/apps/server/src/routers/lambda/acceptance.ts b/apps/server/src/routers/lambda/acceptance.ts
index 095fc284cca..b15ce3fa6a5 100644
--- a/apps/server/src/routers/lambda/acceptance.ts
+++ b/apps/server/src/routers/lambda/acceptance.ts
@@ -3,6 +3,7 @@ import {
acceptanceSubjectTypes,
acceptanceVisibilities,
} from '@lobechat/const/verify';
+import type { AcceptanceAttachment } from '@lobechat/types';
import { TRPCError } from '@trpc/server';
import { eq } from 'drizzle-orm';
import { z } from 'zod';
@@ -229,6 +230,30 @@ export const acceptanceRouter = router({
evidenceByResult.set(e.checkResultId, bucket);
}
+ // Resolve the files backing user feedback (uploaded/pasted screenshots)
+ // to URLs with the same owner-scoped resolver the evidence uses — one
+ // batch for every attachment id across check rejects and group feedback.
+ const attachmentIds = new Set<string>();
+ for (const result of results)
+ for (const id of result.userDecisionDetail?.fileIds ?? []) attachmentIds.add(id);
+ for (const run of runs)
+ for (const entry of run.decisionDetail?.groupFeedback ?? [])
+ for (const id of entry.fileIds ?? []) attachmentIds.add(id);
+ const attachmentById = new Map<string, AcceptanceAttachment>();
+ await Promise.all(
+ [...attachmentIds].map(async (id) => {
+ const meta = await resolveFileMeta(id);
+ attachmentById.set(id, { id, name: meta.fileName ?? undefined, url: meta.fileUrl });
+ }),
+ );
+ const toAttachments = (fileIds?: string[]): AcceptanceAttachment[] | undefined => {
+ if (!fileIds?.length) return undefined;
+ const resolved = fileIds
+ .map((id) => attachmentById.get(id))
+ .filter((a): a is AcceptanceAttachment => Boolean(a));
+ return resolved.length > 0 ? resolved : undefined;
+ };
+
const reportsByRun = new Map(reports.map((r) => [r.verifyRunId!, r]));
const rounds = runs.map((run) => {
// `origin` points at the author's private topic/agent — never hand it
@@ -238,6 +263,20 @@ export const acceptanceRouter = router({
const { origin: _origin, ...publicMetadata } = run.metadata;
publicRun = { ...run, metadata: publicMetadata };
}
+ // Enrich group feedback with resolved attachment URLs for the client.
+ const groupFeedback = publicRun.decisionDetail?.groupFeedback;
+ if (groupFeedback?.some((entry) => entry.fileIds?.length)) {
+ publicRun = {
+ ...publicRun,
+ decisionDetail: {
+ ...publicRun.decisionDetail,
+ groupFeedback: groupFeedback.map((entry) => {
+ const attachments = toAttachments(entry.fileIds);
+ return attachments ? { ...entry, attachments } : entry;
+ }),
+ },
+ };
+ }
return { report: reportsByRun.get(run.id) ?? null, run: publicRun };
});
const latestReport = [...rounds].reverse().find((r) => r.report)?.report ?? null;
@@ -260,15 +299,25 @@ export const acceptanceRouter = router({
resultsById,
currentRoundIndex,
);
+ // The standing verdict mirrors the latest review — resolve its
+ // attachments too so the row's feedback card can render them.
+ const resolvedReviews = reviews.map((review) => {
+ const attachments = toAttachments(review.fileIds);
+ return attachments ? { ...review, attachments } : review;
+ });
+ const latestAttachments = toAttachments(reviews.at(-1)?.fileIds);
return {
...check,
evidence: check.result ? (evidenceByResult.get(check.result.id) ?? []) : [],
- reviews,
+ reviews: resolvedReviews,
timeline: check.timeline.map((entry) => ({
...entry,
evidence: evidenceByResult.get(entry.resultId) ?? [],
})),
- userReview,
+ userReview:
+ userReview && latestAttachments
+ ? { ...userReview, attachments: latestAttachments }
+ : userReview,
};
}),
latestReport,
@@ -293,6 +342,7 @@ export const acceptanceRouter = router({
z.object({
category: z.string().max(200),
comment: z.string().trim().min(1).max(2000),
+ fileIds: z.array(z.string()).max(10).optional(),
id: z.string(),
}),
)
@@ -317,6 +367,7 @@ export const acceptanceRouter = router({
category: input.category,
comment: input.comment,
createdAt: new Date().toISOString(),
+ ...(input.fileIds?.length ? { fileIds: input.fileIds } : {}),
};
await new VerifyRunModel(
ctx.serverDB,
@@ -355,15 +406,17 @@ export const acceptanceRouter = router({
.optional(),
checkItemIds: z.array(z.string()).min(1).max(200),
comment: z.string().max(2000).optional(),
+ fileIds: z.array(z.string()).max(10).optional(),
id: z.string(),
})
- // A reject IS its feedback — without a note (either global or on an
- // annotated region) the next round has nothing to act on.
+ // A reject IS its feedback — without a note (global, on an annotated
+ // region, or a screenshot attachment) the next round has nothing to act on.
.refine(
(value) =>
value.action !== 'reject' ||
Boolean(value.comment?.trim()) ||
- Boolean(value.annotations?.some((annotation) => annotation.comment?.trim())),
+ Boolean(value.annotations?.some((annotation) => annotation.comment?.trim())) ||
+ Boolean(value.fileIds?.length),
{ message: 'Rejecting a check requires a comment' },
),
)
@@ -377,6 +430,7 @@ export const acceptanceRouter = router({
annotations: input.annotations,
checkItemIds: input.checkItemIds,
comment: input.comment?.trim() || undefined,
+ fileIds: input.fileIds,
});
} catch (error) {
throw new TRPCError({
@@ -411,6 +465,27 @@ export const acceptanceRouter = router({
return updated;
}),
+ /**
+ * The user sent the delivery back for a repair round (the in-app 打回重跑
+ * dispatch). Stamps the aggregate `repairing` so every surface reflects the
+ * send-back immediately; the next round's ingest recomputes the status from
+ * real run state, so a stale stamp cannot stick.
+ */
+ markRepairing: acceptanceWriteProcedure
+ .input(z.object({ id: z.string() }))
+ .mutation(async ({ ctx, input }) => {
+ const acceptance = await resolveAcceptance(ctx, input.id);
+ assertWorkspaceRowManageable(ctx, acceptance.userId, 'acceptance');
+
+ if (acceptance.status !== 'delivered' && acceptance.status !== 'errored') {
+ throw new TRPCError({
+ code: 'BAD_REQUEST',
+ message: `Only a settled acceptance can be sent back (status: ${acceptance.status})`,
+ });
+ }
+ return ctx.acceptanceService.acceptanceModel.updateStatus(acceptance.id, 'repairing');
+ }),
+
/**
* The user rejects the delivery. The comment is a re-tasking input: it is
* recorded on the current round's decision and seeds the next repair/verify
diff --git a/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts b/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts
index 8d53483a2ab..94587e4ab7d 100644
--- a/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts
+++ b/apps/server/src/services/verify/__tests__/checkReviewOverlay.test.ts
@@ -118,6 +118,26 @@ describe('buildCheckReviewOverlay', () => {
expect(overlay.userReview).toMatchObject({ action: 'reject', roundIndex: 2, stale: false });
});
+ it('surfaces the reject attachment fileIds so the bundle can resolve them to URLs', () => {
+ const withShots = result('r1', {
+ userDecision: 'rejected',
+ userDecisionDetail: {
+ comment: 'see the screenshots',
+ decidedAt: '2026-07-16T01:00:00.000Z',
+ fileIds: ['file-a', 'file-b'],
+ },
+ });
+ const overlay = buildCheckReviewOverlay(
+ { timeline: [timelineEntry('r1', 1)] },
+ byId(withShots),
+ 1,
+ );
+ // The overlay carries the raw ids on the trail; the bundle read resolves
+ // them to URLs (userReview.attachments) off this latest review.
+ expect(overlay.reviews[0].fileIds).toEqual(['file-a', 'file-b']);
+ expect(overlay.userReview).toMatchObject({ action: 'reject', roundIndex: 1 });
+ });
+
it('carries annotations and falls back to row timestamps for legacy decisions', () => {
const annotated = result('r1', {
userDecision: 'rejected',
diff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.ts
index 35bd5b216c2..78446f50df6 100644
--- a/apps/server/src/services/verify/acceptanceService.ts
+++ b/apps/server/src/services/verify/acceptanceService.ts
@@ -1,5 +1,6 @@
import { normalizeVerifySurface } from '@lobechat/const/verify';
import type {
+ AcceptanceAttachment,
AcceptanceCheckReviewAction,
AcceptanceReviewAnnotation,
AcceptanceStatus,
@@ -255,6 +256,8 @@ export const buildAcceptanceCheckUnion = (rounds: RoundInput[]): AcceptanceCheck
export interface AcceptanceCheckUserReview {
action: AcceptanceCheckReviewAction;
annotations?: AcceptanceReviewAnnotation[];
+ /** Attachments backing a reject, resolved to URLs by the bundle read. */
+ attachments?: AcceptanceAttachment[];
comment?: string;
createdAt: string;
roundIndex: number;
@@ -274,9 +277,13 @@ export interface AcceptanceCheckUserReview {
export interface AcceptanceCheckReviewEvent {
action: AcceptanceCheckReviewAction;
annotations?: AcceptanceReviewAnnotation[];
+ /** Attachments backing the reject, resolved to URLs by the bundle read. */
+ attachments?: AcceptanceAttachment[];
comment?: string;
/** When the decision was made (ISO 8601; falls back to the row's timestamps). */
createdAt: string;
+ /** Uploaded/pasted screenshots backing the reject (FKs to files). */
+ fileIds?: string[];
/** The result row the decision is stamped on. */
id: string;
roundIndex: number;
@@ -310,6 +317,7 @@ export const buildCheckReviewOverlay = (
annotations: detail?.annotations,
comment: detail?.comment,
createdAt: detail?.decidedAt ?? (result.completedAt ?? result.createdAt)?.toISOString() ?? '',
+ fileIds: detail?.fileIds,
id: result.id,
// A carried-forward check is judged at the CURRENT round even though its
// evidence row belongs to an older one — the detail records that round.
@@ -545,6 +553,7 @@ export class AcceptanceService {
annotations?: AcceptanceReviewAnnotation[];
checkItemIds: string[];
comment?: string;
+ fileIds?: string[];
},
): Promise<{ resultIds: string[] }> => {
const acceptance = await this.acceptanceModel.findById(acceptanceId);
@@ -595,6 +604,7 @@ export class AcceptanceService {
roundIndex: currentRoundIndex,
...(input.comment ? { comment: input.comment } : {}),
...(input.annotations?.length ? { annotations: input.annotations } : {}),
+ ...(input.fileIds?.length ? { fileIds: input.fileIds } : {}),
};
await Promise.all(
diff --git a/apps/server/src/services/verify/evidenceFiles.ts b/apps/server/src/services/verify/evidenceFiles.ts
index f34c4ed737a..6f224a1fbe2 100644
--- a/apps/server/src/services/verify/evidenceFiles.ts
+++ b/apps/server/src/services/verify/evidenceFiles.ts
@@ -3,10 +3,18 @@ import type { LobeChatDatabase } from '@/database/type';
import { FileService } from '@/server/services/file';
export interface EvidenceFileMeta {
+ /** Intrinsic image height (px) from the upload's stored metadata, when known. */
+ fileHeight: number | null;
fileName: string | null;
fileUrl: string | null;
+ /** Intrinsic image width (px) — lets the client reserve the aspect ratio
+ before the image loads, so expanding a row never jumps in height. */
+ fileWidth: number | null;
}
+const dimension = (value: unknown): number | null =>
+ typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null;
+
/**
* Display metadata for file-backed evidence artifacts (name + full/signed URL).
*
@@ -35,25 +43,39 @@ export const createEvidenceFileResolver = (
};
return async (fileId: string | null): Promise<EvidenceFileMeta> => {
- if (!fileId) return { fileName: null, fileUrl: null };
+ const empty: EvidenceFileMeta = {
+ fileHeight: null,
+ fileName: null,
+ fileUrl: null,
+ fileWidth: null,
+ };
+ if (!fileId) return empty;
try {
const file = await FileModel.getFileById(db, fileId);
- if (!file) return { fileName: null, fileUrl: null };
- if (!file.url) return { fileName: file.name ?? null, fileUrl: null };
+ if (!file) return empty;
+
+ const metadata = file.metadata as { height?: unknown; width?: unknown } | null;
+ const base: EvidenceFileMeta = {
+ fileHeight: dimension(metadata?.height),
+ fileName: file.name ?? null,
+ fileUrl: null,
+ fileWidth: dimension(metadata?.width),
+ };
+ if (!file.url) return base;
const service = getFileService();
- if (!service) return { fileName: file.name ?? null, fileUrl: null };
+ if (!service) return base;
try {
- return { fileName: file.name ?? null, fileUrl: await service.getFullFileUrl(file.url) };
+ return { ...base, fileUrl: await service.getFullFileUrl(file.url) };
} catch (error) {
console.error('[verify:getReportBundle:resolveFileMeta]', error);
- return { fileName: file.name ?? null, fileUrl: null };
+ return base;
}
} catch (error) {
console.error('[verify:getReportBundle:resolveFileMeta]', error);
- return { fileName: null, fileUrl: null };
+ return empty;
}
};
};
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index 3c0079ff096..4150c4daa54 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -7,6 +7,8 @@
"acceptance.actions.cancel": "Cancel",
"acceptance.actions.confirmAccept": "Confirm acceptance",
"acceptance.actions.confirmReject": "Reject and start the next round",
+ "acceptance.actions.more": "More actions",
+ "acceptance.actions.refresh": "Refresh",
"acceptance.actions.reject": "Reject delivery",
"acceptance.banner.accepted": "Accepted · confirmed by you at {{time}}",
"acceptance.banner.acceptedHint": "{{count}} verification round(s) archived as the acceptance record",
@@ -17,7 +19,15 @@
"acceptance.banner.rejected": "Rejected",
"acceptance.banner.rejectedHint": "The next verification round re-opens this acceptance when it lands.",
"acceptance.banner.rejectedReason": "Reason: {{reason}}",
+ "acceptance.bar.copied": "Copied — paste it to any agent to start the repair.",
+ "acceptance.bar.copyReview": "Copy review prompt",
"acceptance.bar.feedback": "Feedback {{count}}",
+ "acceptance.bar.progress": "Confirmed {{done}} / {{total}} checks — {{rest}} awaiting your review",
+ "acceptance.bar.progressDone": "All {{total}} checks confirmed — ready to accept",
+ "acceptance.bar.progressZero": "{{total}} checks awaiting your review",
+ "acceptance.bar.rejectComment": "Reject with comment",
+ "acceptance.bar.rerun": "Send back & rerun",
+ "acceptance.bar.rerunSent": "Sent to the origin conversation — the repair round is starting.",
"acceptance.checks.copied": "Copied",
"acceptance.checks.copySeq": "Copy the check label",
"acceptance.checks.finalRoundHint": "The final result and evidence come from this round — click to locate it.",
@@ -60,7 +70,7 @@
"acceptance.group.failedCount": "{{count}} failing",
"acceptance.group.feedbackAction": "Add group feedback",
"acceptance.group.feedbackDescription": "Feedback on “{{label}}” as a whole — for concerns no single check covers. The next verification round reads it.",
- "acceptance.group.feedbackLabel": "Group feedback · round {{round}}",
+ "acceptance.group.feedbackLabel": "Group feedback",
"acceptance.group.feedbackPlaceholder": "What should change about this area, and what do you expect…",
"acceptance.group.feedbackSubmit": "Submit feedback",
"acceptance.group.feedbackTitle": "Group feedback",
@@ -91,9 +101,14 @@
"acceptance.review.annotate": "Circle regions on the evidence",
"acceptance.review.annotateHint": "Drag on the image to circle a region, then leave a note for it.",
"acceptance.review.annotationPlaceholder": "What is wrong in region {{index}}…",
+ "acceptance.review.attach": "Attach screenshot",
+ "acceptance.review.attachFailed": "Screenshot upload failed — please try again.",
+ "acceptance.review.attachLimit": "Up to {{count}} screenshots.",
+ "acceptance.review.attachTooLarge": "The image is too large (10MB max).",
"acceptance.review.confirmReject": "Submit feedback",
- "acceptance.review.feedbackLabel": "Your feedback · round {{round}}",
+ "acceptance.review.feedbackLabel": "Feedback",
"acceptance.review.fullscreen": "Annotate fullscreen",
+ "acceptance.review.fullscreenDone": "Done annotating",
"acceptance.review.regionComments": "Region comments",
"acceptance.review.regionCommentsEmpty": "Drag on the image to circle a region — its comment lands here.",
"acceptance.review.reject": "Reject with comment",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 8d7012cc0cf..5dc99dac3ef 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -7,6 +7,8 @@
"acceptance.actions.cancel": "取消",
"acceptance.actions.confirmAccept": "确认接受交付",
"acceptance.actions.confirmReject": "打回并发起下一轮",
+ "acceptance.actions.more": "更多操作",
+ "acceptance.actions.refresh": "刷新",
"acceptance.actions.reject": "打回交付",
"acceptance.banner.accepted": "已验收 · {{time}} 由你确认接受交付",
"acceptance.banner.acceptedHint": "{{count}} 轮验证记录已归档为验收依据",
@@ -17,7 +19,15 @@
"acceptance.banner.rejected": "已打回",
"acceptance.banner.rejectedHint": "下一轮验证完成后将重新回到待验收",
"acceptance.banner.rejectedReason": "打回意见:{{reason}}",
+ "acceptance.bar.copied": "已复制,粘贴给任意 agent 即可开始修复。",
+ "acceptance.bar.copyReview": "复制 review 建议",
"acceptance.bar.feedback": "反馈 {{count}}",
+ "acceptance.bar.progress": "已完成 {{done}} / {{total}} 项验证项,剩余 {{rest}} 项等待你的验收",
+ "acceptance.bar.progressDone": "{{total}} 项验证项已全部确认,可以接受交付",
+ "acceptance.bar.progressZero": "共 {{total}} 项等待你的验收",
+ "acceptance.bar.rejectComment": "评论并打回",
+ "acceptance.bar.rerun": "打回重跑",
+ "acceptance.bar.rerunSent": "已发送到源会话,修复轮次启动中。",
"acceptance.checks.copied": "已复制",
"acceptance.checks.copySeq": "复制检查项序号",
"acceptance.checks.finalRoundHint": "最终结果与证据来自该轮,点击查看",
@@ -60,7 +70,7 @@
"acceptance.group.failedCount": "{{count}} 未通过",
"acceptance.group.feedbackAction": "补充分组反馈",
"acceptance.group.feedbackDescription": "针对「{{label}}」整组的补充反馈——用于不属于任何单个检查项的问题,下一轮验证会读取。",
- "acceptance.group.feedbackLabel": "分组反馈 · 第 {{round}} 轮",
+ "acceptance.group.feedbackLabel": "分组反馈",
"acceptance.group.feedbackPlaceholder": "这一块整体有什么问题、你期望的是什么…",
"acceptance.group.feedbackSubmit": "提交反馈",
"acceptance.group.feedbackTitle": "分组反馈",
@@ -91,9 +101,14 @@
"acceptance.review.annotate": "在截图上圈选评论",
"acceptance.review.annotateHint": "在图片上拖拽画框圈出区域,并为该区域留下评论。",
"acceptance.review.annotationPlaceholder": "区域 {{index}} 的问题…",
+ "acceptance.review.attach": "添加截图",
+ "acceptance.review.attachFailed": "截图上传失败,请重试。",
+ "acceptance.review.attachLimit": "最多添加 {{count}} 张截图。",
+ "acceptance.review.attachTooLarge": "图片过大(最大 10MB)。",
"acceptance.review.confirmReject": "提交反馈",
- "acceptance.review.feedbackLabel": "你的反馈 · 第 {{round}} 轮",
+ "acceptance.review.feedbackLabel": "反馈",
"acceptance.review.fullscreen": "全屏标注",
+ "acceptance.review.fullscreenDone": "完成标注",
"acceptance.review.regionComments": "圈选评论",
"acceptance.review.regionCommentsEmpty": "在左侧图片上拖拽圈出区域,评论会出现在这里。",
"acceptance.review.reject": "拒绝并评论",
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index 8bffb17bcef..fa69f533a0a 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -8,6 +8,8 @@ export default {
'acceptance.actions.accept': 'Accept delivery',
'acceptance.actions.cancel': 'Cancel',
'acceptance.actions.confirmAccept': 'Confirm acceptance',
+ 'acceptance.actions.more': 'More actions',
+ 'acceptance.actions.refresh': 'Refresh',
'acceptance.actions.confirmReject': 'Reject and start the next round',
'acceptance.actions.reject': 'Reject delivery',
'acceptance.banner.accepted': 'Accepted · confirmed by you at {{time}}',
@@ -24,7 +26,16 @@ export default {
'acceptance.banner.rejectedHint':
'The next verification round re-opens this acceptance when it lands.',
'acceptance.banner.rejectedReason': 'Reason: {{reason}}',
+ 'acceptance.bar.copied': 'Copied — paste it to any agent to start the repair.',
+ 'acceptance.bar.copyReview': 'Copy review prompt',
'acceptance.bar.feedback': 'Feedback {{count}}',
+ 'acceptance.bar.progress':
+ 'Confirmed {{done}} / {{total}} checks — {{rest}} awaiting your review',
+ 'acceptance.bar.progressDone': 'All {{total}} checks confirmed — ready to accept',
+ 'acceptance.bar.progressZero': '{{total}} checks awaiting your review',
+ 'acceptance.bar.rejectComment': 'Reject with comment',
+ 'acceptance.bar.rerun': 'Send back & rerun',
+ 'acceptance.bar.rerunSent': 'Sent to the origin conversation — the repair round is starting.',
'acceptance.checks.copied': 'Copied',
'acceptance.checks.copySeq': 'Copy the check label',
'acceptance.checks.finalRoundHint':
@@ -72,7 +83,7 @@ export default {
'acceptance.group.feedbackAction': 'Add group feedback',
'acceptance.group.feedbackDescription':
'Feedback on “{{label}}” as a whole — for concerns no single check covers. The next verification round reads it.',
- 'acceptance.group.feedbackLabel': 'Group feedback · round {{round}}',
+ 'acceptance.group.feedbackLabel': 'Group feedback',
'acceptance.group.feedbackPlaceholder':
'What should change about this area, and what do you expect…',
'acceptance.group.feedbackSubmit': 'Submit feedback',
@@ -106,9 +117,14 @@ export default {
'acceptance.review.annotateHint':
'Drag on the image to circle a region, then leave a note for it.',
'acceptance.review.annotationPlaceholder': 'What is wrong in region {{index}}…',
+ 'acceptance.review.attach': 'Attach screenshot',
+ 'acceptance.review.attachFailed': 'Screenshot upload failed — please try again.',
+ 'acceptance.review.attachLimit': 'Up to {{count}} screenshots.',
+ 'acceptance.review.attachTooLarge': 'The image is too large (10MB max).',
'acceptance.review.confirmReject': 'Submit feedback',
- 'acceptance.review.feedbackLabel': 'Your feedback · round {{round}}',
+ 'acceptance.review.feedbackLabel': 'Feedback',
'acceptance.review.fullscreen': 'Annotate fullscreen',
+ 'acceptance.review.fullscreenDone': 'Done annotating',
'acceptance.review.regionComments': 'Region comments',
'acceptance.review.regionCommentsEmpty':
'Drag on the image to circle a region — its comment lands here.',
diff --git a/packages/types/src/verify.ts b/packages/types/src/verify.ts
index d832545bf78..8008bdc1b15 100644
--- a/packages/types/src/verify.ts
+++ b/packages/types/src/verify.ts
@@ -99,6 +99,20 @@ export interface AcceptanceConfig {
verifyRubricId?: string;
}
+/**
+ * A file the user attached to their feedback (an uploaded/pasted screenshot),
+ * resolved to a display URL. The stored form is a bare `fileId` on the decision
+ * detail; this is the enriched view the acceptance page renders, produced by the
+ * bundle read (which resolves the id to a signed URL as the aggregate's owner).
+ */
+export interface AcceptanceAttachment {
+ id: string;
+ /** Original file name, when known. */
+ name?: string;
+ /** Resolved (possibly signed) URL — null when the file no longer resolves. */
+ url: string | null;
+}
+
/**
* User feedback addressed to a check GROUP (business category) rather than any
* single check — the "this concern doesn't belong to a check I could reject"
@@ -108,11 +122,15 @@ export interface AcceptanceConfig {
* newer round lands) applies structurally.
*/
export interface AcceptanceGroupFeedback {
+ /** Attachments backing the feedback, resolved to URLs by the bundle read. */
+ attachments?: AcceptanceAttachment[];
/** The group's category label ('' targets the uncategorized bucket). */
category: string;
comment: string;
/** When the feedback was written (ISO 8601). */
createdAt: string;
+ /** Uploaded/pasted screenshots backing the feedback (FKs to files). */
+ fileIds?: string[];
/** The round the feedback was addressed to — its run's own round index. */
roundIndex: number;
}
@@ -160,6 +178,8 @@ export interface VerifyCheckDecisionDetail {
decidedAt?: string;
/** Who made the decision (user id) — set when it may differ from the row owner. */
decidedBy?: string;
+ /** Uploaded/pasted screenshots backing the reject (FKs to files). */
+ fileIds?: string[];
/**
* The acceptance round that was CURRENT when the decision was made. A
* carried-forward check's result row belongs to an older round, so the
diff --git a/src/features/Portal/Acceptance/Header.tsx b/src/features/Portal/Acceptance/Header.tsx
index 8c830e13500..b415a8309ad 100644
--- a/src/features/Portal/Acceptance/Header.tsx
+++ b/src/features/Portal/Acceptance/Header.tsx
@@ -1,13 +1,16 @@
import { DESKTOP_HEADER_ICON_SMALL_SIZE, isDesktop } from '@lobechat/const';
-import { ActionIcon, copyToClipboard, Flexbox } from '@lobehub/ui';
+import { ActionIcon, copyToClipboard, Flexbox, Icon } from '@lobehub/ui';
+import { type DropdownItem, DropdownMenu } from '@lobehub/ui/base-ui';
import { App } from 'antd';
-import { Copy, ExternalLink } from 'lucide-react';
+import { Copy, ExternalLink, MoreHorizontal, RefreshCw } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';
import { useAppOrigin } from '@/hooks/useAppOrigin';
+import { mutate as globalMutate } from '@/libs/swr';
+import { verifyKeys } from '@/libs/swr/keys';
import { electronSystemService } from '@/services/electron/system';
import { useChatStore } from '@/store/chat';
import { chatPortalSelectors } from '@/store/chat/selectors';
@@ -28,38 +31,68 @@ const AcceptanceHeader = memo(() => {
// Without an origin the URL is relative — the system browser has nothing to resolve it against.
const externalUrl = appOrigin && pageUrl ? pageUrl : undefined;
+ // Secondary actions live behind the title's `…` — the header's right side
+ // stays for the portal chrome (open external / close).
+ const menuItems: DropdownItem[] = [
+ {
+ disabled: !pageUrl,
+ icon: <Icon icon={Copy} />,
+ key: 'copy-link',
+ label: t('report.actions.copyLink'),
+ onClick: async () => {
+ if (!pageUrl) return;
+ await copyToClipboard(pageUrl);
+ message.success(t('report.actions.copyLinkSuccess'));
+ },
+ },
+ {
+ disabled: !acceptanceId,
+ icon: <Icon icon={RefreshCw} />,
+ key: 'refresh',
+ label: t('acceptance.actions.refresh'),
+ onClick: () => {
+ if (!acceptanceId) return;
+ void globalMutate(verifyKeys.acceptanceBundle(acceptanceId));
+ },
+ },
+ ];
+
return (
<Header
- title={<Title />}
rightExtra={
- <Flexbox horizontal gap={4}>
- <ActionIcon
- disabled={!pageUrl}
- icon={Copy}
- size={DESKTOP_HEADER_ICON_SMALL_SIZE}
- title={t('report.actions.copyLink')}
- onClick={async () => {
- if (!pageUrl) return;
- await copyToClipboard(pageUrl);
- message.success(t('report.actions.copyLinkSuccess'));
- }}
- />
- <ActionIcon
- disabled={!externalUrl}
- icon={ExternalLink}
- size={DESKTOP_HEADER_ICON_SMALL_SIZE}
- title={t('report.actions.openInBrowser')}
- onClick={() => {
- if (!externalUrl) return;
- // In Electron a `window.open` is denied by the window-open handler,
- // so hand the URL to the system browser through the main process.
- if (isDesktop) {
- void electronSystemService.openExternalLink(externalUrl);
- return;
- }
- window.open(externalUrl, '_blank', 'noopener,noreferrer');
- }}
- />
+ <ActionIcon
+ disabled={!externalUrl}
+ icon={ExternalLink}
+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}
+ title={t('report.actions.openInBrowser')}
+ onClick={() => {
+ if (!externalUrl) return;
+ // In Electron a `window.open` is denied by the window-open handler,
+ // so hand the URL to the system browser through the main process.
+ if (isDesktop) {
+ void electronSystemService.openExternalLink(externalUrl);
+ return;
+ }
+ window.open(externalUrl, '_blank', 'noopener,noreferrer');
+ }}
+ />
+ }
+ title={
+ <Flexbox horizontal align={'center'} gap={2} style={{ minWidth: 0 }}>
+ <Title />
+ <DropdownMenu
+ iconSpaceMode={'group'}
+ items={menuItems}
+ placement={'bottomLeft'}
+ popupProps={{ style: { minWidth: 140 } }}
+ >
+ <ActionIcon
+ icon={MoreHorizontal}
+ size={'small'}
+ style={{ flex: 'none' }}
+ title={t('acceptance.actions.more')}
+ />
+ </DropdownMenu>
</Flexbox>
}
/>
diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsx
index e9252dab92e..9a6f7a57acb 100644
--- a/src/features/Verify/Acceptance/CheckList.tsx
+++ b/src/features/Verify/Acceptance/CheckList.tsx
@@ -17,7 +17,6 @@ import {
Film,
HelpCircle,
Images,
- MessageSquarePlus,
MessageSquareText,
MessageSquareX,
Repeat,
@@ -33,6 +32,7 @@ import {
readEvidenceComparison,
} from '../components/EvidenceComparisonCard';
import { AnnotatedImage } from './Annotation';
+import { AttachmentThumbs } from './attachments';
import { openCheckRejectModal } from './CheckRejectModal';
import { openGroupFeedbackModal } from './modals';
@@ -47,6 +47,7 @@ export interface CheckReviewInput {
annotations?: AcceptanceReviewAnnotation[];
checkItemIds: string[];
comment?: string;
+ fileIds?: string[];
}
/** The user's standing verdict on a check — `pending` means "awaiting your confirmation". */
@@ -198,7 +199,7 @@ const styles = createStaticStyles(({ css }) => ({
font-family: ${cssVar.fontFamilyCode};
font-size: 11px;
- color: ${cssVar.colorTextQuaternary};
+ color: ${cssVar.colorTextSecondary};
letter-spacing: 0.02em;
`,
seqChipClickable: css`
@@ -275,6 +276,13 @@ const EVIDENCE_BADGES = [
const isFilename = (value: string | null | undefined) =>
!value || /^[\w.-]+\.(?:gif|jpe?g|mp4|png|webm|webp)$/i.test(value);
+/**
+ * Reserve the image's box before it loads — with the stored intrinsic size the
+ * layout never jumps when a row expands and its screenshots stream in.
+ */
+const imageRatio = (item: AcceptanceEvidence): string | undefined =>
+ item.fileWidth && item.fileHeight ? `${item.fileWidth} / ${item.fileHeight}` : undefined;
+
/** Flat media for a comparison side — the card frames it, so no own border/radius. */
const comparisonContent = (item: AcceptanceEvidence) =>
item.type === 'video' ? (
@@ -285,7 +293,7 @@ const comparisonContent = (item: AcceptanceEvidence) =>
alt={item.description ?? item.fileName ?? item.type}
loading={'lazy'}
src={item.fileUrl!}
- style={{ borderRadius: 0, width: '100%' }}
+ style={{ aspectRatio: imageRatio(item), borderRadius: 0, width: '100%' }}
variant={'borderless'}
/>
);
@@ -355,14 +363,29 @@ const EvidenceList = memo<{ evidence: AcceptanceEvidence[] }>(({ evidence }) =>
return (
<Flexbox gap={4} key={item.id} style={{ maxWidth: '100%', width: 'fit-content' }}>
{/* The frame owns the border — the inner Image must not draw its
- own, or the two 1px borders stack visibly. */}
- <Flexbox className={styles.evidenceImage}>
+ own, or the two 1px borders stack visibly. The frame also
+ reserves the aspect ratio so the row's height is settled
+ before the image loads (no expand jump). */}
+ <Flexbox
+ className={styles.evidenceImage}
+ style={
+ item.fileWidth && item.fileHeight
+ ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }
+ : undefined
+ }
+ >
<Image
alt={item.description ?? item.fileName ?? item.type}
loading={'lazy'}
src={item.fileUrl}
- style={{ borderRadius: 0, maxWidth: '100%' }}
variant={'borderless'}
+ style={{
+ borderRadius: 0,
+ maxWidth: '100%',
+ // Fill the ratio-reserving frame; without known dimensions
+ // the image keeps its intrinsic size (legacy evidence).
+ width: item.fileWidth && item.fileHeight ? '100%' : undefined,
+ }}
/>
</Flexbox>
{caption}
@@ -426,13 +449,14 @@ const FeedbackCard = memo<{
<Flexbox horizontal align={'center'} gap={6}>
<Icon color={cssVar.colorError} icon={MessageSquareX} size={13} />
<Text style={{ color: cssVar.colorError, fontSize: 12 }}>
- {t('acceptance.review.feedbackLabel', { round: review.roundIndex })}
+ {t('acceptance.review.feedbackLabel')}
</Text>
<Text fontSize={12} type={'secondary'}>
{dayjs(review.createdAt).format('MM-DD HH:mm')}
</Text>
</Flexbox>
{review.comment && <Text style={{ fontSize: 12 }}>{review.comment}</Text>}
+ <AttachmentThumbs attachments={review.attachments} />
{[...groups.entries()].map(([evidenceId, annotations]) => {
const evidence = evidenceById.get(evidenceId);
// The evidence may be gone (deleted round) — the notes stay readable.
@@ -447,9 +471,16 @@ const FeedbackCard = memo<{
return (
<AnnotatedImage
annotations={annotations}
- imageStyle={{ maxHeight: 240 }}
key={evidenceId}
src={evidence.fileUrl}
+ imageStyle={{
+ // Known dimensions reserve the box up front (explicit height +
+ // ratio-derived width) — no height jump when the row expands
+ // and the screenshot streams in.
+ aspectRatio: imageRatio(evidence),
+ height: evidence.fileHeight ? Math.min(evidence.fileHeight, 240) : undefined,
+ maxHeight: 240,
+ }}
/>
);
})}
@@ -643,12 +674,13 @@ const CheckRow = memo<{
evidence: check.evidence
.filter((item) => isVisual(item))
.map((item) => ({ fileUrl: item.fileUrl!, id: item.id })),
- onConfirm: ({ annotations, comment }) =>
+ onConfirm: ({ annotations, comment, fileIds }) =>
onReview({
action: 'reject',
annotations: annotations.length > 0 ? annotations : undefined,
checkItemIds: [check.id],
comment: comment || undefined,
+ fileIds: fileIds.length > 0 ? fileIds : undefined,
}),
});
@@ -781,37 +813,35 @@ const CheckRow = memo<{
</Tooltip>
) : null,
)}
+ {/* The iteration mark stays compact — [↻ N]; the words (verified N
+ rounds · introduced in round X) live in its tooltip. Clicking
+ jumps to the round the concern first appeared in. */}
{check.revisions > 1 && (
<Tooltip
- title={
+ title={[
check.titleChanged
- ? t('acceptance.checks.iteratedHint', { count: check.revisions })
- : t('acceptance.checks.rerunHint', { count: check.revisions })
- }
- >
- <span className={styles.chip}>
- <Icon icon={Repeat} size={10} />{' '}
- {check.titleChanged
? t('acceptance.checks.iterated', { count: check.revisions })
- : t('acceptance.checks.rerun', { count: check.revisions })}
+ : t('acceptance.checks.rerun', { count: check.revisions }),
+ check.resultRound !== undefined &&
+ check.resultRound !== null &&
+ check.introducedAtRound !== check.resultRound
+ ? t('acceptance.checks.introduced', { round: check.introducedAtRound })
+ : null,
+ ]
+ .filter(Boolean)
+ .join(' · ')}
+ >
+ <span
+ className={cx(styles.chip, styles.chipClickable)}
+ onClick={(event) => {
+ event.stopPropagation();
+ onRound(check.introducedAtRound);
+ }}
+ >
+ <Icon icon={Repeat} size={10} /> {check.revisions}
</span>
</Tooltip>
)}
- {check.resultRound !== undefined &&
- check.resultRound !== null &&
- check.introducedAtRound !== check.resultRound && (
- <Tooltip title={t('acceptance.checks.introducedHint')}>
- <span
- className={cx(styles.chip, styles.chipClickable)}
- onClick={(event) => {
- event.stopPropagation();
- onRound(check.introducedAtRound);
- }}
- >
- {t('acceptance.checks.introduced', { round: check.introducedAtRound })}
- </span>
- </Tooltip>
- )}
{check.resultRound !== undefined && check.resultRound !== null && (
<Tooltip title={t('acceptance.checks.finalRoundHint')}>
<span
@@ -994,7 +1024,7 @@ interface CheckListProps {
/** Group-scoped feedback entries recorded on the aggregate. */
groupFeedback: AcceptanceGroupFeedback[];
/** Record group-scoped feedback; resolves true when the write landed. */
- onGroupFeedback: (category: string, comment: string) => Promise<boolean>;
+ onGroupFeedback: (category: string, comment: string, fileIds: string[]) => Promise<boolean>;
/** Record the user's verdict; resolves true when the write landed. */
onReview: (input: CheckReviewInput) => Promise<boolean>;
onRound: (round: number) => void;
@@ -1163,25 +1193,27 @@ const CheckList = memo<CheckListProps>(
{t('acceptance.review.acceptAllDone')}
</Flexbox>
))}
+ <Flexbox flex={1} />
{/* Group-scoped feedback — the channel for concerns that
- belong to no single check yet must reach the next round. */}
+ belong to no single check yet must reach the next round.
+ Lives with the other group-level controls by the chevron. */}
{canReview && (
<span className={'acceptance-group-actions'}>
<ActionIcon
- icon={MessageSquarePlus}
+ icon={MessageSquareText}
size={'small'}
title={t('acceptance.group.feedbackAction')}
onClick={(event) => {
event.stopPropagation();
openGroupFeedbackModal({
groupLabel: label,
- onConfirm: (comment) => onGroupFeedback(rawCategory, comment),
+ onConfirm: (comment, fileIds) =>
+ onGroupFeedback(rawCategory, comment, fileIds),
});
}}
/>
</span>
)}
- <Flexbox flex={1} />
{collapsed ? (
// Fixed-size placeholder keeps the header height stable across toggles.
<div style={{ height: 24, width: 24 }} />
@@ -1196,8 +1228,16 @@ const CheckList = memo<CheckListProps>(
}
onClick={(event) => {
event.stopPropagation();
+ // Expanding a group is "show me what still needs judgment"
+ // — rows the user already accepted are settled business
+ // and stay folded (they open individually on demand).
+ // Collapsing folds everything, accepted or not.
onToggleGroupItems(
- rows.map((check) => check.id),
+ anyItemOpen
+ ? rows.map((check) => check.id)
+ : rows
+ .filter((check) => userReviewState(check) !== 'accepted')
+ .map((check) => check.id),
!anyItemOpen,
);
}}
@@ -1237,13 +1277,14 @@ const CheckList = memo<CheckListProps>(
fontSize: 12,
}}
>
- {t('acceptance.group.feedbackLabel', { round: entry.roundIndex })}
+ {t('acceptance.group.feedbackLabel')}
</Text>
<Text fontSize={12} type={'secondary'}>
{dayjs(entry.createdAt).format('MM-DD HH:mm')}
</Text>
</Flexbox>
<Text style={{ fontSize: 12 }}>{entry.comment}</Text>
+ <AttachmentThumbs attachments={entry.attachments} />
</Flexbox>
);
})}
diff --git a/src/features/Verify/Acceptance/CheckRejectModal.tsx b/src/features/Verify/Acceptance/CheckRejectModal.tsx
index b5ddc827ce8..8b2bd8e335f 100644
--- a/src/features/Verify/Acceptance/CheckRejectModal.tsx
+++ b/src/features/Verify/Acceptance/CheckRejectModal.tsx
@@ -16,6 +16,7 @@ import { memo, useEffect, useLayoutEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { AnnotationCanvas } from './Annotation';
+import { AttachmentStrip, AttachmentUploadButton, useFeedbackAttachments } from './attachments';
const styles = createStaticStyles(({ css }) => ({
canvasWrap: css`
@@ -103,6 +104,27 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorFillQuaternary};
`,
+ /** The zoom pill floats bottom-center over the stage — controls live with
+ the thing they control, not in a detached toolbar row. */
+ zoomBar: css`
+ position: absolute;
+ z-index: 5;
+ inset-block-end: 16px;
+ inset-inline-start: 50%;
+ transform: translateX(-50%);
+
+ display: flex;
+ gap: 4px;
+ align-items: center;
+
+ padding-block: 4px;
+ padding-inline: 8px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: 99px;
+
+ background: ${cssVar.colorBgElevated};
+ box-shadow: ${cssVar.boxShadowSecondary};
+ `,
zoomLabel: css`
min-width: 44px;
@@ -160,6 +182,7 @@ interface CheckRejectModalProps {
onConfirm: (value: {
annotations: AcceptanceReviewAnnotation[];
comment: string;
+ fileIds: string[];
}) => Promise<boolean>;
}
@@ -180,11 +203,19 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
.map((entry) => ({ ...entry, key: nextAnnotationKey() })),
);
+ // Your own screenshots (paste or upload) — attached to the reject alongside
+ // the note and any circled regions.
+ const { attachments, fileIds, handlePaste, remove, uploadFiles, uploading } =
+ useFeedbackAttachments();
+
// Fullscreen inspect-and-annotate: same draft state, a zoomable stage.
const [fullscreen, setFullscreen] = useState(false);
const [zoom, setZoom] = useState(1);
const viewportRef = useRef<HTMLDivElement>(null);
const [viewportWidth, setViewportWidth] = useState<number>();
+ // The stage edits the SHARED draft; Cancel must be able to hand back the
+ // annotations exactly as they were when the stage opened.
+ const fullscreenSnapshot = useRef<DraftAnnotationEntry[]>([]);
useLayoutEffect(() => {
if (!fullscreen) return;
@@ -239,9 +270,12 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
return ZOOM_STEPS[Math.min(Math.max(at + direction, 0), ZOOM_STEPS.length - 1)];
});
- // The reject IS its feedback — at least one note (global or per-region).
+ // The reject IS its feedback — at least one note (global or per-region) or
+ // an attached screenshot the next round can act on.
const canSubmit =
- Boolean(comment.trim()) || annotations.some((annotation) => annotation.comment.trim());
+ Boolean(comment.trim()) ||
+ annotations.some((annotation) => annotation.comment.trim()) ||
+ fileIds.length > 0;
const handleConfirm = async () => {
setLoading(true);
@@ -255,6 +289,7 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
rect: annotation.rect,
})),
comment: comment.trim(),
+ fileIds,
});
if (confirmed) {
if (draftKey) localStorage.removeItem(draftStorageKey(draftKey));
@@ -367,6 +402,7 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
title={translate('acceptance.review.fullscreen')}
onClick={() => {
setZoom(1);
+ fullscreenSnapshot.current = annotations;
setFullscreen(true);
}}
/>
@@ -387,7 +423,19 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
placeholder={translate('acceptance.review.rejectPlaceholder')}
value={comment}
onChange={(event) => setComment(event.target.value)}
+ onPaste={handlePaste}
/>
+ {/* One row hugging the input — the thumbnails and the picker
+ belong to the note they back, not to the modal footer. */}
+ <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>
+ <AttachmentStrip
+ attachments={attachments}
+ disabled={loading}
+ uploading={uploading}
+ onRemove={remove}
+ />
+ <AttachmentUploadButton disabled={loading} onFiles={uploadFiles} />
+ </Flexbox>
</Flexbox>
</Flexbox>
@@ -402,7 +450,12 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
<Button disabled={loading} onClick={close}>
{translate('acceptance.actions.cancel')}
</Button>
- <Button disabled={!canSubmit} loading={loading} type={'primary'} onClick={handleConfirm}>
+ <Button
+ disabled={!canSubmit || uploading}
+ loading={loading}
+ type={'primary'}
+ onClick={handleConfirm}
+ >
{translate('acceptance.review.confirmReject')}
</Button>
</Flexbox>
@@ -410,16 +463,18 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
{/* Fullscreen inspect-and-annotate stage — a base-ui Modal so the mask,
theme scope and stacking are handled by the same layer system as
the reject dialog it opens over (nested modals stack correctly).
- Same draft state: zoom via the toolbar, pan via the viewport's
- native scroll. */}
+ Same draft state; the stage is edit-in-place, so it closes through
+ explicit Done/Cancel (Cancel restores the entry snapshot). Zoom
+ lives as a floating pill over the stage; the how-to line sits with
+ the comments it produces. */}
<Modal
centered
destroyOnHidden
footer={null}
- height={'88vh'}
+ height={'94vh'}
open={fullscreen}
title={translate('acceptance.review.annotate')}
- width={'min(96vw, 1440px)'}
+ width={'min(98vw, 1680px)'}
styles={{
body: {
display: 'flex',
@@ -434,29 +489,8 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
>
{activeEvidence && (
<>
- <Flexbox horizontal align={'center'} gap={8}>
- <Text fontSize={12} type={'secondary'}>
- {translate('acceptance.review.annotateHint')}
- </Text>
- <Flexbox flex={1} />
- <ActionIcon
- disabled={zoom <= ZOOM_STEPS[0]}
- icon={ZoomOut}
- size={'small'}
- title={translate('acceptance.review.zoomOut')}
- onClick={() => stepZoom(-1)}
- />
- <span className={styles.zoomLabel}>{Math.round(zoom * 100)}%</span>
- <ActionIcon
- disabled={zoom >= ZOOM_STEPS.at(-1)!}
- icon={ZoomIn}
- size={'small'}
- title={translate('acceptance.review.zoomIn')}
- onClick={() => stepZoom(1)}
- />
- </Flexbox>
{thumbnails}
- <div className={styles.fullscreenBody}>
+ <div className={styles.fullscreenBody} style={{ position: 'relative' }}>
<div className={styles.viewport} ref={viewportRef}>
<AnnotationCanvas
annotations={activeAnnotations}
@@ -469,10 +503,32 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
{...canvasHandlers}
/>
</div>
+ <div className={styles.zoomBar}>
+ <ActionIcon
+ disabled={zoom <= ZOOM_STEPS[0]}
+ icon={ZoomOut}
+ size={'small'}
+ title={translate('acceptance.review.zoomOut')}
+ onClick={() => stepZoom(-1)}
+ />
+ <span className={styles.zoomLabel}>{Math.round(zoom * 100)}%</span>
+ <ActionIcon
+ disabled={zoom >= ZOOM_STEPS.at(-1)!}
+ icon={ZoomIn}
+ size={'small'}
+ title={translate('acceptance.review.zoomIn')}
+ onClick={() => stepZoom(1)}
+ />
+ </div>
<div className={styles.sidePanel}>
- <Text strong fontSize={13}>
- {translate('acceptance.review.regionComments')}
- </Text>
+ <Flexbox gap={2}>
+ <Text strong fontSize={13}>
+ {translate('acceptance.review.regionComments')}
+ </Text>
+ <Text fontSize={12} type={'secondary'}>
+ {translate('acceptance.review.annotateHint')}
+ </Text>
+ </Flexbox>
{activeAnnotations.length === 0 && (
<Text fontSize={12} type={'secondary'}>
{translate('acceptance.review.regionCommentsEmpty')}
@@ -481,6 +537,19 @@ const CheckRejectContent = memo<CheckRejectModalProps>(
{annotationInputs}
</div>
</div>
+ <Flexbox horizontal gap={8} justify={'flex-end'} style={{ flex: 'none' }}>
+ <Button
+ onClick={() => {
+ setAnnotations(fullscreenSnapshot.current);
+ setFullscreen(false);
+ }}
+ >
+ {translate('acceptance.actions.cancel')}
+ </Button>
+ <Button type={'primary'} onClick={() => setFullscreen(false)}>
+ {translate('acceptance.review.fullscreenDone')}
+ </Button>
+ </Flexbox>
</>
)}
</Modal>
@@ -500,6 +569,7 @@ export const openCheckRejectModal = (options: CheckRejectModalProps): ModalInsta
// The content region hosts its own scroll body + pinned action bar — it
// must not scroll (or pad) as a whole, or the bar scrolls away with it.
styles: {
+ backdrop: { backdropFilter: 'blur(4px)' },
content: {
display: 'flex',
flexDirection: 'column',
diff --git a/src/features/Verify/Acceptance/DecisionBar.tsx b/src/features/Verify/Acceptance/DecisionBar.tsx
index 1d41856a23f..0daff29facd 100644
--- a/src/features/Verify/Acceptance/DecisionBar.tsx
+++ b/src/features/Verify/Acceptance/DecisionBar.tsx
@@ -3,7 +3,7 @@
import { Flexbox, Icon, Text } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import { BadgeCheck, HelpCircle, ListTodo, Loader2, RotateCcw } from 'lucide-react';
+import { BadgeCheck, ListTodo, Loader2, RotateCcw } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -16,73 +16,178 @@ const styles = createStaticStyles(({ css }) => ({
inset-block-end: 16px;
display: flex;
- gap: 12px;
+ gap: 14px;
align-items: center;
- padding-block: 10px;
- padding-inline: 14px;
+ padding-block: 12px;
+ padding-inline: 16px;
border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
+ border-radius: 14px;
background: ${cssVar.colorBgElevated};
- box-shadow: ${cssVar.boxShadowTertiary};
+ box-shadow: ${cssVar.boxShadowSecondary};
`,
- feedbackChip: css`
- white-space: nowrap;
+ glyph: css`
+ display: flex;
+ flex: none;
+ align-items: center;
+ justify-content: center;
+
+ width: 36px;
+ height: 36px;
+ border-radius: 50%;
`,
}));
type BarState = 'accepted' | 'live' | 'rejected' | 'settled';
+/**
+ * The review-progress dial: how many checks the user has signed off, of all.
+ * At zero it reads as a dashed "not started" circle; the completed state is
+ * rendered by the bar as the BadgeCheck disc, not here.
+ */
+const ProgressRing = memo<{ done: number; total: number }>(({ done, total }) => {
+ const size = 36;
+ const stroke = 3.5;
+ const radius = (size - stroke) / 2;
+ const circumference = 2 * Math.PI * radius;
+ const ratio = total > 0 ? Math.min(done / total, 1) : 0;
+
+ if (done <= 0)
+ return (
+ <svg height={size} style={{ flex: 'none' }} width={size}>
+ <circle
+ cx={size / 2}
+ cy={size / 2}
+ fill={'none'}
+ r={radius}
+ stroke={cssVar.colorTextQuaternary}
+ strokeDasharray={'3 5'}
+ strokeLinecap={'round'}
+ strokeWidth={stroke}
+ />
+ </svg>
+ );
+
+ return (
+ <div style={{ flex: 'none', height: size, position: 'relative', width: size }}>
+ <svg height={size} width={size}>
+ <circle
+ cx={size / 2}
+ cy={size / 2}
+ fill={'none'}
+ r={radius}
+ stroke={cssVar.colorFillSecondary}
+ strokeWidth={stroke}
+ />
+ <circle
+ cx={size / 2}
+ cy={size / 2}
+ fill={'none'}
+ r={radius}
+ stroke={cssVar.colorPrimary}
+ strokeDasharray={`${circumference * ratio} ${circumference}`}
+ strokeLinecap={'round'}
+ strokeWidth={stroke}
+ style={{ transition: 'stroke-dasharray 0.3s ease' }}
+ transform={`rotate(-90 ${size / 2} ${size / 2})`}
+ />
+ </svg>
+ <Flexbox
+ align={'center'}
+ justify={'center'}
+ style={{ fontSize: 10, fontVariantNumeric: 'tabular-nums', inset: 0, position: 'absolute' }}
+ >
+ <span style={{ color: cssVar.colorTextSecondary, fontWeight: 600 }}>{done}</span>
+ </Flexbox>
+ </div>
+ );
+});
+
+ProgressRing.displayName = 'AcceptanceProgressRing';
+
interface DecisionBarProps {
+ /** Checks the user has signed off, of `totalCount` reviewable ones. */
+ acceptedCount: number;
/** Active (not-yet-consumed) feedback recorded this round. */
feedbackCount: number;
- /** Exceptions (failed / uncertain) in the current union — colors the settled text. */
- hasException: boolean;
onAccept: () => void;
+ /** Copy the hardcoded repair prompt for pasting to any agent. */
+ onCopyReview: () => void;
onOpenFeedback: () => void;
+ /** Open the aggregate reject dialog (comment required). */
+ onRejectComment: () => void;
+ /** Dispatch the repair prompt straight into the origin agent conversation. */
+ onRerun: () => void;
pending: boolean;
+ /** The origin conversation is known — the rerun dispatch has a target. */
+ rerunAvailable: boolean;
+ rerunPending: boolean;
state: BarState;
/** The state line, prepared by the page (status + counts wording). */
statusText: string;
subText?: string;
+ totalCount: number;
}
/**
- * The floating decision strip (P-12): the round chain's state, the feedback
- * clearing-list opener, and the closing accept. Whole-delivery feedback is
- * NOT an inline input here — feedback is left per-check / per-group where the
- * evidence is; the bar stays a decision surface, not a compose box.
+ * The floating decision strip (P-12): review progress, the feedback
+ * clearing-list opener, and the closing actions. What the actions are follows
+ * the review state — feedback queued for the next round turns the bar into a
+ * repair dispatcher (copy the prompt / send it back to the origin agent);
+ * a clean review offers reject-with-comment and accept, with accept gaining
+ * primary weight only once every check is signed off.
*/
const DecisionBar = memo<DecisionBarProps>(
({
+ acceptedCount,
feedbackCount,
- hasException,
onAccept,
+ onCopyReview,
onOpenFeedback,
+ onRejectComment,
+ onRerun,
pending,
+ rerunAvailable,
+ rerunPending,
state,
statusText,
subText,
+ totalCount,
}) => {
const { t } = useTranslation('verify');
const stateMeta = {
- accepted: { color: cssVar.colorSuccess, icon: BadgeCheck, spin: false },
- live: { color: cssVar.colorInfo, icon: Loader2, spin: true },
- rejected: { color: cssVar.colorError, icon: RotateCcw, spin: false },
- settled: {
- color: hasException ? cssVar.colorWarning : cssVar.colorSuccess,
- icon: hasException ? HelpCircle : BadgeCheck,
- spin: false,
- },
+ accepted: { bg: cssVar.colorSuccessBg, color: cssVar.colorSuccess, icon: BadgeCheck },
+ live: { bg: cssVar.colorInfoBg, color: cssVar.colorInfo, icon: Loader2 },
+ rejected: { bg: cssVar.colorErrorBg, color: cssVar.colorError, icon: RotateCcw },
+ settled: null,
}[state];
+ const allConfirmed = totalCount > 0 && acceptedCount >= totalCount;
+ const hasFeedback = feedbackCount > 0;
+
return (
<div className={styles.bar}>
- <Icon color={stateMeta.color} icon={stateMeta.icon} size={18} spin={stateMeta.spin} />
- <Flexbox gap={1} style={{ flex: 1, minWidth: 0 }}>
- <Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>
+ {stateMeta || allConfirmed ? (
+ // A fully signed-off review earns the badge, not a maxed-out dial —
+ // the same mark the accepted state carries.
+ <div
+ className={styles.glyph}
+ style={{ background: stateMeta?.bg ?? cssVar.colorSuccessBg }}
+ >
+ <Icon
+ color={stateMeta?.color ?? cssVar.colorSuccess}
+ icon={stateMeta?.icon ?? BadgeCheck}
+ size={18}
+ spin={state === 'live'}
+ />
+ </div>
+ ) : (
+ <ProgressRing done={acceptedCount} total={totalCount} />
+ )}
+ <Flexbox gap={2} style={{ flex: 1, minWidth: 0 }}>
+ <Text ellipsis strong style={{ fontSize: 14 }}>
{statusText}
</Text>
{subText && (
@@ -95,9 +200,9 @@ const DecisionBar = memo<DecisionBarProps>(
{/* The clearing list — every note this round queues for the next one. */}
{feedbackCount > 0 && (
<Button
- className={styles.feedbackChip}
icon={<Icon icon={ListTodo} />}
size={'small'}
+ style={{ flex: 'none' }}
type={'text'}
onClick={onOpenFeedback}
>
@@ -105,11 +210,61 @@ const DecisionBar = memo<DecisionBarProps>(
</Button>
)}
- {state === 'settled' && (
- <Button disabled={pending} type={'primary'} onClick={onAccept}>
- {t('acceptance.actions.accept')}
+ {/* A dispatched send-back (repairing) keeps the copy entry alive —
+ the reviewer may still hand the prompt to another agent. */}
+ {state === 'live' && hasFeedback && (
+ <Button disabled={pending} style={{ flex: 'none' }} type={'fill'} onClick={onCopyReview}>
+ {t('acceptance.bar.copyReview')}
</Button>
)}
+
+ {state === 'settled' &&
+ (hasFeedback ? (
+ // Feedback is queued — the delivery isn't being accepted now; the
+ // bar's job is getting the repair round started.
+ <>
+ <Button
+ disabled={pending}
+ style={{ flex: 'none' }}
+ type={'fill'}
+ onClick={onCopyReview}
+ >
+ {t('acceptance.bar.copyReview')}
+ </Button>
+ {rerunAvailable && (
+ <Button
+ disabled={pending}
+ loading={rerunPending}
+ style={{ flex: 'none' }}
+ type={'primary'}
+ onClick={onRerun}
+ >
+ {t('acceptance.bar.rerun')}
+ </Button>
+ )}
+ </>
+ ) : (
+ // Clean review — accept carries primary weight only once every
+ // check is signed off; before that it stays a quiet option.
+ <>
+ <Button
+ disabled={pending}
+ style={{ flex: 'none' }}
+ type={'text'}
+ onClick={onRejectComment}
+ >
+ {t('acceptance.bar.rejectComment')}
+ </Button>
+ <Button
+ disabled={pending}
+ style={{ flex: 'none' }}
+ type={allConfirmed ? 'primary' : 'fill'}
+ onClick={onAccept}
+ >
+ {t('acceptance.actions.accept')}
+ </Button>
+ </>
+ ))}
</div>
);
},
diff --git a/src/features/Verify/Acceptance/FeedbackDrawer.tsx b/src/features/Verify/Acceptance/FeedbackDrawer.tsx
index 15d5f466b69..cee61f99350 100644
--- a/src/features/Verify/Acceptance/FeedbackDrawer.tsx
+++ b/src/features/Verify/Acceptance/FeedbackDrawer.tsx
@@ -1,28 +1,41 @@
'use client';
-import { Drawer, Flexbox, Icon, Tag, Text } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
+import type { AcceptanceAttachment } from '@lobechat/types';
+import { Drawer, Flexbox, Text } from '@lobehub/ui';
+import { createStaticStyles, cssVar, cx } from 'antd-style';
import dayjs from 'dayjs';
-import { MessageSquareText, MessageSquareX } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { AttachmentThumbs } from './attachments';
+
const styles = createStaticStyles(({ css }) => ({
- card: css`
- padding-block: 10px;
- padding-inline: 12px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- `,
clickable: css`
cursor: pointer;
- transition: border-color 0.2s;
&:hover {
- border-color: ${cssVar.colorBorder};
background: ${cssVar.colorFillQuaternary};
}
`,
+ meta: css`
+ flex: none;
+ font-size: 11px;
+ color: ${cssVar.colorTextQuaternary};
+ white-space: nowrap;
+ `,
+ /* One feedback event as a list row — hairline-separated, no card chrome.
+ The drawer is an audit trail; rows read as entries in a ledger. Roomy
+ vertical rhythm: cramped rows made the trail read as one dense block. */
+ row: css`
+ padding-block: 14px;
+ padding-inline: 8px;
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+
+ &:last-child {
+ border-block-end: none;
+ }
+ `,
sectionTitle: css`
font-size: 12px;
font-weight: 500;
@@ -30,9 +43,10 @@ const styles = createStaticStyles(({ css }) => ({
letter-spacing: 0.04em;
`,
seq: css`
+ flex: none;
font-family: ${cssVar.fontFamilyCode};
font-size: 11px;
- color: ${cssVar.colorTextQuaternary};
+ color: ${cssVar.colorTextSecondary};
`,
}));
@@ -40,6 +54,8 @@ const styles = createStaticStyles(({ css }) => ({
export interface FeedbackListEntry {
/** Number of circled regions carried by the feedback (check rejects). */
annotationCount?: number;
+ /** Resolved screenshots the reviewer attached to the feedback. */
+ attachments?: AcceptanceAttachment[];
/** Jump target — set for check-scoped entries. */
checkId?: string;
/** Check label ("C3") for check-scoped entries. */
@@ -64,25 +80,27 @@ interface FeedbackDrawerProps {
open: boolean;
}
-const EntryCard = memo<{
+const EntryRow = memo<{
entry: FeedbackListEntry;
onJumpToCheck: (checkId: string) => void;
}>(({ entry, onJumpToCheck }) => {
const { t } = useTranslation('verify');
const isCheck = entry.kind === 'check';
+ const metaBits = [
+ entry.annotationCount
+ ? t('acceptance.feedback.annotations', { count: entry.annotationCount })
+ : null,
+ `${t('acceptance.round', { round: entry.roundIndex })} · ${dayjs(entry.createdAt).format('MM-DD HH:mm')}`,
+ ].filter(Boolean);
+
return (
<Flexbox
- className={`${styles.card} ${entry.checkId ? styles.clickable : ''}`}
+ className={cx(styles.row, entry.checkId && styles.clickable)}
gap={6}
style={entry.stale ? { opacity: 0.55 } : undefined}
onClick={entry.checkId ? () => onJumpToCheck(entry.checkId!) : undefined}
>
<Flexbox horizontal align={'center'} gap={6}>
- <Icon
- color={entry.stale ? cssVar.colorTextQuaternary : cssVar.colorError}
- icon={isCheck ? MessageSquareX : MessageSquareText}
- size={13}
- />
{isCheck ? (
<>
<span className={styles.seq}>C{entry.checkSeq}</span>
@@ -91,24 +109,21 @@ const EntryCard = memo<{
</Text>
</>
) : (
- <Text style={{ fontSize: 13 }}>
+ <Text ellipsis style={{ fontSize: 13, minWidth: 0 }}>
{entry.groupLabel
? t('acceptance.feedback.group', { label: entry.groupLabel })
: t('acceptance.feedback.global')}
</Text>
)}
<Flexbox flex={1} />
- {entry.annotationCount ? (
- <Tag size={'small'}>
- {t('acceptance.feedback.annotations', { count: entry.annotationCount })}
- </Tag>
- ) : null}
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.round', { round: entry.roundIndex })} ·{' '}
- {dayjs(entry.createdAt).format('MM-DD HH:mm')}
- </Text>
+ <span className={styles.meta}>{metaBits.join(' · ')}</span>
</Flexbox>
- {entry.comment && <Text style={{ fontSize: 13 }}>{entry.comment}</Text>}
+ {entry.comment && (
+ <Text style={{ fontSize: 12 }} type={'secondary'}>
+ {entry.comment}
+ </Text>
+ )}
+ <AttachmentThumbs attachments={entry.attachments} />
</Flexbox>
);
});
@@ -116,7 +131,8 @@ const EntryCard = memo<{
/**
* The feedback clearing house: what THIS round's review has queued for the
* next verification round (active), and everything earlier rounds already
- * consumed (history) — one place to audit the whole trail.
+ * consumed (history) — one place to audit the whole trail. Entries render as
+ * a flat hairline list, not cards — it is a ledger, not a gallery.
*/
const FeedbackDrawer = memo<FeedbackDrawerProps>(({ entries, onClose, onJumpToCheck, open }) => {
const { t } = useTranslation('verify');
@@ -131,8 +147,8 @@ const FeedbackDrawer = memo<FeedbackDrawerProps>(({ entries, onClose, onJumpToCh
width={'min(92vw, 440px)'}
onClose={onClose}
>
- <Flexbox gap={16}>
- <Flexbox gap={8}>
+ <Flexbox gap={20}>
+ <Flexbox gap={4}>
<Text className={styles.sectionTitle}>
{t('acceptance.feedback.current', { count: active.length })}
</Text>
@@ -141,18 +157,22 @@ const FeedbackDrawer = memo<FeedbackDrawerProps>(({ entries, onClose, onJumpToCh
{t('acceptance.feedback.empty')}
</Text>
)}
- {active.map((entry, index) => (
- <EntryCard entry={entry} key={index} onJumpToCheck={onJumpToCheck} />
- ))}
+ <Flexbox>
+ {active.map((entry, index) => (
+ <EntryRow entry={entry} key={index} onJumpToCheck={onJumpToCheck} />
+ ))}
+ </Flexbox>
</Flexbox>
{history.length > 0 && (
- <Flexbox gap={8}>
+ <Flexbox gap={4}>
<Text className={styles.sectionTitle}>
{t('acceptance.feedback.history', { count: history.length })}
</Text>
- {history.map((entry, index) => (
- <EntryCard entry={entry} key={index} onJumpToCheck={onJumpToCheck} />
- ))}
+ <Flexbox>
+ {history.map((entry, index) => (
+ <EntryRow entry={entry} key={index} onJumpToCheck={onJumpToCheck} />
+ ))}
+ </Flexbox>
</Flexbox>
)}
</Flexbox>
diff --git a/src/features/Verify/Acceptance/LedgerPanel.tsx b/src/features/Verify/Acceptance/LedgerPanel.tsx
index 83e14cdba21..dbaab253f5e 100644
--- a/src/features/Verify/Acceptance/LedgerPanel.tsx
+++ b/src/features/Verify/Acceptance/LedgerPanel.tsx
@@ -74,6 +74,9 @@ const roundStatus = (round: AcceptanceRound): string => {
};
interface LedgerPanelProps {
+ /** The hosting surface already provides a close affordance (narrow-mode
+ Drawer) — a second collapse icon here would read as two closes. */
+ hideCollapse?: boolean;
highlight: number | null;
onCollapse: () => void;
onOpenReport: (round: AcceptanceRound) => void;
@@ -85,105 +88,109 @@ interface LedgerPanelProps {
* full verify run; the main list is the cross-round merge. Newest round first —
* the latest attempt is the one under judgment.
*/
-const LedgerPanel = memo<LedgerPanelProps>(({ highlight, onCollapse, onOpenReport, rounds }) => {
- const { t } = useTranslation('verify');
- const latestIndex = rounds.at(-1)?.run.roundIndex;
-
- return (
- <Flexbox gap={12} padding={16}>
- <Flexbox horizontal align={'center'} gap={8}>
- <Icon color={cssVar.colorTextSecondary} icon={FileClock} size={16} />
- <Text strong style={{ fontSize: 13 }}>
- {t('acceptance.ledger.title')}
- </Text>
+const LedgerPanel = memo<LedgerPanelProps>(
+ ({ hideCollapse, highlight, onCollapse, onOpenReport, rounds }) => {
+ const { t } = useTranslation('verify');
+ const latestIndex = rounds.at(-1)?.run.roundIndex;
+
+ return (
+ <Flexbox gap={12} padding={16}>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Icon color={cssVar.colorTextSecondary} icon={FileClock} size={16} />
+ <Text strong style={{ fontSize: 13 }}>
+ {t('acceptance.ledger.title')}
+ </Text>
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.ledger.count', { count: rounds.length })}
+ </Text>
+ <Flexbox flex={1} />
+ {!hideCollapse && (
+ <ActionIcon
+ icon={PanelRightClose}
+ size={'small'}
+ title={t('acceptance.ledger.collapse')}
+ onClick={onCollapse}
+ />
+ )}
+ </Flexbox>
<Text fontSize={12} type={'secondary'}>
- {t('acceptance.ledger.count', { count: rounds.length })}
+ {t('acceptance.ledger.description')}
</Text>
- <Flexbox flex={1} />
- <ActionIcon
- icon={PanelRightClose}
- size={'small'}
- title={t('acceptance.ledger.collapse')}
- onClick={onCollapse}
- />
- </Flexbox>
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.ledger.description')}
- </Text>
- {[...rounds].reverse().map((round) => {
- const status = roundStatus(round);
- const meta = STATUS_META[status] ?? STATUS_META.verifying;
- const stats =
- round.report?.totalChecks != null
- ? t('acceptance.ledger.stats', {
- passed: round.report.passedChecks ?? 0,
- total: round.report.totalChecks,
- })
- : null;
- const commit = (round.run.context as { commit?: string } | null)?.commit;
-
- const openable = Boolean(round.report);
-
- return (
- <Flexbox
- aria-label={openable ? t('acceptance.ledger.viewReport') : undefined}
- gap={6}
- key={round.run.id}
- role={openable ? 'button' : undefined}
- className={cx(
- styles.round,
- openable && styles.roundClickable,
- highlight === round.run.roundIndex && styles.roundActive,
- )}
- onClick={openable ? () => onOpenReport(round) : undefined}
- >
- <Flexbox horizontal align={'center'} gap={8}>
- <Text strong style={{ fontSize: 13 }}>
- {t('acceptance.round', { round: round.run.roundIndex })}
- </Text>
- {round.run.roundIndex === latestIndex && (
+ {[...rounds].reverse().map((round) => {
+ const status = roundStatus(round);
+ const meta = STATUS_META[status] ?? STATUS_META.verifying;
+ const stats =
+ round.report?.totalChecks != null
+ ? t('acceptance.ledger.stats', {
+ passed: round.report.passedChecks ?? 0,
+ total: round.report.totalChecks,
+ })
+ : null;
+ const commit = (round.run.context as { commit?: string } | null)?.commit;
+
+ const openable = Boolean(round.report);
+
+ return (
+ <Flexbox
+ aria-label={openable ? t('acceptance.ledger.viewReport') : undefined}
+ gap={6}
+ key={round.run.id}
+ role={openable ? 'button' : undefined}
+ className={cx(
+ styles.round,
+ openable && styles.roundClickable,
+ highlight === round.run.roundIndex && styles.roundActive,
+ )}
+ onClick={openable ? () => onOpenReport(round) : undefined}
+ >
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Text strong style={{ fontSize: 13 }}>
+ {t('acceptance.round', { round: round.run.roundIndex })}
+ </Text>
+ {round.run.roundIndex === latestIndex && (
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.ledger.latest')}
+ </Text>
+ )}
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={4}
+ style={{ color: meta.color, fontSize: 12 }}
+ >
+ <Icon icon={meta.icon} size={13} />
+ {t(`acceptance.roundStatus.${status}`, { defaultValue: status })}
+ </Flexbox>
+ <Flexbox flex={1} />
<Text fontSize={12} type={'secondary'}>
- {t('acceptance.ledger.latest')}
+ {dayjs(round.run.createdAt).format('MM-DD HH:mm')}
</Text>
- )}
- <Flexbox
- horizontal
- align={'center'}
- gap={4}
- style={{ color: meta.color, fontSize: 12 }}
- >
- <Icon icon={meta.icon} size={13} />
- {t(`acceptance.roundStatus.${status}`, { defaultValue: status })}
+ {openable && (
+ <Icon
+ className={'acceptance-round-open-hint'}
+ color={cssVar.colorTextTertiary}
+ icon={ChevronRight}
+ size={14}
+ />
+ )}
</Flexbox>
- <Flexbox flex={1} />
- <Text fontSize={12} type={'secondary'}>
- {dayjs(round.run.createdAt).format('MM-DD HH:mm')}
- </Text>
- {openable && (
- <Icon
- className={'acceptance-round-open-hint'}
- color={cssVar.colorTextTertiary}
- icon={ChevronRight}
- size={14}
- />
+ {round.run.title && (
+ <Text fontSize={12} style={{ lineHeight: 1.5 }} type={'secondary'}>
+ {round.run.title}
+ </Text>
+ )}
+ {(stats || commit) && (
+ <Text fontSize={12} type={'secondary'}>
+ {[stats, commit?.slice(0, 10)].filter(Boolean).join(' · ')}
+ </Text>
)}
</Flexbox>
- {round.run.title && (
- <Text fontSize={12} style={{ lineHeight: 1.5 }} type={'secondary'}>
- {round.run.title}
- </Text>
- )}
- {(stats || commit) && (
- <Text fontSize={12} type={'secondary'}>
- {[stats, commit?.slice(0, 10)].filter(Boolean).join(' · ')}
- </Text>
- )}
- </Flexbox>
- );
- })}
- </Flexbox>
- );
-});
+ );
+ })}
+ </Flexbox>
+ );
+ },
+);
LedgerPanel.displayName = 'AcceptanceLedgerPanel';
diff --git a/src/features/Verify/Acceptance/attachments.tsx b/src/features/Verify/Acceptance/attachments.tsx
new file mode 100644
index 00000000000..bb1374fde2d
--- /dev/null
+++ b/src/features/Verify/Acceptance/attachments.tsx
@@ -0,0 +1,252 @@
+'use client';
+
+import type { AcceptanceAttachment } from '@lobechat/types';
+import { Flexbox, Icon, Image } from '@lobehub/ui';
+import { Button } from '@lobehub/ui/base-ui';
+import { App, Upload } from 'antd';
+import { createStaticStyles, cssVar, cx } from 'antd-style';
+import { ImagePlus, Loader2, X } from 'lucide-react';
+import { type ClipboardEvent, memo, useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useFileStore } from '@/store/file';
+
+/** 10MB — a screenshot, not a video; keeps the reject payload light. */
+const MAX_ATTACHMENT_SIZE = 10 * 1024 * 1024;
+
+const styles = createStaticStyles(({ css }) => ({
+ remove: css`
+ cursor: pointer;
+
+ position: absolute;
+ z-index: 2;
+ inset-block-start: -6px;
+ inset-inline-end: -6px;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ width: 18px;
+ height: 18px;
+ padding: 0;
+ border: none;
+ border-radius: 50%;
+
+ color: #fff;
+
+ opacity: 0;
+ background: ${cssVar.colorError};
+
+ transition: opacity 0.15s;
+ `,
+ thumb: css`
+ position: relative;
+
+ overflow: hidden;
+
+ width: 56px;
+ height: 56px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+
+ &:hover .acceptance-attach-remove {
+ opacity: 1;
+ }
+
+ img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+ `,
+ thumbLoading: css`
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ color: ${cssVar.colorTextTertiary};
+
+ background: ${cssVar.colorFillQuaternary};
+ `,
+}));
+
+/** An attachment the user just uploaded this session — id + a live preview URL. */
+export interface PendingAttachment {
+ id: string;
+ name?: string;
+ url: string;
+}
+
+const pickImages = (files: File[]): File[] =>
+ files.filter((file) => file.type.startsWith('image/'));
+
+/**
+ * Draft-attachment state for a feedback compose surface: click-to-upload and
+ * paste both funnel through {@link useFileStore}'s `uploadWithProgress`, so an
+ * attachment is a real file row the reject/group-feedback write references by
+ * id (the same flywheel evidence uses), never a base64 blob on the note.
+ */
+export const useFeedbackAttachments = (max = 6) => {
+ const { t } = useTranslation('verify');
+ const { message } = App.useApp();
+ const uploadWithProgress = useFileStore((s) => s.uploadWithProgress);
+ const [attachments, setAttachments] = useState<PendingAttachment[]>([]);
+ const [uploadingCount, setUploadingCount] = useState(0);
+
+ const uploadFiles = useCallback(
+ async (files: File[]) => {
+ const images = pickImages(files);
+ if (images.length === 0) return;
+
+ const room = max - attachments.length;
+ if (room <= 0) {
+ message.info(t('acceptance.review.attachLimit', { count: max }));
+ return;
+ }
+
+ await Promise.all(
+ images.slice(0, room).map(async (file) => {
+ if (file.size > MAX_ATTACHMENT_SIZE) {
+ message.error(t('acceptance.review.attachTooLarge'));
+ return;
+ }
+ setUploadingCount((count) => count + 1);
+ try {
+ const result = await uploadWithProgress({ file });
+ if (result?.id && result.url) {
+ setAttachments((previous) => [
+ ...previous,
+ { id: result.id, name: file.name, url: result.url },
+ ]);
+ }
+ } catch (error) {
+ console.error('[acceptance] attachment upload failed', error);
+ message.error(t('acceptance.review.attachFailed'));
+ } finally {
+ setUploadingCount((count) => count - 1);
+ }
+ }),
+ );
+ },
+ [attachments.length, max, message, t, uploadWithProgress],
+ );
+
+ const handlePaste = useCallback(
+ (event: ClipboardEvent) => {
+ const files = [...event.clipboardData.items]
+ .filter((item) => item.kind === 'file' && item.type.startsWith('image/'))
+ .map((item) => item.getAsFile())
+ .filter((file): file is File => Boolean(file));
+ if (files.length === 0) return;
+ // A pasted screenshot must not also land as text in the note.
+ event.preventDefault();
+ void uploadFiles(files);
+ },
+ [uploadFiles],
+ );
+
+ const remove = useCallback(
+ (id: string) => setAttachments((previous) => previous.filter((item) => item.id !== id)),
+ [],
+ );
+
+ return {
+ attachments,
+ fileIds: attachments.map((item) => item.id),
+ handlePaste,
+ remove,
+ uploadFiles,
+ uploading: uploadingCount > 0,
+ };
+};
+
+interface AttachmentStripProps {
+ attachments: PendingAttachment[];
+ disabled?: boolean;
+ onRemove: (id: string) => void;
+ uploading?: boolean;
+}
+
+/** The draft thumbnails in a compose surface — each removable, plus a spinner tile while uploading. */
+export const AttachmentStrip = memo<AttachmentStripProps>(
+ ({ attachments, disabled, onRemove, uploading }) => {
+ if (attachments.length === 0 && !uploading) return null;
+ return (
+ <Flexbox horizontal gap={8} wrap={'wrap'}>
+ {attachments.map((attachment) => (
+ <div className={styles.thumb} key={attachment.id}>
+ <Image alt={attachment.name ?? ''} preview={false} src={attachment.url} />
+ {!disabled && (
+ <button
+ className={cx('acceptance-attach-remove', styles.remove)}
+ type={'button'}
+ onClick={() => onRemove(attachment.id)}
+ >
+ <Icon icon={X} size={12} />
+ </button>
+ )}
+ </div>
+ ))}
+ {uploading && (
+ <div className={cx(styles.thumb, styles.thumbLoading)}>
+ <Icon spin icon={Loader2} size={16} />
+ </div>
+ )}
+ </Flexbox>
+ );
+ },
+);
+
+AttachmentStrip.displayName = 'AcceptanceAttachmentStrip';
+
+interface AttachmentUploadButtonProps {
+ disabled?: boolean;
+ onFiles: (files: File[]) => void;
+}
+
+/** The "attach screenshot" trigger — a picker button that hands files back for upload. */
+export const AttachmentUploadButton = memo<AttachmentUploadButtonProps>(({ disabled, onFiles }) => {
+ const { t } = useTranslation('verify');
+ return (
+ <Upload
+ multiple
+ accept={'image/*'}
+ disabled={disabled}
+ showUploadList={false}
+ beforeUpload={(file, fileList) => {
+ // beforeUpload fires per file — fire the batch once, on the first item.
+ if (file === fileList[0]) onFiles(fileList as unknown as File[]);
+ return false;
+ }}
+ >
+ <Button disabled={disabled} icon={<Icon icon={ImagePlus} />} size={'small'} type={'text'}>
+ {t('acceptance.review.attach')}
+ </Button>
+ </Upload>
+ );
+});
+
+AttachmentUploadButton.displayName = 'AcceptanceAttachmentUploadButton';
+
+interface AttachmentThumbsProps {
+ attachments?: AcceptanceAttachment[];
+}
+
+/** Read-only screenshots on a settled feedback card — click any to zoom (native preview). */
+export const AttachmentThumbs = memo<AttachmentThumbsProps>(({ attachments }) => {
+ const usable = (attachments ?? []).filter((attachment) => attachment.url);
+ if (usable.length === 0) return null;
+ return (
+ <Flexbox horizontal gap={6} wrap={'wrap'}>
+ {usable.map((attachment) => (
+ <div className={styles.thumb} key={attachment.id}>
+ <Image alt={attachment.name ?? ''} src={attachment.url!} />
+ </div>
+ ))}
+ </Flexbox>
+ );
+});
+
+AttachmentThumbs.displayName = 'AcceptanceAttachmentThumbs';
diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsx
index 5761e75f447..5d47c1fbdb7 100644
--- a/src/features/Verify/Acceptance/index.tsx
+++ b/src/features/Verify/Acceptance/index.tsx
@@ -5,6 +5,7 @@ import {
ActionIcon,
Avatar,
Center,
+ copyToClipboard,
DraggablePanel,
Drawer,
Empty,
@@ -13,8 +14,8 @@ import {
Tag,
Text,
} from '@lobehub/ui';
-import { Button, Segmented, Select } from '@lobehub/ui/base-ui';
-import { createStaticStyles, cssVar, cx } from 'antd-style';
+import { Button, Segmented, Select, toast } from '@lobehub/ui/base-ui';
+import { createStaticStyles, cssVar, cx, useResponsive } from 'antd-style';
import dayjs from 'dayjs';
import {
BadgeCheck,
@@ -53,11 +54,24 @@ import CheckList, {
hasVisualEvidence,
isException,
isGroupFullyAccepted,
+ userReviewState,
} from './CheckList';
import DecisionBar from './DecisionBar';
import FeedbackDrawer, { type FeedbackListEntry } from './FeedbackDrawer';
import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';
-import { openAcceptModal } from './modals';
+import { openAcceptModal, openRejectModal } from './modals';
+
+/**
+ * The hardcoded repair prompt (复制 review 建议 / 打回重跑 share it): points the
+ * agent at the CLI as the source of truth for this acceptance's feedback, so
+ * nobody has to hand-summarize review notes into an instruction.
+ */
+const buildRepairPrompt = (acceptanceId: string) =>
+ `请用 LobeHub CLI 读取验收 ${acceptanceId} 的最新 review 反馈:
+
+lh acceptance feedback ${acceptanceId} --actionable
+
+输出的条目(含各检查项的评论、截图圈选标注与附件)就是本轮要处理的全部反馈。请逐条修改代码;完成后重新执行验证,并把新一轮验证结果 ingest 回同一个 acceptance(复用既有检查项 id,语义有变化的用 supersedes 迭代)。`;
const styles = createStaticStyles(({ css }) => ({
banner: css`
@@ -176,6 +190,14 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
const isEmbedded = Boolean(explicitAcceptanceId);
const { t } = useTranslation('verify');
const { data, error, isLoading, mutate } = useAcceptanceBundle(acceptanceId ?? null);
+ // Below `lg` the report body and a 300px+ in-flow ledger cannot share the
+ // viewport — the ledger switches to a float overlay, closed by default (the
+ // same narrow regime the list panel uses).
+ const { lg = true } = useResponsive();
+ const isNarrowViewport = !lg;
+ // The portal embed is container-narrow even in a wide window — both regimes
+ // get the one-line compact toolbar.
+ const compactToolbar = isEmbedded || isNarrowViewport;
const [filter, setFilter] = useState<CheckFilter>('all');
const [roundFilter, setRoundFilter] = useState<number | null>(null);
@@ -184,8 +206,14 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
const [seeded, setSeeded] = useState(false);
const [highlightRound, setHighlightRound] = useState<number | null>(null);
const [ledgerExpand, setLedgerExpand] = useState(!isEmbedded);
+ // Entering the narrow regime closes the ledger (it would cover the report);
+ // reopening is an explicit act via the corner toggle, as a float overlay.
+ useEffect(() => {
+ if (isNarrowViewport) setLedgerExpand(false);
+ }, [isNarrowViewport]);
const [reportRound, setReportRound] = useState<AcceptanceRound | null>(null);
const [pending, setPending] = useState(false);
+ const [rerunPending, setRerunPending] = useState(false);
const [actionError, setActionError] = useState<string>();
const [feedbackOpen, setFeedbackOpen] = useState(false);
@@ -199,14 +227,20 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
}, [status, mutate]);
// Exceptions and visually-evidenced checks start expanded (P-08) — once,
- // on first load, so the user's own toggling is never overwritten. Groups the
- // user already accepted in full are settled business: they start collapsed.
+ // on first load, so the user's own toggling is never overwritten. A check
+ // the user already accepted is settled business and stays folded regardless
+ // of its evidence; groups accepted in full start collapsed for the same
+ // reason.
useEffect(() => {
if (seeded || !data) return;
setExpanded(
new Set(
data.checks
- .filter((check) => isException(check) || hasVisualEvidence(check))
+ .filter(
+ (check) =>
+ userReviewState(check) !== 'accepted' &&
+ (isException(check) || hasVisualEvidence(check)),
+ )
.map((check) => check.id),
),
);
@@ -362,8 +396,15 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
// Group-scoped feedback — for concerns that belong to no single check (the
// checks themselves may be accepted) yet must reach the next round.
- const handleGroupFeedback = (category: string, comment: string) =>
- runAction(() => verifyService.addGroupFeedback({ category, comment, id: acceptance.id }));
+ const handleGroupFeedback = (category: string, comment: string, fileIds: string[]) =>
+ runAction(() =>
+ verifyService.addGroupFeedback({
+ category,
+ comment,
+ fileIds: fileIds.length > 0 ? fileIds : undefined,
+ id: acceptance.id,
+ }),
+ );
// The floating bar's one-line state + supporting line — the old banner's
// content, relocated to where the decision actually happens.
@@ -374,7 +415,14 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
: acceptance.status === 'rejected'
? ('rejected' as const)
: ('settled' as const);
- const hasException = counts.exceptions > 0;
+ // Review progress — the bar's dial and wording follow how much of the union
+ // the user has personally signed off, not the verifier's pass tally.
+ const reviewableChecks = checks.filter((check) => check.result);
+ const reviewTotal = reviewableChecks.length;
+ const reviewDone = reviewableChecks.filter(
+ (check) => userReviewState(check) === 'accepted',
+ ).length;
+ const allConfirmed = reviewTotal > 0 && reviewDone >= reviewTotal;
const barTexts = {
accepted: {
statusText: t('acceptance.banner.accepted', {
@@ -392,12 +440,26 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
statusText: t('acceptance.banner.rejected'),
subText: currentRound?.run.decisionDetail?.comment ?? t('acceptance.banner.rejectedHint'),
},
- settled: {
- statusText: hasException
- ? t('acceptance.banner.exceptions', { count: counts.exceptions })
- : t('acceptance.banner.clean', { count: rounds.length }),
- subText: `${countsText} · ${t('acceptance.banner.decisionHint')}`,
- },
+ settled: allConfirmed
+ ? {
+ // The done line stands alone — a grey stats echo under it reads as
+ // an unresolved caveat (review feedback).
+ statusText: t('acceptance.bar.progressDone', { total: reviewTotal }),
+ subText: undefined,
+ }
+ : reviewDone === 0
+ ? {
+ statusText: t('acceptance.bar.progressZero', { total: reviewTotal }),
+ subText: `${countsText} · ${t('acceptance.banner.decisionHint')}`,
+ }
+ : {
+ statusText: t('acceptance.bar.progress', {
+ done: reviewDone,
+ rest: reviewTotal - reviewDone,
+ total: reviewTotal,
+ }),
+ subText: `${countsText} · ${t('acceptance.banner.decisionHint')}`,
+ },
}[barState];
// Every feedback event, flattened for the clearing list: per-check rejects
@@ -409,6 +471,7 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
.filter((review) => review.action === 'reject')
.map((review) => ({
annotationCount: review.annotations?.length || undefined,
+ attachments: review.attachments,
checkId: check.id,
checkSeq: check.seq,
comment: review.comment ?? '',
@@ -420,6 +483,7 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
})),
),
...groupFeedbackEntries.map((entry) => ({
+ attachments: entry.attachments,
comment: entry.comment,
createdAt: entry.createdAt,
groupLabel: entry.category,
@@ -448,6 +512,46 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
subjectTitle: subject.title ?? subject.id,
});
+ // The aggregate-level reject — the whole delivery goes back with a comment.
+ const handleRejectComment = () =>
+ openRejectModal({
+ onConfirm: (comment) => runAction(() => verifyService.rejectDelivery(acceptance.id, comment)),
+ });
+
+ const repairPrompt = buildRepairPrompt(acceptance.id);
+
+ // Hand the repair prompt to the reviewer's clipboard — for pasting to any
+ // agent, not just the origin conversation.
+ const handleCopyReview = async () => {
+ await copyToClipboard(repairPrompt);
+ // Bottom-center — right above the action bar the click came from.
+ toast.success({ placement: 'bottom', title: t('acceptance.bar.copied') });
+ };
+
+ // Dispatch the repair prompt straight into the origin conversation — the
+ // agent reads the feedback itself via the CLI, no hand-summarizing. The
+ // aggregate is stamped `repairing` so the page (and the list) show the
+ // send-back took effect instead of sitting unchanged.
+ const handleRerun = async () => {
+ if (!origin?.topic) return;
+ setRerunPending(true);
+ try {
+ await verifyService.dispatchAcceptanceRepair({
+ agentId: origin.agent?.id,
+ content: repairPrompt,
+ topicId: origin.topic.id,
+ });
+ await verifyService.markAcceptanceRepairing(acceptance.id);
+ await mutate();
+ void globalMutate(verifyKeys.acceptances());
+ toast.success({ placement: 'bottom', title: t('acceptance.bar.rerunSent') });
+ } catch (cause) {
+ toast.error(cause instanceof Error ? cause.message : t('acceptance.actionError'));
+ } finally {
+ setRerunPending(false);
+ }
+ };
+
return (
<Flexbox horizontal className={styles.page}>
{/* The reopen affordance lives at the page corner — no edge handle tab. */}
@@ -501,8 +605,10 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
</Flexbox>
{/* Origin — the conversation this acceptance belongs to (agent +
- topic). Owner-only: the server redacts it for shared links. */}
- {(origin?.agent || origin?.topic) && (
+ topic). Owner-only: the server redacts it for shared links.
+ Hidden in the portal embed: that surface already lives inside
+ the origin conversation. */}
+ {!isEmbedded && (origin?.agent || origin?.topic) && (
<Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
{origin.agent && (
<AgentProfilePopup
@@ -640,34 +746,60 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
</Flexbox>
{/* Check union — the complete inventory, familiar sections (P-14).
- The row wraps so narrow embeds (the chat portal) drop the filter
- controls to a second line instead of crushing the text vertical. */}
- <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>
+ Narrow surfaces (the chat portal embed, sub-lg viewports) trade
+ the Segmented for a compact Select so the toolbar stays one
+ line; wide viewports keep the glanceable Segmented. */}
+ <Flexbox horizontal align={'center'} gap={8} wrap={compactToolbar ? 'nowrap' : 'wrap'}>
<Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>
{t('acceptance.checks.title')}
</Text>
<span className={styles.countBadge}>{counts.total}</span>
<Flexbox flex={1} />
- <Segmented
- size={'small'}
- value={filter}
- options={[
- { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
- {
- label: t('acceptance.filter.pending', { count: counts.pending }),
- value: 'pending',
- },
- {
- label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
- value: 'needsFix',
- },
- {
- label: t('acceptance.filter.accepted', { count: counts.accepted }),
- value: 'accepted',
- },
- ]}
- onChange={(value) => setFilter(value as CheckFilter)}
- />
+ {compactToolbar ? (
+ <Select
+ size={'small'}
+ style={{ height: 34, width: 118 }}
+ value={filter}
+ variant={'filled'}
+ options={[
+ { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
+ {
+ label: t('acceptance.filter.pending', { count: counts.pending }),
+ value: 'pending',
+ },
+ {
+ label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
+ value: 'needsFix',
+ },
+ {
+ label: t('acceptance.filter.accepted', { count: counts.accepted }),
+ value: 'accepted',
+ },
+ ]}
+ onChange={(value) => setFilter(value as CheckFilter)}
+ />
+ ) : (
+ <Segmented
+ size={'small'}
+ value={filter}
+ options={[
+ { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },
+ {
+ label: t('acceptance.filter.pending', { count: counts.pending }),
+ value: 'pending',
+ },
+ {
+ label: t('acceptance.filter.needsFix', { count: counts.needsFix }),
+ value: 'needsFix',
+ },
+ {
+ label: t('acceptance.filter.accepted', { count: counts.accepted }),
+ value: 'accepted',
+ },
+ ]}
+ onChange={(value) => setFilter(value as CheckFilter)}
+ />
+ )}
{/* Which round touched a check — audit slicing, orthogonal to the
review-state segments. */}
{rounds.length > 1 && (
@@ -746,14 +878,20 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
queueing feedback are the author's calls, never a visitor's. */}
{isOwner && (
<DecisionBar
+ acceptedCount={reviewDone}
feedbackCount={activeFeedbackCount}
- hasException={hasException}
pending={pending}
+ rerunAvailable={Boolean(origin?.topic)}
+ rerunPending={rerunPending}
state={barState}
statusText={barTexts.statusText}
subText={barTexts.subText}
+ totalCount={reviewTotal}
onAccept={handleAccept}
+ onCopyReview={handleCopyReview}
onOpenFeedback={() => setFeedbackOpen(true)}
+ onRejectComment={handleRejectComment}
+ onRerun={handleRerun}
/>
)}
<Flexbox style={{ height: 8 }} />
@@ -769,24 +907,46 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept
{/* Round ledger — audit detail, off the decision path (P-13). No edge
handle: opening happens from the page-corner toggle, closing from the
- ledger's own header action. */}
- <DraggablePanel
- defaultSize={{ width: 340 }}
- expand={ledgerExpand}
- minWidth={300}
- placement={'right'}
- style={{ flex: 'none', height: '100%' }}
- onExpandChange={setLedgerExpand}
- >
- <Flexbox style={{ height: '100%', overflow: 'auto' }}>
+ ledger's own header action. On narrow viewports it opens as a masked
+ drawer over the report — dismissable by tapping outside — instead of
+ shrinking the report into an unreadable column. */}
+ {isNarrowViewport ? (
+ <Drawer
+ noHeader
+ containerMaxWidth={'100%'}
+ open={ledgerExpand}
+ placement={'right'}
+ styles={{ body: { padding: 0 } }}
+ width={'min(340px, 88vw)'}
+ onClose={() => setLedgerExpand(false)}
+ >
<LedgerPanel
+ hideCollapse
highlight={highlightRound}
rounds={rounds}
onCollapse={() => setLedgerExpand(false)}
onOpenReport={setReportRound}
/>
- </Flexbox>
- </DraggablePanel>
+ </Drawer>
+ ) : (
+ <DraggablePanel
+ defaultSize={{ width: 340 }}
+ expand={ledgerExpand}
+ minWidth={300}
+ placement={'right'}
+ style={{ flex: 'none', height: '100%' }}
+ onExpandChange={setLedgerExpand}
+ >
+ <Flexbox style={{ height: '100%', overflow: 'auto' }}>
+ <LedgerPanel
+ highlight={highlightRound}
+ rounds={rounds}
+ onCollapse={() => setLedgerExpand(false)}
+ onOpenReport={setReportRound}
+ />
+ </Flexbox>
+ </DraggablePanel>
+ )}
{/* Per-round report drill-down — the full verify run view, not a
markdown excerpt: same content as /verify/:runId, opened in place.
diff --git a/src/features/Verify/Acceptance/modals.tsx b/src/features/Verify/Acceptance/modals.tsx
index 34150e74f0a..d1c8299e3c7 100644
--- a/src/features/Verify/Acceptance/modals.tsx
+++ b/src/features/Verify/Acceptance/modals.tsx
@@ -7,6 +7,8 @@ import { t } from 'i18next';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { AttachmentStrip, AttachmentUploadButton, useFeedbackAttachments } from './attachments';
+
const styles = createStaticStyles(({ css }) => ({
warning: css`
padding-block: 10px;
@@ -16,6 +18,15 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
+/**
+ * A frosted scrim for the acceptance decision dialogs — the page behind reads
+ * as a soft blur so the dialog owns focus (matches the antd modal mask, which
+ * already blurs). Applied per-modal via `styles.backdrop`; a global backdrop
+ * rule can't be used because base-ui popups (Select/Menu lists) share the same
+ * `role=presentation` element and would frost their own content.
+ */
+export const frostedModalStyles = { backdrop: { backdropFilter: 'blur(4px)' } };
+
interface AcceptContentProps {
/** Titles of the exceptions the user is knowingly accepting with. */
exceptions: string[];
@@ -76,6 +87,7 @@ export const openAcceptModal = (options: AcceptContentProps): ModalInstance =>
content: <AcceptContent {...options} />,
footer: null,
maskClosable: true,
+ styles: frostedModalStyles,
title: t('acceptance.actions.accept', { ns: 'verify' }),
width: 'min(90vw, 480px)',
});
@@ -138,14 +150,15 @@ export const openRejectModal = (options: RejectContentProps): ModalInstance =>
content: <RejectContent {...options} />,
footer: null,
maskClosable: true,
+ styles: frostedModalStyles,
title: t('acceptance.actions.reject', { ns: 'verify' }),
width: 'min(90vw, 480px)',
});
interface GroupFeedbackContentProps {
groupLabel: string;
- /** Record the feedback; resolve true to close. */
- onConfirm: (comment: string) => Promise<boolean>;
+ /** Record the feedback (note + any screenshots); resolve true to close. */
+ onConfirm: (comment: string, fileIds: string[]) => Promise<boolean>;
}
const GroupFeedbackContent = memo<GroupFeedbackContentProps>(({ groupLabel, onConfirm }) => {
@@ -153,13 +166,15 @@ const GroupFeedbackContent = memo<GroupFeedbackContentProps>(({ groupLabel, onCo
const { close } = useModalContext();
const [comment, setComment] = useState('');
const [loading, setLoading] = useState(false);
+ const { attachments, fileIds, handlePaste, remove, uploadFiles, uploading } =
+ useFeedbackAttachments();
const handleConfirm = async () => {
const trimmed = comment.trim();
if (!trimmed) return;
setLoading(true);
try {
- if (await onConfirm(trimmed)) close();
+ if (await onConfirm(trimmed, fileIds)) close();
} finally {
setLoading(false);
}
@@ -170,18 +185,31 @@ const GroupFeedbackContent = memo<GroupFeedbackContentProps>(({ groupLabel, onCo
<Text fontSize={13} type={'secondary'}>
{translate('acceptance.group.feedbackDescription', { label: groupLabel })}
</Text>
- <TextArea
- autoSize={{ maxRows: 8, minRows: 3 }}
- placeholder={translate('acceptance.group.feedbackPlaceholder')}
- value={comment}
- onChange={(event) => setComment(event.target.value)}
- />
- <Flexbox horizontal gap={8} justify={'flex-end'}>
+ <Flexbox gap={8}>
+ <TextArea
+ autoSize={{ maxRows: 8, minRows: 3 }}
+ placeholder={translate('acceptance.group.feedbackPlaceholder')}
+ value={comment}
+ onChange={(event) => setComment(event.target.value)}
+ onPaste={handlePaste}
+ />
+ {/* One row hugging the input — attachments belong to the note. */}
+ <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>
+ <AttachmentStrip
+ attachments={attachments}
+ disabled={loading}
+ uploading={uploading}
+ onRemove={remove}
+ />
+ <AttachmentUploadButton disabled={loading} onFiles={uploadFiles} />
+ </Flexbox>
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8} justify={'flex-end'}>
<Button disabled={loading} onClick={close}>
{translate('acceptance.actions.cancel')}
</Button>
<Button
- disabled={!comment.trim()}
+ disabled={!comment.trim() || uploading}
loading={loading}
type={'primary'}
onClick={handleConfirm}
@@ -204,6 +232,7 @@ export const openGroupFeedbackModal = (options: GroupFeedbackContentProps): Moda
content: <GroupFeedbackContent {...options} />,
footer: null,
maskClosable: true,
+ styles: frostedModalStyles,
title: t('acceptance.group.feedbackTitle', { ns: 'verify' }),
width: 'min(90vw, 520px)',
});
diff --git a/src/services/verify.ts b/src/services/verify.ts
index 64a43e73721..ac93849e95b 100644
--- a/src/services/verify.ts
+++ b/src/services/verify.ts
@@ -159,6 +159,7 @@ export class VerifyService {
annotations?: AcceptanceReviewAnnotation[];
checkItemIds: string[];
comment?: string;
+ fileIds?: string[];
id: string;
}) => lambdaClient.acceptance.reviewChecks.mutate(input);
@@ -166,8 +167,28 @@ export class VerifyService {
* Feedback addressed to a check group (business category) — for concerns
* that belong to no single check yet must reach the next round.
*/
- addGroupFeedback = (input: { category: string; comment: string; id: string }) =>
- lambdaClient.acceptance.addGroupFeedback.mutate(input);
+ addGroupFeedback = (input: {
+ category: string;
+ comment: string;
+ fileIds?: string[];
+ id: string;
+ }) => lambdaClient.acceptance.addGroupFeedback.mutate(input);
+
+ /**
+ * Dispatch the repair prompt straight into the acceptance's origin
+ * conversation — a user message that triggers the agent, the same callback
+ * channel remote hetero runs (`lh notify`) use.
+ */
+ dispatchAcceptanceRepair = (input: { agentId?: string; content: string; topicId: string }) =>
+ lambdaClient.agentNotify.notify.mutate({
+ agentId: input.agentId,
+ content: input.content,
+ role: 'user',
+ topicId: input.topicId,
+ });
+
+ /** Stamp the aggregate `repairing` after the send-back dispatch. */
+ markAcceptanceRepairing = (id: string) => lambdaClient.acceptance.markRepairing.mutate({ id });
// ---- per-run plan ----
getVerifyState = (operationId: string): Promise<VerifyStateResponse | null> =>
diff --git a/src/styles/antdOverride.ts b/src/styles/antdOverride.ts
index 7a626449622..e8c2acd6e7f 100644
--- a/src/styles/antdOverride.ts
+++ b/src/styles/antdOverride.ts
@@ -19,13 +19,15 @@ const antdOverride = ({ token }: { prefixCls: string; token: Theme }) => css`
backdrop-filter: blur(2px);
}
- ${isDesktop &&
- css`
- .${token.prefixCls}-modal-mask.${token.prefixCls}-modal-mask-blur {
- background: ${rgba(token.colorBgLayout, 0.8)} !important;
- backdrop-filter: none !important;
- }
- `}
+ ${
+ isDesktop &&
+ css`
+ .${token.prefixCls}-modal-mask.${token.prefixCls}-modal-mask-blur {
+ background: ${rgba(token.colorBgLayout, 0.8)} !important;
+ backdrop-filter: none !important;
+ }
+ `
+ }
`;
export default antdOverride;