Skip to content

Conversation

@sawka
Copy link
Member

@sawka sawka commented Nov 19, 2025

  • roundtrip image filenames correctly
  • fix scrolling issue where the thumbs-up/thumbs-down buttons were cut off
  • update ai-sdk / ai-sdk react to current versions
  • fix a focus issue when moving to AI panel using ctrl:shift:arrowleft

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

This pull request modifies scrolling behavior in the AI panel to trigger bottom-scrolling when streaming status transitions end, adds delayed refocus timing adjustments to keyboard navigation logic, updates AI SDK dependencies, and enhances image content handling in OpenAI message conversion by introducing filename propagation while updating content sanitization logic to properly process input_image blocks with filenames.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Image content handling changes (openai-backend.go and openai-convertmessage.go): Requires careful verification that the filename propagation logic and the updated content cleaning conditions interact correctly, particularly the change to when PreviewUrl and Filename are cleared for input_image type content.
  • Focus timing behavior (keymodel.ts): The new 10ms delayed refocus calls need verification that they resolve focus issues without introducing timing-related regressions, especially given the existing immediate focus call pattern.
  • Dependency updates (package.json): Version bumps to @ai-sdk/react and ai packages should be checked for breaking changes or API compatibility with the existing integration points.
  • Status transition scroll behavior (aipanelmessages.tsx): Verify the animation frame-based scroll-to-bottom logic handles all status transition cases and doesn't conflict with existing scroll management.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'various AI updates' is vague and generic, using non-descriptive terms that don't convey meaningful information about the specific changes in the changeset. Consider using a more specific title that highlights the primary change, such as 'Fix AI panel scrolling and image filename handling' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset, listing four specific updates that correspond to the file changes: image filename roundtripping, scrolling fixes, dependency updates, and focus handling.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawka/updates-nov19

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/app/store/keymodel.ts (1)

239-241: Consider extracting the 10ms delay constant.

The delayed refocus pattern correctly addresses the focus issue when navigating to the AI panel. However, the 10ms delay appears multiple times in this file (lines 225, 241, 257, 262). Consider extracting it to a named constant for better maintainability.

Apply this diff to extract the constant:

+const REFOCUS_DELAY_MS = 10;
+
 function getFocusedBlockInStaticTab() {
     const layoutModel = getLayoutModelForStaticTab();

Then update the setTimeout calls to use REFOCUS_DELAY_MS instead of hardcoded 10.

Also applies to: 255-257

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd6389d and df67ba7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • frontend/app/aipanel/aipanelmessages.tsx (2 hunks)
  • frontend/app/store/keymodel.ts (2 hunks)
  • package.json (2 hunks)
  • pkg/aiusechat/openai/openai-backend.go (1 hunks)
  • pkg/aiusechat/openai/openai-convertmessage.go (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/app/store/keymodel.ts (1)
frontend/app/store/focusManager.ts (1)
  • FocusManager (11-93)
frontend/app/aipanel/aipanelmessages.tsx (1)
frontend/app/aipanel/waveai-model.tsx (1)
  • scrollToBottom (280-282)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build for TestDriver.ai
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (4)
frontend/app/aipanel/aipanelmessages.tsx (1)

21-21: LGTM! Scroll-to-bottom on streaming completion is well-implemented.

The use of requestAnimationFrame ensures the scroll happens after DOM updates, which should fix the issue where thumbs-up/thumbs-down buttons were cut off. The prevStatusRef pattern correctly tracks the previous status value.

Minor note: The initialization of prevStatusRef with the current status means on first render, there's no truly "previous" value. This is fine since the first render won't have a transition from streaming, but it's worth being aware of this behavior.

Also applies to: 45-56

pkg/aiusechat/openai/openai-backend.go (1)

96-106: LGTM! Filename sanitization logic is correct.

The updated clean() method properly handles the new Filename field for image content. The logic ensures that both PreviewUrl and Filename (for input_image types) are stripped before sending to the OpenAI API, while preserving them internally for roundtrip handling.

The condition correctly identifies when cleaning is needed:

  • When PreviewUrl is present
  • When Type is input_image and Filename is present

Both internal fields are properly cleared before API transmission.

pkg/aiusechat/openai/openai-convertmessage.go (1)

48-48: LGTM! Filename propagation completes the roundtrip flow.

The changes ensure image filenames are correctly preserved through the conversion pipeline:

  • Line 321: Converts from AI format to OpenAI format, preserving FileNameFilename
  • Line 48: Converts from stored OpenAI format back to UI format, preserving FilenameFileName

This works correctly with the backend sanitization that strips Filename before API transmission while keeping it in stored messages.

Also applies to: 321-321

package.json (1)

92-92: Versions verified—these are safe, non-breaking updates.

Both @ai-sdk/react@2.0.92 and ai@5.0.92 exist and contain only patch-level changes adding finishReason to the useChat onFinish callback. No breaking changes detected.

@sawka sawka merged commit 6420ae9 into main Nov 19, 2025
8 checks passed
@sawka sawka deleted the sawka/updates-nov19 branch November 19, 2025 21:01
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.

2 participants