Skip to content

Commit ca9405b

Browse files
committed
Change agentContext to agentConfig
- remove nameConflict with Core Class
1 parent ab4a431 commit ca9405b

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

Frontend/MainFE/Components/Models/AgentDto.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class AgentDto
2121
public bool Started { get; set; }
2222
[JsonPropertyName("flow")]
2323
public bool Flow { get; set; }
24-
[JsonPropertyName("context")]
25-
public AgentConfigDto Context { get; set; }
24+
[JsonPropertyName("config")]
25+
public AgentConfigDto Config { get; set; }
2626
public AgentProcessingState State { get; set; }
2727
public bool IsProcessing { get; set; }
2828
public List<string>? AgentDependencies { get; set; } = [];

src/MaIN.Domain/Exceptions/Agents/AgentContextNotFoundException.cs renamed to src/MaIN.Domain/Exceptions/Agents/AgentConfigNotFoundException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System.Net;
1+
using System.Net;
22

33
namespace MaIN.Domain.Exceptions.Agents;
44

5-
public class AgentContextNotFoundException(string agentId) : MaINCustomException($"Context of agent with id: '{agentId}' not found.")
5+
public class AgentConfigNotFoundException(string agentId) : MaINCustomException($"Context of agent with id: '{agentId}' not found.")
66
{
77
public override string PublicErrorMessage => "Agent context not found.";
88
public override HttpStatusCode HttpStatusCode => HttpStatusCode.NotFound;

src/MaIN.Infrastructure/Mappers/AgentDocumentMapper.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,39 @@ internal static class AgentDocumentMapper
3939
Description = agent.Description,
4040
Behaviours = agent.Behaviours,
4141
CurrentBehaviour = agent.CurrentBehaviour,
42-
Config = agent.Config?.ToDomain() ?? throw new AgentContextNotFoundException(agent.Id)
42+
Config = agent.Config?.ToDomain() ?? throw new AgentConfigNotFoundException(agent.Id)
4343
};
4444

45-
internal static AgentConfigDocument ToDocument(this AgentConfig context) => new()
45+
internal static AgentConfigDocument ToDocument(this AgentConfig config) => new()
4646
{
47-
Instruction = context.Instruction,
48-
Relations = context.Relations?.ToList(),
49-
Steps = context.Steps?.ToList(),
50-
McpConfig = context.McpConfig,
51-
Source = context.Source is not null
47+
Instruction = config.Instruction,
48+
Relations = config.Relations?.ToList(),
49+
Steps = config.Steps?.ToList(),
50+
McpConfig = config.McpConfig,
51+
Source = config.Source is not null
5252
? new AgentSourceDocument
5353
{
54-
DetailsSerialized = JsonSerializer.Serialize(context.Source.Details),
55-
AdditionalMessage = context.Source.AdditionalMessage,
56-
Type = Enum.Parse<AgentSourceTypeDocument>(context.Source.Type.ToString())
54+
DetailsSerialized = JsonSerializer.Serialize(config.Source.Details),
55+
AdditionalMessage = config.Source.AdditionalMessage,
56+
Type = Enum.Parse<AgentSourceTypeDocument>(config.Source.Type.ToString())
5757
}
5858
: null
5959
};
6060

61-
internal static AgentConfig ToDomain(this AgentConfigDocument agentContextDocument) => new()
61+
internal static AgentConfig ToDomain(this AgentConfigDocument agentConfigDocument) => new()
6262
{
63-
Instruction = agentContextDocument.Instruction,
64-
Relations = agentContextDocument.Relations,
65-
McpConfig = agentContextDocument.McpConfig,
66-
Source = agentContextDocument.Source is not null
63+
Instruction = agentConfigDocument.Instruction,
64+
Relations = agentConfigDocument.Relations,
65+
McpConfig = agentConfigDocument.McpConfig,
66+
Source = agentConfigDocument.Source is not null
6767
? new AgentSource
6868
{
69-
AdditionalMessage = agentContextDocument.Source.AdditionalMessage,
70-
Details = agentContextDocument.Source.DetailsSerialized,
71-
Type = Enum.Parse<AgentSourceType>(agentContextDocument.Source.Type.ToString())
69+
AdditionalMessage = agentConfigDocument.Source.AdditionalMessage,
70+
Details = agentConfigDocument.Source.DetailsSerialized,
71+
Type = Enum.Parse<AgentSourceType>(agentConfigDocument.Source.Type.ToString())
7272
}
7373
: null,
74-
Steps = agentContextDocument.Steps
74+
Steps = agentConfigDocument.Steps
7575
};
7676

7777
internal static AgentFlowDocument ToDocument(this AgentFlow agentFlow) => new()

src/MaIN.Services/Dtos/Rag/AgentDto.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class AgentDto
1515
public string? Description { get; init; }
1616
[JsonPropertyName("started")]
1717
public bool Started { get; init; }
18-
[JsonPropertyName("context")]
19-
public AgentConfigDto Context { get; init; } = null!;
18+
[JsonPropertyName("config")]
19+
public AgentConfigDto Config { get; init; } = null!;
2020

2121
[JsonPropertyName("order")]
2222
public int Order { get; init; }

src/MaIN.Services/Mappers/AgentMapper.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ public static AgentDto ToDto(this Agent agent)
1919
Description = agent.Description,
2020
Behaviours = agent.Behaviours,
2121
CurrentBehaviour = agent.CurrentBehaviour,
22-
Context = agent.Config.ToDto()
22+
Config = agent.Config.ToDto()
2323
};
2424

25-
public static AgentConfigDto ToDto(this AgentConfig agentContext)
25+
public static AgentConfigDto ToDto(this AgentConfig agentConfig)
2626
=> new()
2727
{
28-
Instruction = agentContext.Instruction!,
29-
Relations = agentContext.Relations,
30-
Steps = agentContext.Steps ?? [],
31-
Source = (agentContext.Source is not null ? new AgentSourceDto()
28+
Instruction = agentConfig.Instruction!,
29+
Relations = agentConfig.Relations,
30+
Steps = agentConfig.Steps ?? [],
31+
Source = (agentConfig.Source is not null ? new AgentSourceDto()
3232
{
33-
Details = agentContext.Source?.Details,
34-
AdditionalMessage = agentContext?.Source?.AdditionalMessage,
35-
Type = Enum.Parse<AgentSourceTypeDto>(agentContext?.Source?.Type.ToString()!)
33+
Details = agentConfig.Source?.Details,
34+
AdditionalMessage = agentConfig?.Source?.AdditionalMessage,
35+
Type = Enum.Parse<AgentSourceTypeDto>(agentConfig?.Source?.Type.ToString()!)
3636
} : null)!
3737
};
3838

@@ -48,20 +48,20 @@ public static Agent ToDomain(this AgentDto agent)
4848
Description = agent.Description,
4949
Behaviours = agent.Behaviours,
5050
CurrentBehaviour = agent.CurrentBehaviour,
51-
Config = agent.Context.ToDomain()
51+
Config = agent.Config.ToDomain()
5252
};
5353

54-
public static AgentConfig ToDomain(this AgentConfigDto agentContextDto)
54+
public static AgentConfig ToDomain(this AgentConfigDto agentConfigDto)
5555
=> new()
5656
{
57-
Instruction = agentContextDto.Instruction,
58-
Relations = agentContextDto?.Relations,
59-
Source = agentContextDto?.Source is not null ? new AgentSource()
57+
Instruction = agentConfigDto.Instruction,
58+
Relations = agentConfigDto?.Relations,
59+
Source = agentConfigDto?.Source is not null ? new AgentSource()
6060
{
61-
Details = agentContextDto?.Source?.Details,
62-
AdditionalMessage = agentContextDto?.Source?.AdditionalMessage,
63-
Type = Enum.Parse<AgentSourceType>(agentContextDto?.Source?.Type.ToString()!)
61+
Details = agentConfigDto?.Source?.Details,
62+
AdditionalMessage = agentConfigDto?.Source?.AdditionalMessage,
63+
Type = Enum.Parse<AgentSourceType>(agentConfigDto?.Source?.Type.ToString()!)
6464
} : null,
65-
Steps = agentContextDto!.Steps
65+
Steps = agentConfigDto!.Steps
6666
};
6767
}

0 commit comments

Comments
 (0)