-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: add active branch context when page selected #2911
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
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis PR integrates frame data into chat context generation, adds branch-aware prompt handling in the AI prompt provider, consolidates prompt constants/export surfaces, updates prompt/test copy, and performs minor import cleanups and a whitespace change. Public exports shift toward a centralized constants module; provider signatures expand to include message indices and branch helpers. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as Editor UI
participant Sel as Selection Tracker
participant Ctx as Context Generator
participant Chat as Chat Store
participant Svc as Chat Service
participant Prov as Prompt Provider
participant LLM as Model
UI->>Sel: User updates selection (elements, frames)
Sel-->>Ctx: Reaction emits {elements, frames}
Ctx->>Ctx: Build highlighted + branch context (from frames + elements)
Ctx-->>Chat: Context payload
Chat->>Svc: Send messages + context
Svc->>Prov: Hydrate system/user prompts with contexts
Prov->>Prov: Include files/highlights/errors + branch tags
Prov-->>Svc: Final prompt
Svc-->>LLM: Invoke
LLM-->>Svc: Response
Svc-->>Chat: Update conversation
sequenceDiagram
autonumber
participant Ctx as Contexts
participant Prov as Prompt Provider
participant Build as Builders
Ctx-->>Prov: Message contexts (FILE, HIGHLIGHT, ERROR, PROJECT, IMAGE, BRANCH)
Prov->>Build: getFilesContent(...branchId)
Build-->>Prov: File blocks + getBranchContent(id)
Prov->>Build: getHighlightsContent(...branchId)
Build-->>Prov: Highlight blocks + branch tags
Prov->>Build: getErrorsContent(...branchId)
Build-->>Prov: Error blocks + branch tags
Prov->>Prov: getBranchesContent(branches[])
Prov-->>Prov: Hydrated user message including branches
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (14)
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. Comment |
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Important
Enhance chat context with active branch information and refactor prompt structure for better organization.
ChatContextincontext.tsnow includes active branch context when generating chat context from selected elements and frames.getBranchContext()updated to derive branch IDs from both highlighted context and frames.prompt/constantsdirectory.provider.ts,onlook-instructions.ts, andsuggestion.tsto reflect new prompt file structure.context.tsandsystem.tsfor clarity.route.ts.This description was created by
for 3a0c36a. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
New Features
Improvements
Refactor
Tests