Skip to content

Conversation

@ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Oct 3, 2025

closes #11467

Summary by CodeRabbit

  • New Features
    • None.
  • Refactor
    • Streamlined dependency handling in real-time chat and session log retrieval to reduce overhead and improve reliability.
  • Documentation
    • Clarified call flow for authentication state changes in hub documentation.

@coderabbitai
Copy link

coderabbitai bot commented Oct 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Shifted dependency resolution in SignalR hub methods from scoped service provider resolution to DI-injected method parameters. Updated method signatures for Chatbot and GetUserSessionLogs to accept AppDbContext and (for Chatbot) IChatClient via [FromServices]. Minor XML doc note added.

Changes

Cohort / File(s) Summary
SignalR hubs DI parameter injection
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR/AppHub.Chatbot.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR/AppHub.cs
Replaced internal async-scope service resolution with method-level DI parameters via [FromServices]. Updated signatures: Chatbot now accepts AppDbContext and IChatClient; GetUserSessionLogs now accepts AppDbContext. Control flow unchanged aside from initialization source.
Documentation tweak
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR/AppHub.cs
Added XML summary note that ChangeAuthenticationState is called by AppClientCoordinator.cs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant Hub as AppHub
  participant Db as AppDbContext (DI)
  participant Chat as IChatClient (DI)

  rect rgba(230,245,255,0.6)
  note over Hub: New: Dependencies injected via [FromServices]
  Client->>Hub: Chatbot(request, incomingMessages)
  Hub->>Db: Load support prompt
  Hub->>Chat: Start streaming with prompt and incomingMessages
  Chat-->>Hub: Streamed tokens (async)
  Hub-->>Client: Yield tokens (IAsyncEnumerable)
  end
Loading
sequenceDiagram
  autonumber
  actor Client
  participant Hub as AppHub
  participant Db as AppDbContext (DI)

  rect rgba(230,245,255,0.6)
  note over Hub: New: DbContext injected via [FromServices]
  Client->>Hub: GetUserSessionLogs(userSessionId)
  Hub->>Db: Query DiagnosticLog entries
  Db-->>Hub: Logs[]
  Hub-->>Client: DiagnosticLogDto[]
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

In wires we hop with lighter feet,
No scopes to burrow, DI’s neat.
Context carrots, chatty streams,
We nibble tokens, promptful dreams.
Thump-thump logs in tidy rows—
A cleaner warren, swift it goes. 🥕✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between fca8dad and 87e35b5.

📒 Files selected for processing (2)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR/AppHub.Chatbot.cs (1 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/SignalR/AppHub.cs (2 hunks)

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.

@ysmoradi ysmoradi merged commit 379cf3d into bitfoundation:develop Oct 3, 2025
2 of 3 checks passed
@ysmoradi ysmoradi deleted the 11467 branch October 3, 2025 09:27
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.

bit Boilerplate AppHub's DI needs improvements

1 participant