-
Notifications
You must be signed in to change notification settings - Fork 1
fix: render buyer-facing image evidence #307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e02cb11
b0edd9b
116a8dc
5deb067
313d38a
a4d1de5
49d85d0
516603c
e5ee5db
9e17c2a
fbecd77
ef6f2b0
390c8c4
d11fae2
ff562a9
6bb6d4e
a1b99a1
b818ef8
3131868
20b904a
f7b5140
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| ## Fixed | ||
|
|
||
| - Keep contextual-orchestrator, OIDC, RankWeave, TEPP, and durable-ingestion diagnostics behind stable product error boundaries while retaining the original exception for server-side chaining. | ||
| - Route browser transport and tenant-settings failures through the same boundary so 5xx provider details never reach buyer-facing error text. | ||
| - Keep browser 5xx and transport failures behind the same stable client error boundary. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,14 +4,16 @@ import type { PostContentUnit, PostImageContent } from "./api"; | |||||
| import type { ReactNode } from "react"; | ||||||
|
|
||||||
| function parsePipeDelimitedTable(text: string): string[][] | null { | ||||||
| const rows = text | ||||||
| const parsedRows = text | ||||||
| .split(/\r?\n/) | ||||||
| .map((row) => { | ||||||
| const cells = row.split("|").map((cell) => cell.trim()); | ||||||
| const cells = row.split(/(?<!\\)\|/).map((cell) => cell.trim().replace(/\\\|/g, "|")); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Escaped-pipe split depends on regex lookbehind Cell splitting uses negative lookbehind Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| if (cells[0] === "") cells.shift(); | ||||||
| if (cells[cells.length - 1] === "") cells.pop(); | ||||||
| return cells; | ||||||
| }) | ||||||
| }); | ||||||
| if (!parsedRows.some((row) => row.every((cell) => /^:?-{3,}:?$/.test(cell)))) return null; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Blank line makes unmarked OCR render as a table with an invented header A blank or whitespace-only line becomes an empty cell array, and
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| const rows = parsedRows | ||||||
| .filter((row) => !row.every((cell) => /^:?-{3,}:?$/.test(cell))) | ||||||
| .filter((row) => row.length > 1 && row.some(Boolean)); | ||||||
| if (rows.length < 2 || rows.some((row) => row.length !== rows[0].length)) return null; | ||||||
|
|
@@ -22,10 +24,20 @@ function parsePipeDelimitedTable(text: string): string[][] | null { | |||||
| function renderImageText(text: string) { | ||||||
| const rows = parsePipeDelimitedTable(text); | ||||||
| if (!rows) return <p>{text}</p>; | ||||||
| const [header, ...bodyRows] = rows; | ||||||
| return ( | ||||||
| <table className="post-body-table post-image-text-table"> | ||||||
| <thead> | ||||||
| <tr> | ||||||
| {header.map((cell, cellIndex) => ( | ||||||
| <th key={`post-image-text-header-${cellIndex}`} scope="col"> | ||||||
| {cell} | ||||||
| </th> | ||||||
| ))} | ||||||
| </tr> | ||||||
| </thead> | ||||||
| <tbody> | ||||||
| {rows.map((row, rowIndex) => ( | ||||||
| {bodyRows.map((row, rowIndex) => ( | ||||||
| <tr key={`post-image-text-row-${rowIndex}`}> | ||||||
| {row.map((cell, cellIndex) => ( | ||||||
| <td key={`post-image-text-cell-${rowIndex}-${cellIndex}`}>{cell}</td> | ||||||
|
|
@@ -72,7 +84,14 @@ function renderImageEvidence( | |||||
| <ol> | ||||||
| {imageContent.regions.map((region) => ( | ||||||
| <li key={region.region_index}> | ||||||
| <span>{region.caption || region.extracted_text || t("Unknown")}</span> | ||||||
| {region.caption ? <p>{region.caption}</p> : null} | ||||||
| {region.extracted_text ? ( | ||||||
| <div className="post-image-region-text"> | ||||||
| {renderImageText(region.extracted_text)} | ||||||
| </div> | ||||||
| ) : region.caption ? null : ( | ||||||
| t("Unknown") | ||||||
| )} | ||||||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||||||
| {region.tags.length ? ( | ||||||
| <small> | ||||||
| {t("Image tags")}: {region.tags.join(", ")} | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Changelog and ADR edits are unrelated to the image-evidence change
The PR is titled "render buyer-facing image evidence" and the author description references ADR 0110, yet the non-code edits in this PR touch 2.12.6-provider-error-boundary.md and 0123-provider-error-boundary.md, both concerning the provider/browser error boundary rather than image rendering. The changelog line addition describes routing transport/tenant-settings failures through the error boundary, and the ADR change is a whitespace reflow. These appear to be leftover or misplaced doc edits that do not correspond to the code change; worth confirming they belong in this PR.
Was this helpful? React with 👍 or 👎 to provide feedback.