Skip to content

Commit 4960429

Browse files
author
Piotr Stachaczynski
committed
cd: infer done cli refactor in progress
1 parent 265f605 commit 4960429

33 files changed

Lines changed: 106 additions & 108 deletions

Examples/Examples/Utils/ImagePreviewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Examples.Utils;
99

1010
public static class ImagePreview
1111
{
12-
public static void ShowImage(byte[] imageData, string extension = "png")
12+
public static void ShowImage(byte[]? imageData, string extension = "png")
1313
{
1414
// Validate extension
1515
if (string.IsNullOrWhiteSpace(extension) || extension.Contains("."))

src/MaIN.Core.UnitTests/AgentContextTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void WithBehaviour_ShouldAddBehaviourAndSetCurrent()
125125
public async Task CreateAsync_ShouldCallAgentServiceCreateAgent()
126126
{
127127
// Arrange
128-
var agent = new Agent();
128+
var agent = new Agent() {Id = Guid.NewGuid().ToString()};
129129
_mockAgentService
130130
.Setup(s => s.CreateAgent(
131131
It.IsAny<Agent>(),

src/MaIN.Core/Hub/Contexts/AgentContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal AgentContext(IAgentService agentService, Agent existingAgent)
4040
_agent = existingAgent;
4141
}
4242

43-
public AgentContext WithId(string id)
43+
public AgentContext WithId(string? id)
4444
{
4545
_agent.Id = id;
4646
return this;
@@ -97,13 +97,13 @@ public AgentContext WithInitialPrompt(string prompt)
9797
return this;
9898
}
9999

100-
public AgentContext WithSteps(List<string> steps)
100+
public AgentContext WithSteps(List<string>? steps)
101101
{
102102
_agent.Context.Steps = steps;
103103
return this;
104104
}
105105

106-
public AgentContext WithBehaviour(string name, string instruction)
106+
public AgentContext WithBehaviour(string? name, string instruction)
107107
{
108108
_agent.Behaviours ??= new Dictionary<string, string>();
109109
_agent.Behaviours[name] = instruction;

src/MaIN.Core/Hub/Contexts/ChatContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public ChatContext EnableVisual()
112112
public async Task<ChatResult> CompleteAsync(
113113
bool translate = false,
114114
bool interactive = false,
115-
Func<string, Task>? changeOfValue = null)
115+
Func<string?, Task>? changeOfValue = null)
116116
{
117117
if (_chat.Id == null || !await ChatExists(_chat.Id))
118118
{

src/MaIN.Core/Hub/Utils/StepBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace MaIN.Core.Hub.Utils;
22

33
public class StepBuilder
44
{
5-
public List<string> Steps = new();
5+
public List<string>? Steps = new();
66
public static StepBuilder Instance => new();
77

88
public StepBuilder Answer()
@@ -35,7 +35,7 @@ public StepBuilder Redirect(string agentId, string output = "AS_Output", string
3535
return this;
3636
}
3737

38-
public List<string> Build()
38+
public List<string>? Build()
3939
{
4040
return Steps;
4141
}

src/MaIN.Domain/Entities/Agents/Agent.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ namespace MaIN.Domain.Entities.Agents;
22

33
public class Agent
44
{
5-
public string Id { get; set; }
6-
public string Name { get; set; }
7-
public string Model { get; set; }
8-
public string? Description { get; set; }
5+
public required string Id { get; set; }
6+
public string Name { get; set; } = null!;
7+
public string Model { get; set; } = null!;
8+
public string? Description { get; init; }
99
public bool Started { get; set; }
1010
public bool Flow { get; set; }
11-
public AgentData Context { get; set; }
11+
public AgentData? Context { get; set; }
1212
public string? ChatId { get; set; }
1313
public int Order { get; set; }
1414
public Dictionary<string, string>? Behaviours { get; set; }

src/MaIN.Domain/Entities/Agents/AgentData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class AgentData
44
{
55
public string Instruction { get; set; }
66
public AgentSource.AgentSource? Source { get; set; }
7-
public List<string> Steps { get; set; }
7+
public List<string>? Steps { get; set; }
88
public List<string>? Relations { get; set; }
99

1010
}

src/MaIN.Domain/Entities/Agents/AgentRelations.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/MaIN.Domain/Entities/Agents/Commands/StartCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ namespace MaIN.Domain.Entities.Agents.Commands;
44

55
public class StartCommand : BaseCommand
66
{
7-
public string InitialPrompt { get; set; }
7+
public string? InitialPrompt { get; init; }
88
}

src/MaIN.Domain/Entities/Chat.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ namespace MaIN.Domain.Entities;
22

33
public class Chat
44
{
5-
public string Id { get; set; }
6-
public string Name { get; set; }
7-
public string Model { get; set; }
5+
public string Id { get; init; } = null!;
6+
public string Name { get; init; } = null!;
7+
public string Model { get; set; } = null!;
88
public List<Message> Messages { get; set; } = [];
99
public ChatType Type { get; set; } = ChatType.Conversation;
1010
public bool Visual { get; set; } = false;
1111
public InferenceParams InterferenceParams { get; set; } = new();
12-
public Dictionary<string, string> Properties { get; set; } = [];
13-
public List<string> Memory { get; set; } = [];
12+
public Dictionary<string, string> Properties { get; init; } = [];
13+
public List<string> Memory { get; } = [];
1414

1515
public bool Interactive = false;
1616
public bool Translate = false;

0 commit comments

Comments
 (0)