-
-
Notifications
You must be signed in to change notification settings - Fork 254
Improve bit Boilerplate system prompts page (#11316) #11317
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
|
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. Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughRefactors single-prompt workflow to a multi-prompt model across client, server, and shared layers: UI now iterates and edits multiple prompts via a pivot; server endpoint exposes a queryable collection; shared interface and JSON context updated to use lists. Save now targets a specific prompt instance. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Page as SystemPromptsPage (Client)
participant ICtrl as IChatbotController (Shared)
participant API as ChatbotController (Server)
participant DB as DbContext
User->>Page: Navigate to System Prompts
Page->>ICtrl: GetSystemPrompts(cancellationToken)
ICtrl->>API: HTTP GET /chatbot/systemprompts
API->>DB: Query SystemPrompts (Project, IQueryable)
DB-->>API: IQueryable<SystemPromptDto>
API-->>ICtrl: 200 OK (List/Queryable)
ICtrl-->>Page: List<SystemPromptDto>
Page->>Page: Render BitPivot with items
rect rgb(232,246,255)
note right of User: Per-item save
User->>Page: Click Save (prompt X)
Page->>ICtrl: UpdateSystemPrompt(prompt X)
ICtrl->>API: HTTP PATCH /chatbot/systemprompts/{id}
API->>DB: Update prompt X
DB-->>API: Saved
API-->>ICtrl: 204/200
ICtrl-->>Page: Complete
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Assessment against linked issues
Poem
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Pull Request Overview
This PR improves the system prompts page by changing it from displaying a single system prompt to displaying multiple system prompts in a tabbed interface. The changes enable users to view and manage different types of system prompts (like Support, Sales, etc.) within a single page using pivot tabs.
Key changes:
- Modified API to return all system prompts instead of a single prompt by kind
- Updated the UI to display multiple prompts in a BitPivot component with tabs
- Changed the save functionality to work with individual prompts
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| AppJsonContext.cs | Updated JSON serialization to handle List instead of single SystemPromptDto |
| IChatbotController.cs | Changed interface method to return all system prompts instead of filtering by kind |
| ChatbotController.cs | Modified endpoint to return IQueryable for OData support and removed kind filtering |
| SystemPromptsPage.razor.cs | Updated component logic to handle multiple prompts and modified save method signature |
| SystemPromptsPage.razor | Added BitPivot UI with tabs for each prompt type and updated save button logic |
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Chatbot/IChatbotController.cs
Show resolved
Hide resolved
...e/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Chatbot/ChatbotController.cs
Show resolved
Hide resolved
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.
Actionable comments posted: 5
🧹 Nitpick comments (2)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/SystemPromptsPage.razor.cs (1)
30-35: Remove null-forgiving and guard Patch against null result.Minor readability and NRE-safety improvement.
- private async Task SaveChanges(SystemPromptDto systemPrompt) + private async Task SaveChanges(SystemPromptDto systemPrompt) { if (await AuthManager.TryEnterElevatedAccessMode(CurrentCancellationToken)) { - (await chatbotController.UpdateSystemPrompt(systemPrompt!, CurrentCancellationToken)).Patch(systemPrompt); + var updated = await chatbotController.UpdateSystemPrompt(systemPrompt, CurrentCancellationToken); + updated?.Patch(systemPrompt); } }src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/SystemPromptsPage.razor (1)
14-37: Handle empty-state and harden Markdown nullability.Avoid rendering an empty pivot and coalesce Markdown for the viewer.
- else if (systemPrompts is not null) + else if (systemPrompts is { Count: > 0 }) { <BitPivot> @@ - <BitMarkdownViewer Markdown="@systemPrompt.Markdown" Class="md-viewer" /> + <BitMarkdownViewer Markdown="@(systemPrompt.Markdown ?? string.Empty)" Class="md-viewer" /> </BitStack> </BitPivotItem> } </BitPivot> + } + else + { + <BitMessageBar MessageBarType="BitMessageBarType.Info"> + @Localizer[nameof(AppStrings.NoSystemPromptsFound)] + </BitMessageBar> }Optional: localize Pivot headers instead of PromptKind.ToString() if user-facing.
I can add the AppStrings key and header localization mapping if you want.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting
📒 Files selected for processing (5)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/SystemPromptsPage.razor(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/SystemPromptsPage.razor.cs(3 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Chatbot/ChatbotController.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Controllers/Chatbot/IChatbotController.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/AppJsonContext.cs(1 hunks)
⏰ 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). (1)
- GitHub Check: build and test
🔇 Additional comments (2)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/SystemPromptsPage.razor.cs (2)
11-11: Good shift to a collection-backed state.
21-21: Client fetch aligns with new API; looks good.
closes #11316
Summary by CodeRabbit
New Features
Refactor