Skip to content

fix: playground studios + admin responsive - #1945

Merged
smakosh merged 2 commits into
mainfrom
fix/playground-studios-admin-responsive
Mar 30, 2026
Merged

smakosh merged 2 commits into
mainfrom
fix/playground-studios-admin-responsive

Conversation

@smakosh

@smakosh smakosh commented Mar 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Image studio: Replace createUIMessageStreamResponse with plain JSON response for generateImage results, fixing "Failed to process successful response" error
  • Video studio: Always use proxy URL for video content and add Range request support (forwarding Range header, returning 206/Content-Range/Accept-Ranges) for proper browser playback
  • Admin email dialog: Add max-h-[300px] overflow-y-auto to email body textarea and max-h-[90dvh] overflow-y-auto to dialog content
  • Admin reply form: Add max-h-[400px] overflow-y-auto to reply body textarea
  • Admin mobile responsive: Responsive search inputs (w-full sm:w-64), stacking pagination controls, wrapping action buttons, and scrollable tabs across all pages

Test plan

  • Generate an image in Image Studio with Gemini 3.1 Flash Image — should succeed without "Failed to process successful response"
  • Generate a video in Video Studio — video should play in the browser without loading forever
  • Open Send Email dialog in org detail, generate AI draft — textarea should scroll, dialog should not overflow viewport
  • Open contact submission reply form, generate AI draft — textarea should scroll within max height
  • Resize browser to mobile width on all admin pages — search inputs, pagination, tabs, and buttons should adapt

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for partial video content delivery.
  • Bug Fixes

    • Improved image generation response handling for faster result delivery.
    • Enhanced video gallery URL assignment.
  • Improvements

    • Made admin interface more mobile-responsive across contact submissions, models, and organizations pages.
    • Added scrolling support to text input fields in dialogs and forms for better usability with longer content.

- Image studio: return JSON instead of UIMessageStream
  for generateImage responses, fixing "Failed to process
  successful response" error
- Video studio: always use proxy URL for video content
  and support Range requests for proper browser playback
- Admin: email dialog textarea max-height + scrollable
- Admin: responsive search inputs, pagination, tabs,
  and action buttons across all pages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The PR converts image generation from streaming SSE responses to single JSON payloads, adds HTTP Range header support for video partial-content streaming with proper status/header proxying, and applies responsive layout improvements across admin dashboard components.

Changes

Cohort / File(s) Summary
Image/Video API & Client Changes
apps/playground/src/app/api/chat/route.ts, apps/playground/src/components/playground/image-page-client.tsx, apps/playground/src/app/api/video/[videoId]/content/route.ts, apps/playground/src/components/playground/video-page-client.tsx
Converted image generation from streaming SSE/UI-message format to single JSON response ({ images: [{ base64, mediaType }] }); added HTTP Range header forwarding and 206 partial-content handling for video streaming; updated client to parse single JSON instead of streaming chunks; changed video URL fallback to use API route instead of direct content URL.
Admin UI Responsive Layout
ee/admin/src/app/contact-submissions/page.tsx, ee/admin/src/app/model-provider-mappings/page.tsx, ee/admin/src/app/models/page.tsx, ee/admin/src/app/organizations/page.tsx, ee/admin/src/app/organizations/[orgId]/page.tsx
Refactored search form and pagination containers to use responsive Tailwind classes (w-full/sm:w-auto, flex-1/sm:flex-initial, flex-col/sm:flex-row) for stacking on small screens and horizontal layout on larger screens.
Admin UI Component Sizing
ee/admin/src/app/contact-submissions/[id]/reply-form.tsx, ee/admin/src/app/organizations/[orgId]/send-email-dialog.tsx
Added max-h and overflow-y-auto constraints to textarea and modal components for better scrolling behavior on content overflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

auto-merge

Suggested reviewers

  • steebchen
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and overly broad, using generic phrasing that doesn't convey the specific primary changes. Terms like 'studios' lack clarity. Consider a more specific title that highlights the main fix, such as: 'fix: image generation response format and responsive admin UI' or focus on the primary issue being addressed.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/playground-studios-admin-responsive

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/playground/src/components/playground/image-page-client.tsx (1)

306-315: Route this new JSON path through the typed API client.

This response is still consumed via raw fetch() + unchecked response.json(), so the /api/chat contract remains runtime-only even after the SSE→JSON switch. Please move this call to useFetchClient() / useApi() so request and response typing catch the next shape drift earlier.

As per coding guidelines, apps/{ui,playground,code,admin}/src/**/*.{ts,tsx}: In frontend apps, always use the generated typed API client (useFetchClient() or useApi()) to call the API; never use raw fetch() for API calls.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/playground/src/components/playground/image-page-client.tsx` around lines
306 - 315, The code currently reads the API body with response.json() and
inspects generatedImages directly, leaving the /api/chat contract untyped;
replace this raw fetch usage with the generated typed API client by calling
useFetchClient() or useApi() (whichever the app uses) to invoke the same
endpoint and consume the typed response shape, then update the logic that checks
the returned images (the generatedImages variable and its existence/length
check) to use the typed response properties instead of response.json(); ensure
the request arguments and error handling mirror the previous behavior but rely
on the typed client so TypeScript will catch any future shape drift for the
/api/chat response.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/playground/src/app/api/video/`[videoId]/content/route.ts:
- Around line 67-71: The response headers currently set "Accept-Ranges" to
"bytes" in the headers object, which incorrectly advertises byte-range support;
update the headers in the route handler by removing the "Accept-Ranges" entry
(or if you prefer to keep it as a placeholder add a TODO comment) so that the
headers Record<string,string> (variable name: headers) no longer claims range
support until the upstream gateway actually handles Range requests; locate the
headers constant in route.ts and either delete the "Accept-Ranges" key or
replace it with a commented TODO noting future gateway Range support.

