mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-11-04 02:20:20 +00:00 
			
		
		
		
	Refactored EMPTY_BLOCK into the agent base class
This commit is contained in:
		
							parent
							
								
									96e6372fcd
								
							
						
					
					
						commit
						74757c8fa4
					
				@ -11,6 +11,14 @@ namespace AIStudio.Agents;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : IAgent
 | 
					public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : IAgent
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    protected static readonly ContentBlock EMPTY_BLOCK = new()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Content = null,
 | 
				
			||||||
 | 
					        ContentType = ContentType.NONE,
 | 
				
			||||||
 | 
					        Role = ChatRole.AGENT,
 | 
				
			||||||
 | 
					        Time = DateTimeOffset.UtcNow,
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    protected static readonly JsonSerializerOptions JSON_SERIALIZER_OPTIONS = new()
 | 
					    protected static readonly JsonSerializerOptions JSON_SERIALIZER_OPTIONS = new()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
 | 
					        PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
 | 
				
			||||||
 | 
				
			|||||||
@ -12,14 +12,6 @@ namespace AIStudio.Agents;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection> logger, ILogger<AgentBase> baseLogger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : AgentBase(baseLogger, settingsManager, dataSourceService, rng)
 | 
					public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection> logger, ILogger<AgentBase> baseLogger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : AgentBase(baseLogger, settingsManager, dataSourceService, rng)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private static readonly ContentBlock EMPTY_BLOCK = new()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        Content = null,
 | 
					 | 
				
			||||||
        ContentType = ContentType.NONE,
 | 
					 | 
				
			||||||
        Role = ChatRole.AGENT,
 | 
					 | 
				
			||||||
        Time = DateTimeOffset.UtcNow,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    private readonly List<ContentBlock> answers = new();
 | 
					    private readonly List<ContentBlock> answers = new();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    #region Overrides of AgentBase
 | 
					    #region Overrides of AgentBase
 | 
				
			||||||
 | 
				
			|||||||
@ -6,14 +6,6 @@ namespace AIStudio.Agents;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public sealed class AgentTextContentCleaner(ILogger<AgentBase> logger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : AgentBase(logger, settingsManager, dataSourceService, rng)
 | 
					public sealed class AgentTextContentCleaner(ILogger<AgentBase> logger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : AgentBase(logger, settingsManager, dataSourceService, rng)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private static readonly ContentBlock EMPTY_BLOCK = new()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        Content = null,
 | 
					 | 
				
			||||||
        ContentType = ContentType.NONE,
 | 
					 | 
				
			||||||
        Role = ChatRole.AGENT,
 | 
					 | 
				
			||||||
        Time = DateTimeOffset.UtcNow,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    private readonly List<ContentBlock> context = new();
 | 
					    private readonly List<ContentBlock> context = new();
 | 
				
			||||||
    private readonly List<ContentBlock> answers = new();
 | 
					    private readonly List<ContentBlock> answers = new();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user