Skip to content

Commit ff08a39

Browse files
authored
Merge pull request #1206 from iceljc/features/refine-agent-rule
Features/refine agent rule
2 parents 90b5a51 + dfbedf6 commit ff08a39

File tree

67 files changed

+1338
-667
lines changed

Some content is hidden

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

67 files changed

+1338
-667
lines changed

src/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ public interface IAgentService
7272
Task<List<AgentCodeScript>> GetAgentCodeScripts(string agentId, AgentCodeScriptFilter? filter = null)
7373
=> Task.FromResult(new List<AgentCodeScript>());
7474

75-
Task<string?> GetAgentCodeScript(string agentId, string scriptName, string scriptType = AgentCodeScriptType.Src)
76-
=> Task.FromResult(string.Empty);
75+
Task<AgentCodeScript?> GetAgentCodeScript(string agentId, string scriptName, string scriptType = AgentCodeScriptType.Src)
76+
=> Task.FromResult((AgentCodeScript?)null);
7777

7878
Task<bool> UpdateAgentCodeScripts(string agentId, List<AgentCodeScript> codeScripts, AgentCodeScriptUpdateOptions? options = null)
7979
=> Task.FromResult(false);
8080

8181
Task<bool> DeleteAgentCodeScripts(string agentId, List<AgentCodeScript>? codeScripts = null)
8282
=> Task.FromResult(false);
8383

84-
Task<CodeGenerationResult> GenerateCodeScript(string agentId, string text, CodeProcessOptions? options = null)
84+
Task<CodeGenerationResult> GenerateCodeScript(string agentId, string text, CodeGenHandleOptions? options = null)
8585
=> Task.FromResult(new CodeGenerationResult());
8686
}

src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentCodeScript.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ public class AgentCodeScript : AgentCodeScriptBase
55
public string Id { get; set; }
66
public string AgentId { get; set; } = null!;
77

8+
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
9+
public DateTime UpdatedTime { get; set; } = DateTime.UtcNow;
10+
811
public AgentCodeScript() : base()
912
{
1013
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace BotSharp.Abstraction.Coding.Contexts;
2+
3+
public class CodeExecutionContext
4+
{
5+
public AgentCodeScript CodeScript { get; set; }
6+
public List<KeyValue> Arguments { get; set; } = [];
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace BotSharp.Abstraction.Coding.Enums;
2+
3+
public static class BuiltInCodeProcessor
4+
{
5+
public const string PyInterpreter = "botsharp-py-interpreter";
6+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace BotSharp.Abstraction.Coding.Models;
2+
3+
public class CodeExecutionResponseModel
4+
{
5+
public string CodeProcessor { get; set; } = default!;
6+
public AgentCodeScript CodeScript { get; set; }
7+
public IDictionary<string, string>? Arguments { get; set; }
8+
public string Text { get; set; } = default!;
9+
public string ExecutionResult { get; set; } = default!;
10+
}

src/Infrastructure/BotSharp.Abstraction/Coding/Options/CodeProcessOptions.cs renamed to src/Infrastructure/BotSharp.Abstraction/Coding/Options/CodeGenHandleOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace BotSharp.Abstraction.Coding.Options;
22

3-
public class CodeProcessOptions : CodeGenerationOptions
3+
public class CodeGenHandleOptions : CodeGenerationOptions
44
{
55
/// <summary>
66
/// Code processor provider

src/Infrastructure/BotSharp.Abstraction/Coding/Options/CodeGenerationOptions.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ public class CodeGenerationOptions : LlmConfigBase
1717
public string? TemplateName { get; set; }
1818

1919
/// <summary>
20-
/// The programming language
20+
/// Programming language
2121
/// </summary>
22-
[JsonPropertyName("language")]
23-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
24-
public string? Language { get; set; } = "python";
22+
[JsonPropertyName("programming_language")]
23+
public string? ProgrammingLanguage { get; set; }
2524

2625
/// <summary>
2726
/// Data that can be used to fill in the prompt

src/Infrastructure/BotSharp.Abstraction/Coding/Responses/CodeInterpretResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ public class CodeInterpretResponse : ResponseBase
66

77
public override string ToString()
88
{
9-
return Result.IfNullOrEmptyAs(ErrorMsg ?? $"Success: {Success}")!;
9+
return Result.IfNullOrEmptyAs(ErrorMsg.IfNullOrEmptyAs($"Success: {Success}"))!;
1010
}
1111
}

src/Infrastructure/BotSharp.Abstraction/Coding/Settings/CodingSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public class CodeScriptExecutionSettings
1818
public string? Processor { get; set; }
1919
public bool UseLock { get; set; }
2020
public bool UseProcess { get; set; }
21-
public int? TimeoutSeconds { get; set; }
21+
public int TimeoutSeconds { get; set; } = 3;
2222
public int MaxConcurrency { get; set; } = 1;
2323
}

src/Infrastructure/BotSharp.Abstraction/Files/Options/FileHandleOptions.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
namespace BotSharp.Abstraction.Files.Options;
22

3-
public class FileHandleOptions
3+
public class FileHandleOptions : LlmConfigBase
44
{
5-
/// <summary>
6-
/// Llm provider
7-
/// </summary>
8-
public string? Provider { get; set; }
9-
10-
/// <summary>
11-
/// llm model
12-
/// </summary>
13-
public string? Model { get; set; }
14-
15-
/// <summary>
16-
/// Llm maximum output tokens
17-
/// </summary>
18-
public int? MaxOutputTokens { get; set; }
19-
20-
/// <summary>
21-
/// Reasoning effort level
22-
/// </summary>
23-
public string? ReasoningEfforLevel { get; set; }
24-
255
/// <summary>
266
/// Instruction
277
/// </summary>

0 commit comments

Comments
 (0)