Skip to content

Conversation

@yileicn
Copy link
Collaborator

@yileicn yileicn commented Oct 24, 2025

PR Type

Enhancement


Description

  • Add file_count state tracking for InstructCompletion requests

  • Set file_count state when Files collection is not empty


Diagram Walkthrough

flowchart LR
  input["InstructMessageModel input"] -- "check Files collection" --> check{"Files not empty?"}
  check -- "yes" --> setState["SetState file_count"]
  check -- "no" --> skip["Skip state setting"]
  setState --> state["IConversationStateService"]
  skip --> state
Loading

File Walkthrough

Relevant files
Enhancement
InstructModeController.cs
Add file_count state tracking logic                                           

src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs

  • Added conditional check for non-empty Files collection in input
  • Set file_count state with the count of files when available
  • Inserted blank line for code readability
+2/-0     

@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Oct 24, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
- [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true -->

</details></td></tr>
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Oct 24, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add missing state source parameter
Suggestion Impact:The commit updated the SetState call for "file_count" to include source: StateSource.External exactly as suggested.

code diff:

-        if (!input.Files.IsNullOrEmpty()) state.SetState("file_count", input.Files.Count);
+        if (!input.Files.IsNullOrEmpty()) state.SetState("file_count", input.Files.Count, source: StateSource.External);

Add the missing source: StateSource.External parameter to the state.SetState
call to maintain consistency with other state modifications in the method.

src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs [39]

-if (!input.Files.IsNullOrEmpty()) state.SetState("file_count", input.Files.Count);
+if (!input.Files.IsNullOrEmpty()) state.SetState("file_count", input.Files.Count, source: StateSource.External);

[Suggestion processed]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out an inconsistency with surrounding code, where all other SetState calls include the source parameter. Applying this change improves code consistency and robustness.

Low
  • Update

@iceljc iceljc merged commit fda443e into SciSharp:master Oct 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants