You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
• Major refactoring of file handling and AI provider configurations: Added comprehensive settings for file operations, image conversion, and LLM provider selection across multiple functions
• Enhanced multi-modal support: Added support for image content parts, annotations, and advanced features across Azure OpenAI, DeepSeek, OpenAI, and Google AI chat providers
• New image converter architecture: Introduced IImageConverter interface with FileHandlerImageConverter implementation using SixLabors.ImageSharp for PNG conversion
• Improved file selection system: Refactored from simple ID-based to message-based file selection with detailed context including message ID, file index, and source
• API endpoint restructuring: Updated instruct mode controller endpoints from /upload to /form with specialized request models
• Enhanced AI-powered responses: Added AiResponseHelper for generating contextual user feedback in file operations
• Package updates: Updated Google GenerativeAI (2.5.8→3.2.0), Azure OpenAI (2.2.0-beta.5→2.3.0-beta.2), OpenAI (2.3.0→2.4.0), and SixLabors.ImageSharp (3.1.7→3.1.11)
• Configuration enhancements: Added comprehensive FileHandler and FileSelect settings with LLM configuration support
• Bug fixes: Improved error handling in chart plotting and removed deprecated additional message wrapper functionality
• Updated API endpoint paths from /upload to /form for multi-modal operations • Renamed parameter variables from input to request for consistency • Added ImageConvertProvider property to InstructOptions for image processing operations • Updated request types to use more specific file request models
• Added #pragma warning disable OPENAI001 to suppress OpenAI warnings
• Enhanced chat completion with ToolCallId and Annotations support • Refactored message preparation with new helper methods for content parts • Added support for reasoning effort levels and web search options
• Added #pragma warning disable OPENAI001 and new imports for file handling • Enhanced chat completion with Annotations support for web resources • Added multi-modal support with image content parts collection • Implemented reasoning effort levels and web search configuration
• Refactored file selection logic to use routing context and message limits • Updated file selection criteria with new FileSelectItem structure • Enhanced file attachment to dialog messages with proper indexing • Improved AI-based file selection with better prompt handling
• Added image conversion support with configurable providers • Enhanced error handling and response generation for image editing • Integrated conversation settings for file selection parameters • Added AI-powered response generation for better user feedback
• Added support for chat annotations with web resource information • Refactored message content parts collection into reusable helper method • Added image detail level configuration support • Enhanced multi-modal message handling for both user and assistant roles
• Added configurable LLM provider and model selection • Enhanced file collection to include both user and bot images • Added image detail level configuration support • Improved agent configuration with proper LLM settings
• Added multi-modal support for assistant messages with file attachments • Refactored content parts collection into reusable helper method • Enhanced message handling to support both text and file content • Improved code organization with better separation of concerns
• Added configurable LLM provider and model selection for web search • Enhanced model selection logic with web search capability detection • Improved provider configuration with fallback mechanisms • Updated agent name for consistency
• Added new request models for specific file operations (ImageEditFileRequest, PdfReadFileRequest, etc.) • Added ImageConvertProvider property to image-related requests • Separated file-based requests from base requests for better type safety • Enhanced request structure with more specific typing
• Added FileIndex property to message file models • Updated PDF to image conversion to use new IImageConverter interface • Reduced thread sleep time from 100ms to 50ms for better performance • Enhanced file model creation with proper indexing
• Added new image converter implementation using SixLabors.ImageSharp
• Supports PNG conversion with configurable color types (RGBA, RGB, Grayscale, etc.) • Implements IImageConverter interface for image processing operations • Provides error handling and fallback to original binary data
• Added FileIndex property extraction from subdirectory structure • Updated PDF to image conversion to use new IImageConverter interface • Enhanced file model creation with proper indexing • Improved converter selection logic
• Refactored to extend LlmConfigBase for consistent LLM configuration
• Renamed IncludeBotFile to IsIncludeBotFiles for clarity • Added MessageLimit, IsAttachFiles, and Data properties • Replaced Offset with MessageLimit for better control
• Added Background property to ImageGenerationSetting and ImageEditSetting • Enhanced image model settings with background configuration support • Added region comments for better code organization • Improved settings structure for image-related operations
• Added new helper class for AI-powered response generation • Provides default response formatting for file operations • Implements image generation response creation with LLM integration • Enhances user experience with contextual response messages
• Added new interface for image conversion operations • Supports both PDF to image conversion and image format conversion • Provides extensible architecture for different converter implementations • Includes optional configuration through ImageConvertOptions
• Replaced simple ID-based selection with detailed file selection items • Added FileSelectItem class with message ID, file index, and source • Enhanced file selection context with more granular control • Improved file identification and selection accuracy
• Added new ImageConvertOptions class with default properties for image conversion • Includes ImageType property defaulting to "png" and ColorType property defaulting to "rgba"
• Completely rewrote file selection instruction template with new structured approach • Changed from simple file ID selection to message-based file selection with message_id, file_source, and file_index • Added detailed requirements and response format sections for better file selection logic • Replaced example-based approach with step-by-step instruction methodology
• Modified instruction to clarify when NOT to call util-file-generate_image • Added specific condition about not calling function when user wants to change or edit existing images
• Removed AdditionalMessageWrapper property and related functionality
• Simplified dialog model by removing sequential message sending capability • Cleaned up JSON serialization attributes • Streamlined model structure for better maintainability
Add new global using statements for converters and helpers
src/Plugins/BotSharp.Plugin.FileHandler/Using.cs
• Added new global using statements for file converters and helpers • Enhanced namespace imports for better code organization • Added support for new converter interfaces and helper classes • Improved code accessibility with additional imports
• Removed handling of AdditionalMessageWrapper in dialog storage • Simplified dialog element building process • Cleaned up conversation storage logic • Streamlined dialog processing workflow
• Added comprehensive settings structure for image and PDF operations
• Added ImageConverter configuration with provider selection • Created specialized settings classes for different file operations • Added FileLlmSettingBase for consistent LLM configuration
Add FileHandler and FileSelect configuration sections
src/WebStarter/appsettings.json
• Added new FileSelect configuration section with LLM settings for file selection • Added comprehensive FileHandler configuration section with image and PDF handling settings • Included new ImageConverter provider configuration
• Updated Google_GenerativeAI and Google_GenerativeAI.Live from version 2.5.8 to 3.2.0 • Updated SixLabors.ImageSharp from version 3.1.7 to 3.1.11 • Updated Azure.AI.OpenAI from version 2.2.0-beta.5 to 2.3.0-beta.2 • Updated OpenAI from version 2.3.0 to 2.4.0
FileFullName concatenates FileName and FileExtension without guarding null/empty values, which can yield leading/trailing dots or "null" segments; confirm upstream invariants or add safe formatting.
The returned success message contains typos and lost specific filename context; consider clearer user-facing text and include the edited file name if available.
Default chat model changed from gpt-4o-mini to gpt-4.1-mini; verify availability and compatibility across environments to avoid runtime fallback issues.
Several functions still hard-code provider="openai" and specific model names (e.g., WebIntelligentSearchFn, EditImageFn, GenerateImageFn, and file selection), which undermines the “dynamic model selection” goal and will fail in deployments not using OpenAI. Drive provider/model resolution from the current agent’s LlmConfig or the globally configured defaults via ILlmProviderService, selecting by capability (web search, image generation/edit) and honoring IsDefault flags with proper fallbacks. This makes the new IsDefault settings effective across providers and prevents runtime errors when OpenAI isn’t present.
// In WebIntelligentSearchFn.csprivate(string,string)GetLlmProviderModel(){varprovider="openai";// Hard-coded providervarmodel="gpt-4o-mini-search-preview";// Hard-coded default modelvarllmProviderService=_services.GetRequiredService<ILlmProviderService>();varmodels=llmProviderService.GetProviderModels(provider);varfoundModel=models.FirstOrDefault(x =>x.WebSearch?.IsDefault==true)??models.FirstOrDefault(x =>x.WebSearch!=null);model=foundModel?.Name??model;return(provider,model);}
After:
// In WebIntelligentSearchFn.csprivate(string,string)GetLlmProviderModel(){varllmProviderService=_services.GetRequiredService<ILlmProviderService>();// Get provider from agent config or global settings, not hard-codedvaragentConfig=GetCurrentAgentConfig();// Hypotheticalvarprovider=agentConfig.Provider??llmProviderService.GetDefaultProvider();// Find the best model for the capability (WebSearch) from the resolved providervarmodels=llmProviderService.GetProviderModels(provider);varfoundModel=models.FirstOrDefault(x =>x.WebSearch?.IsDefault==true)??models.FirstOrDefault(x =>x.WebSearch!=null);// Fallback to a generic default model if no specific one is foundvarmodel=foundModel?.Name??agentConfig.Model??llmProviderService.GetDefaultModel();return(provider,model);}
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a critical flaw where the provider is hard-coded as openai, which contradicts the PR's goal of dynamic model selection and limits portability.
High
General
Handle null FileExtension values
The property doesn't handle null or empty FileExtension values, which could result in filenames ending with a dot (e.g., "document."). Add null/empty checking to avoid malformed filenames.
Why: The suggestion correctly identifies that the new FileFullName property could produce malformed names if FileExtension is null or empty, and the proposed fix improves code robustness.
In GetLlmProviderModel, both provider and model are read from the same state key 'image_edit_llm_provider'. The model likely should read from 'image_edit_llm_model'. This would cause incorrect model selection.
After image conversion to PNG, code sets image.FileExtension = 'png' but BuildFileName is passed a hard-coded 'png' extension regardless; ensure filename and content-type are consistent and upstream consumers expect PNG bytes. Verify providers (e.g., OpenAI) require RGBA PNG and that mask/image pair names align.
Thread.Sleep during file save was reduced from 100ms to 50ms. This may reintroduce race conditions on slower disks or cloud filesystems. Consider using async flush or retry policy instead of fixed sleeps.
To improve maintainability, extract the duplicated code for handling multi-modal content and message preparation from the Azure OpenAI, DeepSeek, and OpenAI providers into a shared base class or helper service.
// In AzureOpenAI/.../ChatCompletionProvider.cspublicclassChatCompletionProvider{private(string, ...)PrepareStreamingOptions(...){// ...varoptions=InitChatCompletionOption(agent);// ...foreach(varmessageinfilteredMessages){// ... logic to create content partsif(allowMultiModal&&!message.Files.IsNullOrEmpty()){CollectMessageContentParts(contentParts,message.Files,imageDetailLevel);}}// ...}privatevoidCollectMessageContentParts(...){/* ... duplicated logic ... */}privateChatCompletionOptionsInitChatCompletionOption(...){/* ... duplicated logic ... */}privateChatReasoningEffortLevel?ParseReasoningEffortLevel(...){/* ... duplicated logic ... */}privateChatImageDetailLevelParseChatImageDetailLevel(...){/* ... duplicated logic ... */}}// NOTE: Similar duplicated methods exist in DeepSeekAI and OpenAI providers.
After:
// New Base ClasspublicabstractclassOpenAiChatCompletionProviderBase{// ... common servicesprotectedvoidCollectMessageContentParts(List<ChatMessageContentPart>contentParts, ...){// ... shared implementation for collecting message parts}protectedChatCompletionOptionsInitChatCompletionOption(Agentagent){// ... shared implementation for initializing options}// ... other shared helper methods}// In AzureOpenAI/.../ChatCompletionProvider.cspublicclassChatCompletionProvider:OpenAiChatCompletionProviderBase{private(string, ...)PrepareStreamingOptions(...){varoptions=InitChatCompletionOption(agent);// Use base class method// ...CollectMessageContentParts(contentParts, ...);// Use base class method// ...}}// NOTE: DeepSeekAI and OpenAI providers would also inherit from the base class.
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies significant code duplication across multiple provider classes, which is a major architectural issue introduced by the PR, and proposing a base class is an excellent solution.
High
Possible issue
Fix copy-paste error for model retrieval
Fix a copy-paste error by using the correct state key image_edit_llm_model to retrieve the model name instead of image_edit_llm_provider.
var provider = state.GetState("image_edit_llm_provider");
-var model = state.GetState("image_edit_llm_provider");+var model = state.GetState("image_edit_llm_model");
Apply / Chat
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a copy-paste bug where the wrong key is used to retrieve the model name, which would cause the function to fail.
Medium
Use TryParse to prevent parsing errors
Replace float.Parse with the safer float.TryParse to prevent potential FormatException when parsing the temperature value from the conversation state.
-float? temperature = float.Parse(state.GetState("temperature", "0.0"));+float.TryParse(state.GetState("temperature", "0.0"), out var temp);+float? temperature = temp;
Apply / Chat
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly points out that using float.Parse is unsafe and could lead to an unhandled exception, recommending the safer float.TryParse for improved robustness.
Medium
Add null check for the request object
Add a null check for the request object in the ImageVariation endpoint to prevent potential downstream errors and return a clear error message if it is missing.
[HttpPost("/instruct/image-variation/form")]
public async Task<ImageGenerationViewModel> ImageVariation(IFormFile file, [FromForm] ImageVariationRequest request)
{
var state = _services.GetRequiredService<IConversationStateService>();
request?.States?.ForEach(x => state.SetState(x.Key, x.Value, source: StateSource.External));
var imageViewModel = new ImageGenerationViewModel();
if (file == null)
{
return new ImageGenerationViewModel { Message = "Error! Cannot find an image!" };
}
+ if (request == null)+ {+ return new ImageGenerationViewModel { Message = "Error! Request body is missing." };+ }+
try
{
var fileInstruct = _services.GetRequiredService<IFileInstructService>();
var message = await fileInstruct.VaryImage(file, new InstructOptions
{
- Provider = request?.Provider,- Model = request?.Model,- AgentId = request?.AgentId,- ImageConvertProvider = request?.ImageConvertProvider+ Provider = request.Provider,+ Model = request.Model,+ AgentId = request.AgentId,+ ImageConvertProvider = request.ImageConvertProvider
});
imageViewModel.Content = message.Content;
imageViewModel.Images = message.GeneratedImages?.Select(x => ImageViewModel.ToViewModel(x)) ?? [];
return imageViewModel;
}
catch (Exception ex)
{
_logger.LogError(ex, $"Error when varying an image.");
imageViewModel.Message = ex.Message;
return imageViewModel;
}
}
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies that the request object can be null and adds a necessary check to handle this case, improving the endpoint's robustness.
Low
Learned best practice
Add null-safe file selection guards
Guard against null elements inside selectedFiles and their properties before accessing them. Add defensive checks to avoid potential NullReferenceExceptions.
private IImageConverter? GetImageConverter(string? provider)
{
var settings = _services.GetRequiredService<FileCoreSettings>();
var convertProvider = provider ?? settings?.ImageConverter?.Provider;
++ if (string.IsNullOrEmpty(convertProvider))+ {+ return null;+ }+
var converter = _services.GetServices<IImageConverter>().FirstOrDefault(x => x.Provider == convertProvider);
return converter;
}
Apply / Chat
Suggestion importance[1-10]: 4
__
Why: The suggestion improves code robustness by adding a check for a null or empty convertProvider, preventing the potential selection of a misconfigured converter.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement, Bug fix
Description
• Major refactoring of file handling and AI provider configurations: Added comprehensive settings for file operations, image conversion, and LLM provider selection across multiple functions
• Enhanced multi-modal support: Added support for image content parts, annotations, and advanced features across Azure OpenAI, DeepSeek, OpenAI, and Google AI chat providers
• New image converter architecture: Introduced
IImageConverter
interface withFileHandlerImageConverter
implementation using SixLabors.ImageSharp for PNG conversion• Improved file selection system: Refactored from simple ID-based to message-based file selection with detailed context including message ID, file index, and source
• API endpoint restructuring: Updated instruct mode controller endpoints from
/upload
to/form
with specialized request models• Enhanced AI-powered responses: Added
AiResponseHelper
for generating contextual user feedback in file operations• Package updates: Updated Google GenerativeAI (2.5.8→3.2.0), Azure OpenAI (2.2.0-beta.5→2.3.0-beta.2), OpenAI (2.3.0→2.4.0), and SixLabors.ImageSharp (3.1.7→3.1.11)
• Configuration enhancements: Added comprehensive FileHandler and FileSelect settings with LLM configuration support
• Bug fixes: Improved error handling in chart plotting and removed deprecated additional message wrapper functionality
Diagram Walkthrough
File Walkthrough
32 files
InstructModeController.cs
Refactor API endpoints and add image conversion support
src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs
• Updated API endpoint paths from
/upload
to/form
for multi-modaloperations
• Renamed parameter variables from
input
torequest
forconsistency
• Added
ImageConvertProvider
property toInstructOptions
for image processing operations
• Updated request types to use more
specific file request models
ChatCompletionProvider.cs
Enhance Azure OpenAI chat completion with advanced features
src/Plugins/BotSharp.Plugin.AzureOpenAI/Providers/Chat/ChatCompletionProvider.cs
• Added
#pragma warning disable OPENAI001
to suppress OpenAI warnings• Enhanced chat completion with
ToolCallId
andAnnotations
support•
Refactored message preparation with new helper methods for content
parts
• Added support for reasoning effort levels and web search
options
ChatCompletionProvider.cs
Add multi-modal and advanced features to DeepSeek chat provider
src/Plugins/BotSharp.Plugin.DeepSeekAI/Providers/Chat/ChatCompletionProvider.cs
• Added
#pragma warning disable OPENAI001
and new imports for filehandling
• Enhanced chat completion with
Annotations
support for webresources
• Added multi-modal support with image content parts
collection
• Implemented reasoning effort levels and web search
configuration
FileInstructService.SelectFile.cs
Enhance file selection service with improved filtering and AI
selection
src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs
• Refactored file selection logic to use routing context and message
limits
• Updated file selection criteria with new
FileSelectItem
structure
• Enhanced file attachment to dialog messages with proper
indexing
• Improved AI-based file selection with better prompt
handling
EditImageFn.cs
Enhance image editing function with conversion and AI responses
src/Plugins/BotSharp.Plugin.FileHandler/Functions/EditImageFn.cs
• Added image conversion support with configurable providers
•
Enhanced error handling and response generation for image editing
•
Integrated conversation settings for file selection parameters
• Added
AI-powered response generation for better user feedback
ChatCompletionProvider.cs
Enhance OpenAI chat provider with annotations and multi-modal
improvements
src/Plugins/BotSharp.Plugin.OpenAI/Providers/Chat/ChatCompletionProvider.cs
• Added support for chat annotations with web resource information
•
Refactored message content parts collection into reusable helper
method
• Added image detail level configuration support
• Enhanced
multi-modal message handling for both user and assistant roles
GenerateImageFn.cs
Enhance image generation with configurable providers and AI responses
src/Plugins/BotSharp.Plugin.FileHandler/Functions/GenerateImageFn.cs
• Added configurable LLM provider and model selection for image
generation
• Enhanced response generation with AI-powered
user-friendly messages
• Improved image generation settings with
response format configuration
• Added better error handling and file
saving feedback
FileInstructService.Image.cs
Add image conversion support and improve image processing
src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.Image.cs
• Added image conversion support for image editing operations
•
Enhanced text content handling with fallback to instruction templates
• Updated default model from
dall-e-2
togpt-image-1
for consistency•
Improved file name building for mask operations
ReadImageFn.cs
Enhance image reading with configurable providers and improved file
handling
src/Plugins/BotSharp.Plugin.FileHandler/Functions/ReadImageFn.cs
• Added configurable LLM provider and model selection
• Enhanced file
collection to include both user and bot images
• Added image detail
level configuration support
• Improved agent configuration with proper
LLM settings
GeminiChatCompletionProvider.cs
Add multi-modal support to Google AI chat provider
src/Plugins/BotSharp.Plugin.GoogleAI/Providers/Chat/GeminiChatCompletionProvider.cs
• Added multi-modal support for assistant messages with file
attachments
• Refactored content parts collection into reusable helper
method
• Enhanced message handling to support both text and file
content
• Improved code organization with better separation of
concerns
ReadPdfFn.cs
Enhance PDF reading with configurable providers and settings
src/Plugins/BotSharp.Plugin.FileHandler/Functions/ReadPdfFn.cs
• Added configurable LLM provider and model selection for PDF reading
• Enhanced agent configuration with proper LLM settings
• Added image
detail level configuration support
• Improved error handling and
provider selection logic
WebIntelligentSearchFn.cs
Add configurable LLM providers to web search function
src/Infrastructure/BotSharp.Core/WebSearch/Functions/WebIntelligentSearchFn.cs
• Added configurable LLM provider and model selection for web search
•
Enhanced model selection logic with web search capability detection
•
Improved provider configuration with fallback mechanisms
• Updated
agent name for consistency
InstructBaseRequest.cs
Add specialized request models with image conversion support
src/Infrastructure/BotSharp.OpenAPI/ViewModels/Instructs/Request/InstructBaseRequest.cs
• Added new request models for specific file operations
(ImageEditFileRequest, PdfReadFileRequest, etc.)
• Added
ImageConvertProvider
property to image-related requests• Separated
file-based requests from base requests for better type safety
•
Enhanced request structure with more specific typing
LocalFileStorageService.Conversation.cs
Add file indexing and improve PDF conversion interface
src/Infrastructure/BotSharp.Core/Files/Services/Storage/LocalFileStorageService.Conversation.cs
• Added
FileIndex
property to message file models• Updated PDF to
image conversion to use new
IImageConverter
interface• Reduced thread
sleep time from 100ms to 50ms for better performance
• Enhanced file
model creation with proper indexing
HandleEmailSenderFn.cs
Clean up dependencies and enhance email file handling
src/Plugins/BotSharp.Plugin.EmailHandler/Functions/HandleEmailSenderFn.cs
• Removed unused dependencies (
IHttpClientFactory
,IHttpContextAccessor
)• Enhanced file selection with conversation
settings integration
• Added proper configuration for file selection
parameters
• Improved file attachment handling for email operations
FileInstructService.Pdf.cs
Update PDF processing with new converter interface
src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.Pdf.cs
• Updated PDF to image conversion to use new
IImageConverter
interface• Enhanced conversion method with instruction options parameter
•
Updated default model from
gpt-4o
togpt-5-mini
• Improved converter
selection logic
FileHandlerImageConverter.cs
Add new image converter implementation with PNG support
src/Plugins/BotSharp.Plugin.FileHandler/Converters/FileHandlerImageConverter.cs
• Added new image converter implementation using SixLabors.ImageSharp
• Supports PNG conversion with configurable color types (RGBA, RGB,
Grayscale, etc.)
• Implements
IImageConverter
interface for imageprocessing operations
• Provides error handling and fallback to
original binary data
ImageCompletionProvider.Generation.cs
Add background support to OpenAI image generation
src/Plugins/BotSharp.Plugin.OpenAI/Providers/Image/ImageCompletionProvider.Generation.cs
• Added
#pragma warning disable OPENAI001
to suppress OpenAI warnings• Added support for
image_background
parameter in image generation•
Enhanced image generation options with background configuration
•
Updated image count handling with better parameter processing
TencentCosService.Conversation.cs
Add file indexing and update converter interface for Tencent COS
src/Plugins/BotSharp.Plugin.TencentCos/Services/TencentCosService.Conversation.cs
• Added
FileIndex
property extraction from subdirectory structure•
Updated PDF to image conversion to use new
IImageConverter
interface•
Enhanced file model creation with proper indexing
• Improved converter
selection logic
SelectFileOptions.cs
Refactor file selection options with enhanced configuration
src/Infrastructure/BotSharp.Abstraction/Files/Models/SelectFileOptions.cs
• Refactored to extend
LlmConfigBase
for consistent LLM configuration• Renamed
IncludeBotFile
toIsIncludeBotFiles
for clarity• Added
MessageLimit
,IsAttachFiles
, andData
properties• Replaced
Offset
with
MessageLimit
for better controlImageCompletionProvider.Edit.cs
Add background support to OpenAI image editing
src/Plugins/BotSharp.Plugin.OpenAI/Providers/Image/ImageCompletionProvider.Edit.cs
• Added
#pragma warning disable OPENAI001
to suppress OpenAI warnings• Added support for
image_background
parameter in image editing•
Enhanced image edit options with background configuration
• Updated
image count handling with better parameter processing
LlmModelSetting.cs
Add background configuration to image model settings
src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
• Added
Background
property toImageGenerationSetting
andImageEditSetting
• Enhanced image model settings with background
configuration support
• Added region comments for better code
organization
• Improved settings structure for image-related
operations
AiResponseHelper.cs
Add AI response helper for enhanced user feedback
src/Plugins/BotSharp.Plugin.FileHandler/Helpers/AiResponseHelper.cs
• Added new helper class for AI-powered response generation
• Provides
default response formatting for file operations
• Implements image
generation response creation with LLM integration
• Enhances user
experience with contextual response messages
IImageConverter.cs
Add new image converter interface for extensible image processing
src/Infrastructure/BotSharp.Abstraction/Files/Converters/IImageConverter.cs
• Added new interface for image conversion operations
• Supports both
PDF to image conversion and image format conversion
• Provides
extensible architecture for different converter implementations
•
Includes optional configuration through
ImageConvertOptions
FileInstructService.cs
Add image converter support to file instruction service
src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.cs
• Added
GetImageConverter
helper method for converter selection•
Enhanced service with image conversion capability
• Added support for
configurable converter providers
• Improved file processing
infrastructure
FileSelectContext.cs
Enhance file selection context with detailed item information
src/Infrastructure/BotSharp.Abstraction/Files/Models/FileSelectContext.cs
• Replaced simple ID-based selection with detailed file selection
items
• Added
FileSelectItem
class with message ID, file index, andsource
• Enhanced file selection context with more granular control
•
Improved file identification and selection accuracy
ImageConvertOptions.cs
Add ImageConvertOptions model for image conversion settings
src/Infrastructure/BotSharp.Abstraction/Files/Models/ImageConvertOptions.cs
• Added new
ImageConvertOptions
class with default properties forimage conversion
• Includes
ImageType
property defaulting to "png" andColorType
property defaulting to "rgba"util-file-select_file_instruction.liquid
Refactor file selection template with enhanced message-based approach
src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-select_file_instruction.liquid
• Completely rewrote file selection instruction template with new
structured approach
• Changed from simple file ID selection to
message-based file selection with
message_id
,file_source
, andfile_index
• Added detailed requirements and response format sections
for better file selection logic
• Replaced example-based approach with
step-by-step instruction methodology
util-chart-plot_instruction.liquid
Remove report summary from chart plotting response format
src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_instruction.liquid
• Removed
report_summary
field from the JSON response format•
Simplified output to only include
greeting_message
andjs_code
fieldsutil-file-generate_image.fn.liquid
Clarify image generation function usage conditions
src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-generate_image.fn.liquid
• Modified instruction to clarify when NOT to call
util-file-generate_image
• Added specific condition about not calling
function when user wants to change or edit existing images
util-file-edit_image.fn.liquid
Expand image editing function trigger conditions
src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-edit_image.fn.liquid
• Added "modify" to the list of actions that trigger image editing
function
• Enhanced instruction to include more comprehensive editing
scenarios
util-file-edit_image.json
Refine image editing function parameter description
src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-file-edit_image.json
• Updated
user_request
parameter description to be more specific aboutuser requirements for image editing
1 files
PlotChartFn.cs
Improve chart plotting error handling and simplify response processing
src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs
• Enhanced error handling for AI chart response deserialization
•
Removed additional message wrapper functionality
• Simplified response
handling with better error recovery
• Improved code robustness with
try-catch for JSON deserialization
4 files
RoleDialogModel.cs
Remove additional message wrapper functionality from dialog model
src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs
• Removed
AdditionalMessageWrapper
property and related functionality• Simplified dialog model by removing sequential message sending
capability
• Cleaned up JSON serialization attributes
• Streamlined
model structure for better maintainability
ConversationController.cs
Remove additional message wrapper from conversation controller
src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
• Removed
AdditionalMessageWrapper
handling from conversationresponses
• Simplified response processing by removing sequential
message functionality
• Cleaned up response model assignments
•
Streamlined conversation flow handling
Using.cs
Add new global using statements for converters and helpers
src/Plugins/BotSharp.Plugin.FileHandler/Using.cs
• Added new global using statements for file converters and helpers
•
Enhanced namespace imports for better code organization
• Added
support for new converter interfaces and helper classes
• Improved
code accessibility with additional imports
ConversationStorage.cs
Remove additional message wrapper from conversation storage
src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStorage.cs
• Removed handling of
AdditionalMessageWrapper
in dialog storage•
Simplified dialog element building process
• Cleaned up conversation
storage logic
• Streamlined dialog processing workflow
4 files
FileHandlerSettings.cs
Add comprehensive file handler settings configuration
src/Plugins/BotSharp.Plugin.FileHandler/Settings/FileHandlerSettings.cs
• Added comprehensive settings structure for image and PDF operations
• Added
ImageConverter
configuration with provider selection• Created
specialized settings classes for different file operations
• Added
FileLlmSettingBase
for consistent LLM configurationConversationSetting.cs
Add file selection settings to conversation configuration
src/Infrastructure/BotSharp.Abstraction/Conversations/Settings/ConversationSetting.cs
• Added
FileSelectSetting
property for file selection configuration•
Created new
FileSelectSetting
class extendingLlmConfigBase
• Enhanced
conversation settings with file handling capabilities
• Added message
limit configuration for file selection
appsettings.json
Add FileHandler and FileSelect configuration sections
src/WebStarter/appsettings.json
• Added new
FileSelect
configuration section with LLM settings forfile selection
• Added comprehensive
FileHandler
configuration sectionwith image and PDF handling settings
• Included new
ImageConverter
provider configuration
agent.json
Update agent LLM model and add reasoning effort configuration
src/Infrastructure/BotSharp.Core/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/agent.json
• Updated LLM model from "gpt-4o-mini" to "gpt-5-mini"
• Added new
reasoning_effort_level
property set to "minimal"2 files
Directory.Packages.props
Update AI and image processing package versions
Directory.Packages.props
• Updated
Google_GenerativeAI
andGoogle_GenerativeAI.Live
fromversion 2.5.8 to 3.2.0
• Updated
SixLabors.ImageSharp
from version3.1.7 to 3.1.11
• Updated
Azure.AI.OpenAI
from version 2.2.0-beta.5 to2.3.0-beta.2
• Updated
OpenAI
from version 2.3.0 to 2.4.0BotSharp.Plugin.FileHandler.csproj
Add ImageSharp package reference for image processing
src/Plugins/BotSharp.Plugin.FileHandler/BotSharp.Plugin.FileHandler.csproj
• Added
SixLabors.ImageSharp
package reference to the project17 files