Skip to content

Commit d94b5cb

Browse files
authored
Merge pull request #916 from iceljc/features/add-latest-state
Features/add latest state
2 parents 4a5ec1c + f60bcda commit d94b5cb

File tree

70 files changed

+1168
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1168
-101
lines changed

src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>$(TargetFramework)</TargetFramework>

src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public class RoleDialogModel : ITrackableMessage
108108
[JsonPropertyName("generated_images")]
109109
public List<ImageGeneration> GeneratedImages { get; set; } = new List<ImageGeneration>();
110110

111-
111+
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
112+
public string RenderedInstruction { get; set; } = string.Empty;
112113

113114
private RoleDialogModel()
114115
{

src/Infrastructure/BotSharp.Abstraction/Instructs/IInstructHook.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public interface IInstructHook
77
string SelfId { get; }
88
Task BeforeCompletion(Agent agent, RoleDialogModel message);
99
Task AfterCompletion(Agent agent, InstructResult result);
10+
Task OnResponseGenerated(InstructResponseModel response);
1011
}

src/Infrastructure/BotSharp.Abstraction/Instructs/InstructHookBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ public virtual async Task AfterCompletion(Agent agent, InstructResult result)
1515
{
1616
return;
1717
}
18+
19+
public virtual async Task OnResponseGenerated(InstructResponseModel response)
20+
{
21+
return;
22+
}
1823
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Collections.Generic;
2+
3+
namespace BotSharp.Abstraction.Instructs.Models;
4+
5+
public class InstructLogFilter : Pagination
6+
{
7+
public List<string>? AgentIds { get; set; }
8+
public List<string>? Providers { get; set; }
9+
public List<string>? Models { get; set; }
10+
public List<string>? TemplateNames { get; set; }
11+
12+
public static InstructLogFilter Empty()
13+
{
14+
return new InstructLogFilter();
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace BotSharp.Abstraction.Instructs.Models;
2+
3+
public class InstructResponseModel
4+
{
5+
public string? AgentId { get; set; }
6+
public string Provider { get; set; } = default!;
7+
public string Model { get; set; } = default!;
8+
public string? TemplateName { get; set; }
9+
public string UserMessage { get; set; } = default!;
10+
public string? SystemInstruction { get; set; }
11+
public string CompletionText { get; set; } = default!;
12+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Text.Json;
2+
3+
namespace BotSharp.Abstraction.Loggers.Models;
4+
5+
public class InstructionLogModel
6+
{
7+
[JsonPropertyName("id")]
8+
public string Id { get; set; } = default!;
9+
10+
[JsonPropertyName("agent_id")]
11+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
12+
public string? AgentId { get; set; }
13+
14+
[JsonPropertyName("agent_name")]
15+
[JsonIgnore]
16+
public string? AgentName { get; set; }
17+
18+
[JsonPropertyName("provider")]
19+
public string Provider { get; set; } = default!;
20+
21+
[JsonPropertyName("model")]
22+
public string Model { get; set; } = default!;
23+
24+
[JsonPropertyName("template_name")]
25+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
26+
public string? TemplateName { get; set; }
27+
28+
[JsonPropertyName("user_message")]
29+
public string UserMessage { get; set; } = string.Empty;
30+
31+
[JsonPropertyName("system_instruction")]
32+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
33+
public string? SystemInstruction { get; set; }
34+
35+
[JsonPropertyName("completion_text")]
36+
public string CompletionText { get; set; } = string.Empty;
37+
38+
[JsonPropertyName("user_id")]
39+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
40+
public string? UserId { get; set; }
41+
42+
[JsonIgnore]
43+
public Dictionary<string, string> States { get; set; } = [];
44+
45+
[JsonPropertyName("states")]
46+
public Dictionary<string, JsonDocument> InnerStates { get; set; } = [];
47+
48+
[JsonPropertyName("created_time")]
49+
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
50+
}

src/Infrastructure/BotSharp.Abstraction/MLTasks/IAudioCompletion.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public interface IAudioCompletion
66
{
77
string Provider { get; }
88

9+
string Model { get; }
10+
911
Task<string> GenerateTextFromAudioAsync(Stream audio, string audioFileName, string? text = null);
1012
Task<BinaryData> GenerateAudioFromTextAsync(string text);
1113

src/Infrastructure/BotSharp.Abstraction/MLTasks/IChatCompletion.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ public interface IChatCompletion
77
/// </summary>
88
string Provider { get; }
99

10+
string Model { get; }
11+
1012
/// <summary>
1113
/// Set model name, one provider can consume different model or version(s)
1214
/// </summary>

src/Infrastructure/BotSharp.Abstraction/MLTasks/IImageCompletion.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public interface IImageCompletion
99
/// </summary>
1010
string Provider { get; }
1111

12+
string Model { get; }
13+
1214
/// <summary>
1315
/// Set model name, one provider can consume different model or version(s)
1416
/// </summary>

0 commit comments

Comments
 (0)