Skip to content

feat: render structured request log content, close #1698#1711

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
May 25, 2026
Merged

feat: render structured request log content, close #1698#1711
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented May 25, 2026

Copy link
Copy Markdown
Owner

@greptile-apps

greptile-apps Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds structured rendering for base64-encoded images inside the JSON tree view, allowing API responses (e.g. from image-generation or vision APIs) to be displayed inline with size metadata and a raw/image toggle.

  • Adds detectImageSource which identifies base64 images via data URL pattern or sibling media_type field lookup, with explicit SVG exclusion to prevent script execution when images are opened as links.
  • Adds formatBytesFromBase64 for human-readable size display, and updates JsonValue to accept name and parentData props so sibling fields can inform MIME type detection.
  • Replaces the showParsed / isExpanded guard pattern for the raw toggle with a cleaner showRawString flag that is always visible in raw mode.

Confidence Score: 5/5

The new image-rendering path is well-guarded: SVG is excluded from both the data URL and sibling media_type branches, bare base64 detection requires a cooperative field name plus an explicit image MIME type from a sibling key, and the raw/image toggle is always reachable regardless of collapsed state.

The changes are self-contained within a single display component. Detection logic is defensively written — it prefers false negatives over false positives, and the previously identified SVG XSS and toggle-accessibility concerns have been addressed in this PR. No correctness or security regressions were found in the new code paths.

No files require special attention.

Important Files Changed

Filename Overview
frontend/src/components/json-tree-view.tsx Adds image detection/rendering logic with proper SVG exclusion and a reworked raw/image toggle; no new correctness issues found.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[JsonValue receives name/data/parentData] --> B{dataType === 'string'?}
    B -- No --> Z[Render number/boolean/null]
    B -- Yes --> C[detectImageSource]
    C --> D{data URL pattern match?}
    D -- Yes, non-SVG --> E[Return cleaned data URL]
    D -- Yes, SVG --> F[Return null]
    D -- No --> G{sibling media_type or b64_json name?}
    G -- No --> F
    G -- Yes --> H{imageMimePattern + isLikelyImageFieldName + valid base64?}
    H -- Yes --> I[Return data:mime;base64,...]
    H -- No --> F
    E --> J{imageSource truthy and showRawString false?}
    I --> J
    F --> K[tryParseJson]
    K --> L{parsedJson truthy and showRawString false?}
    J -- Yes --> M[Render inline image + size + raw button]
    J -- No --> L
    L -- Yes --> N[Render embedded JsonNode + raw button]
    L -- No --> O[Render raw string with optional image/parse toggle]
Loading

Reviews (2): Last reviewed commit: "feat: render structured request log cont..." | Re-trigger Greptile

Comment thread frontend/src/components/json-tree-view.tsx
Comment thread frontend/src/components/json-tree-view.tsx Outdated
Comment thread frontend/src/components/json-tree-view.tsx

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@looplj looplj merged commit 2765f12 into unstable May 25, 2026
4 checks passed
junjiangao pushed a commit to junjiangao/axonhub that referenced this pull request May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant