Skip to content

Conversation

@iceljc
Copy link
Collaborator

@iceljc iceljc commented Oct 15, 2025

PR Type

Enhancement, Other


Description

  • Reorganized namespace structure across multiple modules (40+ files)

  • Moved model classes to dedicated Options, Contexts, Filters, Responses, and Sessions folders

  • Enhanced FileLlmProcessOptions with UserMessage and InvokeFrom properties

  • Changed CodeInterpretResult.Result type from object to string

  • Updated IFileLlmProcessor return type to FileLlmInferenceResponse


Diagram Walkthrough

flowchart LR
  A["Models namespace"] -- "reorganized into" --> B["Options namespace"]
  A -- "reorganized into" --> C["Contexts namespace"]
  A -- "reorganized into" --> D["Filters namespace"]
  A -- "reorganized into" --> E["Responses namespace"]
  A -- "reorganized into" --> F["Sessions namespace"]
  G["FileLlmProcessOptions"] -- "enhanced with" --> H["UserMessage & InvokeFrom"]
  I["IFileLlmProcessor"] -- "return type changed to" --> J["FileLlmInferenceResponse"]
Loading

File Walkthrough

Relevant files
Enhancement
4 files
FileLlmProcessOptions.cs
Added UserMessage and InvokeFrom properties                           
+11/-1   
IFileLlmProcessor.cs
Changed return type to FileLlmInferenceResponse                   
+4/-1     
FileLlmInferenceResponse.cs
Created new response model class                                                 
+8/-0     
CodeInterpretResult.cs
Changed Result property type to string                                     
+1/-1     
Miscellaneous
16 files
ChartCodeOptions.cs
Moved to Options namespace                                                             
+1/-1     
ChartDataOptions.cs
Moved to Options namespace                                                             
+1/-1     
FileSelectContext.cs
Moved to Contexts namespace                                                           
+1/-1     
ImageConvertOptions.cs
Moved to Options namespace                                                             
+1/-1     
MessageFileOptions.cs
Moved to Options namespace                                                             
+1/-1     
SelectFileOptions.cs
Moved to Options namespace                                                             
+1/-1     
CodeInstructContext.cs
Moved to Contexts namespace                                                           
+1/-1     
CodeInstructOptions.cs
Moved to Options namespace                                                             
+1/-1     
FileInstructOptions.cs
Moved to Options namespace                                                             
+1/-1     
InstructOptions.cs
Moved to Options namespace                                                             
+1/-1     
KnowledgeFileFilter.cs
Moved to Filters namespace                                                             
+1/-1     
ChunkOption.cs
Moved to Options namespace                                                             
+1/-1     
UploadKnowledgeResponse.cs
Moved to Responses namespace                                                         
+1/-1     
ChatSessionOptions.cs
Moved to Options namespace                                                             
+1/-1     
RealtimeSession.cs
Moved to Sessions namespace                                                           
+1/-1     
ChatSessionUpdate.cs
Moved to Sessions namespace                                                           
+1/-1     
Additional files
76 files
AgentCodeScriptUpdateOptions.cs +1/-1     
IBotSharpChartService.cs +1/-0     
IImageConverter.cs +2/-0     
IFileInstructService.cs +2/-1     
IFileStorageService.cs +1/-0     
IGraphDb.cs +1/-0     
GraphSearchOptions.cs +1/-1     
IInstructHook.cs +1/-0     
IInstructService.cs +1/-0     
TextChopper.cs +1/-0     
IKnowledgeService.cs +5/-0     
IRealTimeCompletion.cs +1/-0     
IRealtimeHub.cs +1/-0     
RealtimeOptions.cs +1/-1     
RealtimeModelSettings.cs +3/-1     
IBotSharpRepository.cs +3/-1     
AgentCodeScriptDbUpdateOptions.cs +1/-1     
IConversationSideCar.cs +1/-1     
SideCarOptions.cs +1/-1     
VectorCollectionConfigFilter.cs +1/-1     
IVectorDb.cs +1/-0     
VectorCollectionCreateOptions.cs +1/-1     
VectorCollectionIndexOptions.cs +1/-1     
VectorQueryOptions.cs +1/-1     
VectorSearchOptions.cs +2/-1     
RealtimePlugin.cs +1/-0     
RealtimeHub.cs +2/-0     
BotSharpConversationSideCar.cs +1/-0     
Using.cs +1/-1     
EvaluatingService.Evaluate.cs +1/-1     
FileInstructService.Audio.cs +1/-1     
FileInstructService.Image.cs +1/-0     
FileInstructService.Pdf.cs +1/-0     
FileInstructService.SelectFile.cs +2/-0     
LocalFileStorageService.Conversation.cs +1/-0     
AsyncWebsocketDataResultEnumerator.cs +0/-1     
InstructService.Execute.cs +7/-2     
InstructService.Instruct.cs +1/-1     
FileRepository.AgentCodeScript.cs +0/-1     
FileRepository.KnowledgeBase.cs +2/-0     
Using.cs +4/-1     
ImageGenerationController.cs +1/-0     
InstructModeController.cs +1/-0     
KnowledgeBaseController.cs +4/-1     
ConversationChartDataRequest.cs +2/-0     
InstructMessageModel.cs +1/-1     
GetKnowledgeDocsRequest.cs +2/-0     
VectorCollectionIndexRequest.cs +1/-1     
VectorKnowledgeUploadRequest.cs +1/-0     
ChatStreamMiddleware.cs +2/-1     
ChatStreamRequest.cs +1/-0     
HandleEmailSenderFn.cs +1/-1     
RealTimeCompletionProvider.cs +3/-1     
GraphDb.cs +1/-0     
ImageHandlerImageConverter.cs +1/-0     
ComposeImageFn.cs +1/-1     
EditImageFn.cs +1/-1     
KnowledgeSettingHelper.cs +2/-0     
KnowledgeHook.cs +3/-0     
MemoryVectorDb.cs +1/-0     
KnowledgeService.Document.cs +3/-0     
KnowledgeService.Graph.cs +2/-0     
KnowledgeService.Index.cs +1/-0     
KnowledgeService.Vector.cs +2/-0     
MongoRepository.AgentCodeScript.cs +1/-0     
MongoRepository.KnowledgeBase.cs +2/-0     
RealtimeSessionUpdate.cs +2/-0     
RealTimeCompletionProvider.cs +3/-0     
Using.cs +1/-1     
QdrantDb.cs +1/-0     
SemanticKernelMemoryStoreProvider.cs +1/-0     
SqlValidateFn.cs +2/-0     
SqlChartService.cs +1/-0     
TencentCosService.Conversation.cs +1/-0     
TwilioStreamMiddleware.cs +2/-1     
NullFileStorageService.cs +1/-0     

