-
-
Notifications
You must be signed in to change notification settings - Fork 586
Features/refine llm configs #1202
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
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||||||
PR Type
Enhancement
Description
Refactored LLM model capabilities system: Replaced boolean
ImageGenerationflag with comprehensiveCapabilitiesenum supporting 12 capability types (Text, Chat, ImageReading, ImageGeneration, AudioGeneration, etc.)Enhanced filtering and configuration: Introduced
LlmConfigFilterto replaceLlmConfigOptions, enabling advanced filtering by model type, ID, name, and capabilities across LLM provider servicesExtended agent management: Added conditional agent deletion with
AgentDeleteOptions, code script management endpoints, and AI-powered code generation via LLM integrationNew controller organization: Refactored monolithic controllers into partial classes (
InstructModeController,ConversationController,AgentController) with specialized endpoint files for better maintainabilityAdded multi-modal capabilities: Implemented new endpoints for image reading, audio processing (speech-to-text, text-to-speech), and PDF file processing
Performance optimizations: Replaced
Directory.GetDirectories()andDirectory.GetFiles()withDirectory.EnumerateDirectories()andDirectory.EnumerateFiles()throughout file repositories for better memory efficiencyCode quality improvements: Standardized conditional block formatting to multi-line format, improved null-safety checks, and enhanced error reporting with type information
New features: Added conversation file attachment management, conversation state management, visualization/dashboard endpoints, and SQL chart processor for data visualization
Extended object cloning: Added generic
DeepClone<TInput, TOutput>overload for cross-type cloning with detailed error reportingBug fixes: Improved MongoDB filter construction for agent code scripts and enhanced null safety in knowledge base vector search
Diagram Walkthrough
File Walkthrough
35 files
FileRepository.Agent.cs
Code formatting and performance improvements with conditional deleteoptionssrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Agent.cs
BotSharp.Abstraction.Agents.Optionsnamespacefor consistency
Directory.GetDirectories()andDirectory.GetFiles()withDirectory.EnumerateDirectories()andDirectory.EnumerateFiles()forbetter performance
DeleteAgent()method signature to accept optionalAgentDeleteOptionsparameter for conditional deletion of user agentsand role agents
MongoRepository.Agent.cs
MongoDB repository agent deletion with conditional options supportsrc/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs
BotSharp.Abstraction.Agents.OptionsnamespaceDeleteAgent()method signature to accept optionalAgentDeleteOptionsparameterrole agents, and code scripts based on options
InstructModeController.Image.cs
Image controller refactoring and multi-modal endpoint additionssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.Image.cs
ImageGenerationControllerclass into a partial classInstructModeControllerMessagetoErrorMsgforconsistency
Success = trueflag to successful image operation responsesCompletionProvider.cs
Completion provider refactoring with capability-based filteringsrc/Infrastructure/BotSharp.Core/Infrastructures/CompletionProvider.cs
for consistency
GetImageCompletion()method to acceptIEnumerableinstead ofbool imageGenerateparametercapabilitiesparameterinstead of
imageGenerateLlmProviderService.cs
LLM provider service refactoring with enhanced filtering capabilitiessrc/Infrastructure/BotSharp.Core/Infrastructures/LlmProviderService.cs
BotSharp.Abstraction.MLTasks.FiltersnamespaceGetProviderModel()method signature to useIEnumerableinsteadof
bool imageGenerateLlmConfigOptionswithLlmConfigFilterinGetLlmConfigs()method
and capabilities
ConversationController.File.cs
New conversation file attachment management endpointssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Conversation/ConversationController.File.cs
conversations
attachments
multiple file sources
InstructModeController.cs
New instruct mode controller with completion endpointssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.cs
InstructModeControllerpartial class withcore instruction endpoints
endpoints
AgentService.Coding.cs
New agent code script service implementationsrc/Infrastructure/BotSharp.Core/Agents/Services/AgentService.Coding.cs
agent code scripts
InstructModeController.Audio.cs
New audio processing endpoints for speech operationssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.Audio.cs
text-to-speech
operations
LocalFileStorageService.Conversation.cs
File storage service directory enumeration optimizationsrc/Infrastructure/BotSharp.Core/Files/Services/Storage/LocalFileStorageService.Conversation.cs
Directory.GetDirectories()andDirectory.GetFiles()withDirectory.EnumerateDirectories()andDirectory.EnumerateFiles()InstructModeController.File.cs
New PDF file processing endpointssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.File.cs
request handling
AgentController.Coding.cs
New agent code script API endpointssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Agent/AgentController.Coding.cs
generating code scripts
FileRepository.AgentCodeScript.cs
Agent code script repository optimization and upsert supportsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentCodeScript.cs
Directory.GetFiles()withDirectory.EnumerateFiles()forperformance optimization
UpdateAgentCodeScripts()to support upsert operations withdirectory creation
DeleteAgentCodeScripts()with better null-safety anddirectory existence checks
BulkInsertAgentCodeScripts()to use upsert optionObjectExtensions.cs
Enhanced object cloning with generic type conversion supportsrc/Infrastructure/BotSharp.Abstraction/Utilities/ObjectExtensions.cs
DefaultJsonOptionsto_defaultJsonOptionsfollowing namingconventions
DeepClonemethod with improved parameter naming (obj→inputObj,newObj→outputObj)logging
DeepCloneoverload for cross-typecloning with detailed error reporting
PyCodeInterpreter.cs
Added code generation capability with LLM integrationsrc/Plugins/BotSharp.Plugin.PythonInterpreter/Services/PyCodeInterpreter.cs
usingstatement forBotSharp.Abstraction.Coding.ModelsGenerateCodeScriptAsyncmethod for AI-powered codegeneration using LLM
#regionand#endregionmarkers to organize private methodsinstructions, and LLM provider selection
LlmModelSetting.cs
Refactored LLM model capabilities from boolean flags to enumsrc/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
Capabilitiesproperty as list ofLlmModelCapabilityenum valuesImageGenerationboolean property in favor ofcapabilities-based approach
LlmModelTypeenum values:AllandWebLlmModelCapabilityenum with 12 capability types (Text,Chat, ImageReading, ImageGeneration, etc.)
AgentPlugin.cs
Added code script execution and menu management featuressrc/Infrastructure/BotSharp.Core/Agents/AgentPlugin.cs
using BotSharp.Core.CodingimportCodeScriptExecutoras singleton in DI containeradmin/root role restriction
new List { ... }to[...]for "Evaluating" menu roles
AgentController.cs
Refactored agent controller with partial class and enhanced deletionsrc/Infrastructure/BotSharp.OpenAPI/Controllers/Agent/AgentController.cs
publictopublic partialto support partial classorganization
IAgentTaskServicedependency injectionDeleteAgentmethod to acceptAgentDeleteRequestwith optionaldelete options
GetAgentLabelsto accept optionalsizequery parameter withdefault value of 1000
InstructService.Execute.cs
Refactored code instruction options and context handlingsrc/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs
CodeScriptNameproperty toScriptNamein code optionsScriptTypeextraction from options with fallback toAgentCodeScriptType.SrcCodeInstructContextto includeScriptTypepropertyQdrantDb.cs
Added vector search parameter support to Qdrant integrationsrc/Plugins/BotSharp.Plugin.Qdrant/QdrantDb.cs
consistency
SearchParamsconstruction fromVectorSearchParamModelwith newBuildSearchParammethodIAgentService.cs
Extended agent service with code generation and deletion capabilitiessrc/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs
BotSharp.Abstraction.Coding.ModelsandCodeGenerationOptionsDeleteAgentsignature to accept optionalAgentDeleteOptionsparameter
DeleteAgentCodeScriptsmethod with optional code scriptsparameter
GenerateCodeScriptmethod for AI-powered code generationConversationController.Visualization.cs
Added conversation visualization and dashboard management endpointssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Conversation/ConversationController.Visualization.cs
ConversationControllerclassprocessor selection
SqlChartProcessor.cs
Implemented SQL driver chart processor for data visualizationsrc/Plugins/BotSharp.Plugin.SqlDriver/Services/SqlChartProcessor.cs
IChartProcessorinterface for SQL-based chartdata retrieval
LlmProviderController.cs
Refactored LLM provider controller with filter-based configurationsrc/Infrastructure/BotSharp.OpenAPI/Controllers/Setting/LlmProviderController.cs
using BotSharp.Abstraction.MLTasks.FiltersimportGetLlmProviderModelsto acceptmodelTypequery parameter withdefault
LlmModelType.ChatGetLlmConfigsparameter fromLlmConfigOptionstoLlmConfigFilterICodeProcessor.cs
Extended code processor interface with generation capabilitysrc/Infrastructure/BotSharp.Abstraction/Coding/ICodeProcessor.cs
using BotSharp.Abstraction.Coding.ModelsimportRunAsyncmethodGenerateCodeScriptAsyncmethod with XML documentationNotImplementedExceptionbehaviorAgentCodeScriptViewModel.cs
Created agent code script view model with conversion methodssrc/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/View/AgentCodeScriptViewModel.cs
FromandToconversion methods for model transformationCodeGenerationOptions.cs
Created code generation options configuration classsrc/Infrastructure/BotSharp.Abstraction/Coding/Options/CodeGenerationOptions.cs
LlmConfigBasefor LLM configuration inheritancedata properties
CodeInstructOptions.cs
Refactored code instruction options with improved documentationsrc/Infrastructure/BotSharp.Abstraction/Instructs/Options/CodeInstructOptions.cs
CodeScriptNameproperty toScriptNamefor consistencyScriptTypeproperty for script type specificationAgentController.Task.cs
Consolidated agent task endpoints into main controllersrc/Infrastructure/BotSharp.OpenAPI/Controllers/Agent/AgentController.Task.cs
AgentTaskControllerclass to partialAgentControllermethodclass
AgentService.DeleteAgent.cs
Enhanced agent deletion with configurable delete optionssrc/Infrastructure/BotSharp.Core/Agents/Services/AgentService.DeleteAgent.cs
using BotSharp.Abstraction.Agents.OptionsimportDeleteAgentmethod signature to accept optionalAgentDeleteOptionsparameterCodeProcessOptions.cs
Created code processing options with persistence configurationsrc/Infrastructure/BotSharp.Abstraction/Coding/Options/CodeProcessOptions.cs
CodeGenerationOptionsfor code generation inheritanceproperties
AgentCodeScriptType.SrcILlmProviderService.cs
Refactored LLM provider service with capabilities-based filteringsrc/Infrastructure/BotSharp.Abstraction/MLTasks/ILlmProviderService.cs
using BotSharp.Abstraction.MLTasks.FiltersimportGetSettingandGetProviderModelreturn types to nullableimageGenerateboolean parameter withcapabilitiesenumcollection
LlmConfigOptionsparameter toLlmConfigFilterinGetLlmConfigsmethod
AgentCodeScriptUpdateModel.cs
Created agent code script request models for API operationssrc/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/Request/AgentCodeScriptUpdateModel.cs
AgentCodeScriptUpdateModelsupports code scripts list and updateoptions
AgentCodeScriptDeleteModelsupports code scripts list for deletionConversationController.State.cs
Added conversation state management endpointssrc/Infrastructure/BotSharp.OpenAPI/Controllers/Conversation/ConversationController.State.cs
ConversationControllerclasserror limit parameters
regions
IBotSharpRepository.cs
Extended repository interface with delete options supportsrc/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs
using BotSharp.Abstraction.Agents.OptionsimportDeleteAgentmethod signature to accept optionalAgentDeleteOptionsparameter12 files
FileRepository.Conversation.cs
Code formatting standardization and directory enumeration optimizationsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs
BotSharp.Abstraction.Users.ModelsandSystem)Directory.GetDirectories()andDirectory.GetFiles()withDirectory.EnumerateDirectories()andDirectory.EnumerateFiles()throughout the file
ConversationController.cs
Conversation controller refactoring for partial class supportsrc/Infrastructure/BotSharp.OpenAPI/Controllers/Conversation/ConversationController.cs
BotSharp.Abstraction.ChartandBotSharp.Abstraction.Files.Utilities)FileRepository.Log.cs
Log repository formatting and directory enumeration optimizationsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Log.cs
Microsoft.IdentityModel.LoggingDirectory.GetFiles()withDirectory.EnumerateFiles()forperformance optimization
FileRepository.AgentTask.cs
Agent task repository formatting and enumeration optimizationsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentTask.cs
block format
Directory.GetDirectories()andDirectory.GetFiles()withDirectory.EnumerateDirectories()andDirectory.EnumerateFiles()FileRepository.User.cs
User repository code formatting standardizationsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.User.cs
FileRepository.KnowledgeBase.cs
Improved code formatting and performance optimizationsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs
improved readability
Directory.GetDirectories()toDirectory.EnumerateDirectories()for better performance
throughout the file
MongoRepository.AgentTask.cs
Improved code formatting and removed unused importssrc/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentTask.cs
using MongoDB.Driverimportthroughout the file
StringExtensions.cs
Standardized conditional block formatting in string utilitiessrc/Infrastructure/BotSharp.Abstraction/Utilities/StringExtensions.cs
consistency
SubstringMax,IsEqualTo, andCleanStrmethodsFileRepository.Crontab.cs
Improved crontab file repository formatting and performancesrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Crontab.cs
Directory.GetDirectories()toDirectory.EnumerateDirectories()for performance
consistency
FileRepository.Role.cs
Standardized conditional block formatting in role repositorysrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Role.cs
LocalFileStorageService.User.cs
Improved code formatting in user file storage servicesrc/Infrastructure/BotSharp.Core/Files/Services/Storage/LocalFileStorageService.User.cs
methods
BasicAgentHook.cs
Standardized conditional block formatting in agent hookssrc/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs
blocks
2 files
MongoRepository.AgentCodeScript.cs
Improved MongoDB filter construction and null safetysrc/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentCodeScript.cs
using BotSharp.Abstraction.Repositories.Modelsimport!toGuid.NewGuid().ToString()assignment
DeleteAgentCodeScriptsto use filter builder pattern withproper
AgentIdfilteringdeletion scenarios
KnowledgeBaseController.cs
Improved null safety in knowledge base vector searchsrc/Infrastructure/BotSharp.OpenAPI/Controllers/KnowledgeBase/KnowledgeBaseController.cs
?.operator throughout vectorsearch options
SearchParamproperty to vector search options59 files