In `@ee/admin/src/app/models/page.tsx`:
- Around line 127-130: The form with action={handleSearch} uses className="flex
w-full items-center gap-2 sm:w-auto" but its parent wrapper is not width-aware
so w-full doesn't expand on mobile; to fix, make the parent wrapper a
width-aware block (e.g., add className="w-full" or "flex-1 w-full") or change
the form to be a block-level flexible child (e.g., replace "flex w-full" with
"flex-1 w-full" or ensure the immediate wrapper element has "w-full") so the
form truly takes full width on small screens while keeping sm:w-auto for larger
breakpoints.

---

Nitpick comments:
In `@apps/playground/src/components/playground/image-page-client.tsx`:
- Around line 306-315: The code currently reads the API body with
response.json() and inspects generatedImages directly, leaving the /api/chat
contract untyped; replace this raw fetch usage with the generated typed API
client by calling useFetchClient() or useApi() (whichever the app uses) to
invoke the same endpoint and consume the typed response shape, then update the
logic that checks the returned images (the generatedImages variable and its
existence/length check) to use the typed response properties instead of
response.json(); ensure the request arguments and error handling mirror the
previous behavior but rely on the typed client so TypeScript will catch any
future shape drift for the /api/chat response.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2548da62-12c0-47d2-86a7-2dfbb7fda7c2

📥 Commits

Reviewing files that changed from the base of the PR and between 5519752 and dab07e1.

📒 Files selected for processing (11)
  • apps/playground/src/app/api/chat/route.ts
  • apps/playground/src/app/api/video/[videoId]/content/route.ts
  • apps/playground/src/components/playground/image-page-client.tsx
  • apps/playground/src/components/playground/video-page-client.tsx
  • ee/admin/src/app/contact-submissions/[id]/reply-form.tsx
  • ee/admin/src/app/contact-submissions/page.tsx
  • ee/admin/src/app/model-provider-mappings/page.tsx
  • ee/admin/src/app/models/page.tsx
  • ee/admin/src/app/organizations/[orgId]/page.tsx
  • ee/admin/src/app/organizations/[orgId]/send-email-dialog.tsx
  • ee/admin/src/app/organizations/page.tsx

Comment on lines +67 to +71
const headers: Record<string, string> = {
"Content-Type": response.headers.get("Content-Type") ?? "video/mp4",
"Cache-Control": "private, max-age=3600",
"Accept-Ranges": "bytes",
};

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.

⚠️ Potential issue | 🟡 Minor

Accept-Ranges: bytes header may be misleading.

Setting Accept-Ranges: bytes advertises to browsers that this endpoint supports byte-range requests. However, since the upstream gateway doesn't support Range requests (always returns full content with 200), browsers may waste resources retrying partial requests that never succeed.

Consider either:

  1. Removing Accept-Ranges until the gateway supports it
  2. Adding a TODO comment noting this is preparation for future gateway Range support
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/playground/src/app/api/video/`[videoId]/content/route.ts around lines 67
- 71, The response headers currently set "Accept-Ranges" to "bytes" in the
headers object, which incorrectly advertises byte-range support; update the
headers in the route handler by removing the "Accept-Ranges" entry (or if you
prefer to keep it as a placeholder add a TODO comment) so that the headers
Record<string,string> (variable name: headers) no longer claims range support
until the upstream gateway actually handles Range requests; locate the headers
constant in route.ts and either delete the "Accept-Ranges" key or replace it
with a commented TODO noting future gateway Range support.

Comment on lines +127 to +130
<form
action={handleSearch}
className="flex w-full items-center gap-2 sm:w-auto"
>

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.

⚠️ Potential issue | 🟡 Minor

Form full-width behavior is constrained by the parent container.

At Line 126, the parent wrapper is not width-aware, so w-full on the form may not actually expand on mobile. This can blunt the responsive fix.

💡 Suggested fix
-				<div className="flex items-center gap-3">
+				<div className="flex w-full items-center gap-3 sm:w-auto">
 					<form
 						action={handleSearch}
 						className="flex w-full items-center gap-2 sm:w-auto"
 					>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ee/admin/src/app/models/page.tsx` around lines 127 - 130, The form with
action={handleSearch} uses className="flex w-full items-center gap-2 sm:w-auto"
but its parent wrapper is not width-aware so w-full doesn't expand on mobile; to
fix, make the parent wrapper a width-aware block (e.g., add className="w-full"
or "flex-1 w-full") or change the form to be a block-level flexible child (e.g.,
replace "flex w-full" with "flex-1 w-full" or ensure the immediate wrapper
element has "w-full") so the form truly takes full width on small screens while
keeping sm:w-auto for larger breakpoints.

@smakosh smakosh self-assigned this Mar 30, 2026
@smakosh
smakosh enabled auto-merge March 30, 2026 19:05
@smakosh
smakosh added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit f7bd3f2 Mar 30, 2026
10 checks passed
@smakosh
smakosh deleted the fix/playground-studios-admin-responsive branch March 30, 2026 19:19
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