@qodo-code-review
Copy link

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.

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

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add null check to prevent exception

Add a null check for the inference object before accessing its Result property
to prevent a potential NullReferenceException.

src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs [127]

-result = inference.Result.IfNullOrEmptyAs(string.Empty);
+result = inference?.Result.IfNullOrEmptyAs(string.Empty) ?? string.Empty;

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the removal of the null-conditional operator on inference introduces a potential NullReferenceException, which is a critical bug.

Medium
High-level
Consolidate duplicated result model classes

The new FileLlmInferenceResponse class is a duplicate of the CodeInterpretResult
class. Consolidate them into a single, reusable result model to reduce code
duplication and improve maintainability.

Examples:

src/Infrastructure/BotSharp.Abstraction/Files/Responses/FileLlmInferenceResponse.cs [1-8]
namespace BotSharp.Abstraction.Files.Responses;

public class FileLlmInferenceResponse
{
    public string Result { get; set; } = string.Empty;
    public bool Success { get; set; }
    public string? ErrorMsg { get; set; }
}
src/Infrastructure/BotSharp.Abstraction/CodeInterpreter/Models/CodeInterpretResult.cs [3-8]
public class CodeInterpretResult
{
    public string Result { get; set; } = string.Empty;
    public bool Success { get; set; }
    public string? ErrorMsg { get; set; }
}

Solution Walkthrough:

Before:

// In BotSharp.Abstraction.Files.Responses
public class FileLlmInferenceResponse
{
    public string Result { get; set; }
    public bool Success { get; set; }
    public string? ErrorMsg { get; set; }
}

// In BotSharp.Abstraction.CodeInterpreter.Models
public class CodeInterpretResult
{
    public string Result { get; set; }
    public bool Success { get; set; }
    public string? ErrorMsg { get; set; }
}

After:

// In a common namespace, e.g., BotSharp.Abstraction.Models
public class OperationResult
{
    public string Result { get; set; } = string.Empty;
    public bool Success { get; set; }
    public string? ErrorMsg { get; set; }
}

// `FileLlmInferenceResponse` and `CodeInterpretResult` can be removed.
// Usages would be updated to use `OperationResult`. For example:
// In IFileLlmProcessor:
// Task<OperationResult> GetFileLlmInferenceAsync(...)

// In ICodeInterpreter:
// Task<OperationResult> Interpret(...)
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies structural duplication between the new FileLlmInferenceResponse and the modified CodeInterpretResult, proposing a valid architectural improvement to enhance maintainability and consistency.

Medium
  • More

@iceljc iceljc merged commit b6a57d1 into SciSharp:master Oct 15, 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.

1 participant