-
-
Notifications
You must be signed in to change notification settings - Fork 598
Features/refine agent rule #1206
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 🔍(Compliance updated until commit dfbedf6)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 Previous compliance checksCompliance check up to commit 8fce79d
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
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, Refactoring
Description
Code execution and rule engine improvements: Implemented code-based rule trigger execution with
TriggerCodeScriptmethod, refactored code execution context fromCodeInstructContexttoCodeExecutionContext, and updated hook signatures to useCodeExecutionResponseModelToken management system: Added comprehensive token management service with JWT generation, validation, token renewal, and third-party authentication hook support
Knowledge base document handling: Refactored document upload to use
FileKnowledgeWrapperandFileKnowledgeModel, extracted file processing logic into reusableHandleKnowledgeFilesmethod, and changed parameters fromChunkOptiontoKnowledgeDocOptionsAgent code script improvements: Changed
GetAgentCodeScriptreturn type fromstring?toAgentCodeScript?to return full domain objects with metadata, renamedCodeProcessOptionstoCodeGenHandleOptionsfor clarityTemplate rendering enhancements: Renamed
GetAgentTemplatetoRenderAgentTemplatewith data parameter support, addedRenderTextmethod for dynamic content rendering across file instruction servicesProperty naming standardization: Updated
ImageConvertProvidertoImageConverterconsistently across controllers and view models, updated JSON property names accordinglyPython interpreter improvements: Added thread ID capture, cancellation token handling for graceful interruption, and updated provider constants to use
BuiltInCodeProcessor.PyInterpreterMongoDB indexing: Added
CreateAgentCodeScriptIndexmethod with indexes onAgentId,Name, andScriptType, extracted common index creation logic into helper methodRule trigger interface enhancements: Added
OutputArgsandStatementproperties toIRuleTrigger, updatedGetRuleTriggersendpoint to returnAgentRuleViewModelwith enhanced trigger informationCode execution logging: Added
AfterCodeExecutionhook implementation for logging code execution results with processor, script name, and argumentsUser service refactoring: Converted
UserServiceto partial class, added token renewal endpoint with improved authorization header parsingCode execution concurrency: Improved semaphore handling with
DEFAULT_MAX_CONCURRENCYconstant and proper resource managementInstruction log filtering: Added regex-based
SimilarTemplateNamefilter support with case-insensitive pattern matchingFile handle options simplification: Changed
FileHandleOptionsto inherit fromLlmConfigBaseto reduce duplicationDiagram Walkthrough
File Walkthrough
18 files
KnowledgeService.Document.cs
Refactor knowledge document upload with wrapper modelssrc/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Document.cs
FileKnowledgeWrapperandFileKnowledgeModelfor better knowledge handlingHandleKnowledgeFilesmethodfor code reuse
ChunkOptiontoKnowledgeDocOptionsfor moreflexible configuration
VectorPayloadValue.BuildStringValue()calls withimplicit cast operators
UserService.Token.cs
Add token management service implementationsrc/Infrastructure/BotSharp.Core/Users/Services/UserService.Token.cs
GetToken,RenewToken,ActiveUser, andGetAffiliateTokenexpiration
authentication
RuleEngine.cs
Implement code-based rule trigger executionsrc/Infrastructure/BotSharp.Core.Rules/Engines/RuleEngine.cs
TriggerCodeScriptmethodCodingSettingsand code processor services for dynamic ruleevaluation
RuleTriggerOptionsfor code-basedtrigger configuration
ICodeProcessorfor executing trigger validationscripts
FileInstructService.Image.cs
Enhance template rendering with data contextsrc/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.Image.cs
GetAgentTemplatetoRenderAgentTemplatewith data parametersupport
RenderTextmethod for template rendering of user input textImageConvertProvidertoImageConverterthroughout
MongoDbContext.cs
Add MongoDB indexes for agent code scriptssrc/Plugins/BotSharp.Plugin.MongoStorage/MongoDbContext.cs
CreateAgentCodeScriptIndexmethod to create indexes onAgentId,Name, andScriptTypeCreateIndexhelper methodAgentCodeScriptsproperty to use new index creation methodPyCodeInterpreter.cs
Improve Python interpreter with cancellation supportsrc/Plugins/BotSharp.Plugin.PythonInterpreter/Services/PyCodeInterpreter.cs
BuiltInCodeProcessor.PyInterpretergraceful interruption
ProgrammingLanguageproperty supportInstructionLogHook.cs
Add code execution logging hooksrc/Infrastructure/BotSharp.Logger/Hooks/InstructionLogHook.cs
AfterCodeExecutionhook implementation for logging codeexecution results
IsLoggingEnabledhelper methodFileRepository.AgentCodeScript.cs
Return full AgentCodeScript object with metadatasrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentCodeScript.cs
GetAgentCodeScriptreturn type fromstring?toAgentCodeScript?AgentCodeScriptobject with metadata includingCreatedTimeandUpdatedTimeUserController.cs
Add token renewal endpointsrc/Infrastructure/BotSharp.OpenAPI/Controllers/User/UserController.cs
/renew-tokenendpoint for token refresh functionalityStringSplitOptions.RemoveEmptyEntriesRenewTokenModelwith refresh and access tokensCodeScriptExecutor.cs
Improve code execution concurrency handlingsrc/Infrastructure/BotSharp.Core/Coding/CodeScriptExecutor.cs
DEFAULT_MAX_CONCURRENCYconstant for clarityWaitAsynccall inside try block for proper resource managementAgentRuleViewModel.cs
Add agent rule view modelsrc/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/View/AgentRuleViewModel.cs
serialization
FileKnowledgeHandleOptions.cs
Add file knowledge handling optionssrc/Infrastructure/BotSharp.Abstraction/Knowledges/Options/FileKnowledgeHandleOptions.cs
LlmConfigBasewith agent ID, instruction, user message, andtemplate support
MongoRepository.AgentCodeScript.cs
Return full AgentCodeScript from MongoDBsrc/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentCodeScript.cs
GetAgentCodeScriptreturn type fromstring?toAgentCodeScript?FileRepository.Log.cs
Add regex-based template name filteringsrc/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Log.cs
SimilarTemplateNamefilter support with regex matchingmatching
IAuthenticationHook.cs
Add token renewal to authentication hooksrc/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs
RenewAuthenticationmethod for token refresh supportAgentController.Rule.cs
Enhance rule trigger endpoint responsesrc/Infrastructure/BotSharp.OpenAPI/Controllers/Agent/AgentController.Rule.cs
GetRuleTriggersto returnAgentRuleViewModelinstead ofAgentRulearguments
IFileProcessor.cs
Add file knowledge extraction interfacesrc/Infrastructure/BotSharp.Abstraction/Files/Proccessors/IFileProcessor.cs
GetFileKnowledgeAsyncmethod for extracting knowledge from filesIRuleTrigger.cs
Enhance rule trigger interfacesrc/Infrastructure/BotSharp.Abstraction/Rules/IRuleTrigger.cs
OutputArgsproperty for displaying default trigger argumentsStatementproperty for explaining trigger purpose17 files
UserService.cs
Convert UserService to partial classsrc/Infrastructure/BotSharp.Core/Users/Services/UserService.cs
partialto enable code splitting acrossmultiple files
InstructService.Execute.cs
Refactor code execution context and hook signaturessrc/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs
CodeInstructContexttoCodeExecutionContextCodeExecutionResponseModelinstead ofInstructResultBuiltInCodeProcessor.PyInterpreterInstructModeController.Image.cs
Update image converter property namingsrc/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.Image.cs
ImageConvertProvidertoImageConverterproperty
FileInstructService.cs
Refactor template rendering methodssrc/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.cs
GetAgentTemplatetoRenderAgentTemplatewith optional dataparameter
RenderTextmethod for rendering user input with template dataGetImageConverterdefault provider fromfile-handlertoimage-handlerAgentService.Coding.cs
Update code script retrieval and options namingsrc/Infrastructure/BotSharp.Core/Agents/Services/AgentService.Coding.cs
GetAgentCodeScriptreturn type fromstring?toAgentCodeScript?CodeProcessOptionstoCodeGenHandleOptionsfor clarityBuiltInCodeProcessor.PyInterpreterPyProgrammerFn.cs
Update Python programmer function configurationsrc/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyProgrammerFn.cs
BuiltInCodeProcessor.PyInterpreterInstructBaseRequest.cs
Standardize image converter property namingsrc/Infrastructure/BotSharp.OpenAPI/ViewModels/Instructs/Request/InstructBaseRequest.cs
ImageConvertProviderproperty toImageConverteracrossmultiple request classes
image_convert_providertoimage_converterFileInstructService.Pdf.cs
Update PDF service with template renderingsrc/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.Pdf.cs
ImageConvertProvidertoImageConverterRenderTextmethod call for text template rendering with datacontext
InstructModeController.File.cs
Update file instruction controller property namingsrc/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.File.cs
ImageConvertProvidertoImageConverterinPDF endpoints
KnowledgeBaseController.cs
Update knowledge base upload parameterssrc/Infrastructure/BotSharp.OpenAPI/Controllers/KnowledgeBase/KnowledgeBaseController.cs
ChunkOptiontoKnowledgeDocOptionsfor documentupload
/form-uploadto/formIAgentService.cs
Update agent service interface signaturessrc/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs
GetAgentCodeScriptreturn type fromstring?toAgentCodeScript?CodeProcessOptionstoCodeGenHandleOptionsin interfaceIInstructHook.cs
Refactor instruction hook signaturessrc/Infrastructure/BotSharp.Abstraction/Instructs/IInstructHook.cs
CodeExecutionContextinstead ofCodeInstructContextAfterCodeExecutionparameter fromInstructResulttoCodeExecutionResponseModelRoleDialogModelandmessageparameters from code executionhooks
IUserService.cs
Update user service token renewal interfacesrc/Infrastructure/BotSharp.Abstraction/Users/IUserService.cs
RenewTokenmethod with refresh and access token parametersRenewTokenmethod without parametersFileHandleOptions.cs
Simplify file handle options inheritancesrc/Infrastructure/BotSharp.Abstraction/Files/Options/FileHandleOptions.cs
LlmConfigBaseinstead of defining propertiesdirectly
IBotSharpRepository.cs
Update repository interface for code scriptssrc/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs
GetAgentCodeScriptreturn type fromstring?toAgentCodeScript?AgentController.Coding.cs
Update code generation state managementsrc/Infrastructure/BotSharp.OpenAPI/Controllers/Agent/AgentController.Coding.cs
code_processorconfigurationLanguagetoProgrammingLanguageFileInstructService.Audio.cs
Update audio service template renderingsrc/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.Audio.cs
GetAgentTemplatetoRenderAgentTemplateRenderTextmethod call for text template rendering2 files
Using.cs
Add rules options to global usingssrc/Infrastructure/BotSharp.Abstraction/Using.cs
BotSharp.Abstraction.Rules.OptionsBotSharp.Core.csproj
Reorganize and consolidate agent configuration file referencessrc/Infrastructure/BotSharp.Core/BotSharp.Core.csproj
them by agent ID with blank line separators
instruction.simulator.liquidfor agentdfd9b46d-d00c-40af-8a75-3fbdc2b89869)01e2fc5c-2c89-4ec7-8470-7688608b496c,6745151e-6d46-4a02-8de4-1c4f21c7da95, andc2a2faf6-b8b5-47fe-807b-f4714cf25dd4the project file structure
29 files