Skip to content

Commit 2d710d4

Browse files
author
Haiping Chen
committed
2 parents 21aab66 + 23cbe41 commit 2d710d4

File tree

35 files changed

+372
-75
lines changed

35 files changed

+372
-75
lines changed

src/Infrastructure/BotSharp.Abstraction/Browsing/Settings/WebBrowsingSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class WebBrowsingSettings
66
public bool Headless { get; set; }
77
// Default timeout in milliseconds
88
public float DefaultTimeout { get; set; } = 30000;
9+
public float DefaultNavigationTimeout { get; set; } = 30000;
910
public bool IsEnableScreenshot { get; set; }
1011
// Default wait time in seconds after page is opened
1112
public int DefaultWaitTime { get; set; } = 5;

src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public interface IConversationService
99
string ConversationId { get; }
1010
Task<Conversation> NewConversation(Conversation conversation);
1111
void SetConversationId(string conversationId, List<MessageState> states, bool isReadOnly = false);
12-
Task<Conversation> GetConversation(string id);
12+
Task<Conversation> GetConversation(string id, bool isLoadStates = false);
1313
Task<PagedItems<Conversation>> GetConversations(ConversationFilter filter);
1414
Task<Conversation> UpdateConversationTitle(string id, string title);
1515
Task<Conversation> UpdateConversationTitleAlias(string id, string titleAlias);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class TokenStatsModel
66
public string Model { get; set; }
77
public string Prompt { get; set; }
88
public int PromptCount { get; set; }
9+
public int CachedPromptCount { get; set; }
910
public int CompletionCount { get; set; }
1011
public AgentLlmConfig LlmConfig { get; set; }
1112
}

src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionDef.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public class FunctionDef
2525
[JsonPropertyName("parameters")]
2626
public FunctionParametersDef Parameters { get; set; } = new FunctionParametersDef();
2727

28+
[JsonPropertyName("output")]
29+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
30+
public string? Output { get; set; }
31+
2832
public override string ToString()
2933
{
3034
return $"{Name}: {Description}";

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ public class InstructHookBase : IInstructHook
88

99
public virtual async Task BeforeCompletion(Agent agent, RoleDialogModel message)
1010
{
11-
return;
11+
await Task.CompletedTask;
1212
}
1313

1414
public virtual async Task AfterCompletion(Agent agent, InstructResult result)
1515
{
16-
return;
16+
await Task.CompletedTask;
1717
}
1818

1919
public virtual async Task OnResponseGenerated(InstructResponseModel response)
2020
{
21-
return;
21+
await Task.CompletedTask;
2222
}
2323
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace BotSharp.Abstraction.Instructs.Models;
2+
3+
public class ExecuteTemplateArgs
4+
{
5+
[JsonPropertyName("template_name")]
6+
public string? TemplateName { get; set; }
7+
}

src/Infrastructure/BotSharp.Abstraction/Instructs/Settings/InstructionSettings.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@ namespace BotSharp.Abstraction.Instructs.Settings;
22

33
public class InstructionSettings
44
{
5-
public bool EnableLog { get; set; }
5+
public InstructionLogSetting Logging { get; set; } = new();
66
}
7+
8+
public class InstructionLogSetting
9+
{
10+
public bool Enabled { get; set; } = true;
11+
public List<string> ExcludedAgentIds { get; set; } = [];
12+
}

src/Infrastructure/BotSharp.Abstraction/Loggers/Models/InstructionLogModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace BotSharp.Abstraction.Loggers.Models;
55
public class InstructionLogModel
66
{
77
[JsonPropertyName("id")]
8+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
89
public string Id { get; set; } = default!;
910

1011
[JsonPropertyName("agent_id")]

src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,22 @@ public class LlmModelSetting
6262
/// </summary>
6363
public int Dimension { get; set; }
6464

65+
public LlmCost AdditionalCost { get; set; } = new();
66+
6567
public override string ToString()
6668
{
6769
return $"[{Type}] {Name} {Endpoint}";
6870
}
6971
}
7072

73+
public class LlmCost
74+
{
75+
public float CachedPromptCost { get; set; } = 0f;
76+
public float AudioPromptCost { get; set; } = 0f;
77+
public float ReasoningCompletionCost { get; } = 0f;
78+
public float AudioCompletionCost { get; } = 0f;
79+
}
80+
7181
public enum LlmModelType
7282
{
7383
Text = 1,

src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationFilter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class ConversationFilter
2727

2828
public List<string>? Tags { get; set; }
2929

30+
public bool IsLoadLatestStates { get; set; }
31+
3032
public static ConversationFilter Empty()
3133
{
3234
return new ConversationFilter();

0 commit comments

Comments
 (0)