diff --git a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj index 7b0e55ac..d960ca18 100644 --- a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj +++ b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj @@ -80,6 +80,7 @@ + @@ -126,7 +127,7 @@ PreserveNewest - + PreserveNewest diff --git a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs index 70a2257b..7be841f5 100644 --- a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs +++ b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs @@ -233,6 +233,7 @@ public partial class InstructService response = new InstructResult { MessageId = message.MessageId, + Template = scriptName, Text = result?.Result?.ToString() }; diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentCodeScript.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentCodeScript.cs index 7482f358..764287dd 100644 --- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentCodeScript.cs +++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.AgentCodeScript.cs @@ -4,7 +4,7 @@ namespace BotSharp.Core.Repository; public partial class FileRepository { - #region Code + #region Code script public List GetAgentCodeScripts(string agentId, AgentCodeScriptFilter? filter = null) { if (string.IsNullOrWhiteSpace(agentId)) diff --git a/src/Infrastructure/BotSharp.Core/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/codes/src/demo.py b/src/Infrastructure/BotSharp.Core/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/codes/src/demo.py new file mode 100644 index 00000000..438a6a87 --- /dev/null +++ b/src/Infrastructure/BotSharp.Core/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/codes/src/demo.py @@ -0,0 +1,12 @@ +import argparse + +def main(): + parser = argparse.ArgumentParser(description="Receive named arguments") + parser.add_argument("--first_name", required=True, help="The first name") + parser.add_argument("--last_name", required=True, help="The last name") + + args = parser.parse_args() + print(f"Hello, {args.first_name} {args.last_name}!") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCodeScriptDocument.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCodeScriptDocument.cs index 7b877fda..9a39fb58 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCodeScriptDocument.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCodeScriptDocument.cs @@ -8,6 +8,8 @@ public class AgentCodeScriptDocument : MongoBase public string Name { get; set; } = default!; public string Content { get; set; } = default!; public string ScriptType { get; set; } = default!; + public DateTime CreatedTime { get; set; } + public DateTime UpdatedTime { get; set; } public static AgentCodeScriptDocument ToMongoModel(AgentCodeScript script) { diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentCodeScript.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentCodeScript.cs index 8e81b293..3d551b7d 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentCodeScript.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.AgentCodeScript.cs @@ -5,7 +5,7 @@ namespace BotSharp.Plugin.MongoStorage.Repository; public partial class MongoRepository { - #region Code + #region Code script public List GetAgentCodeScripts(string agentId, AgentCodeScriptFilter? filter = null) { if (string.IsNullOrWhiteSpace(agentId)) @@ -72,6 +72,7 @@ public partial class MongoRepository builder.Eq(y => y.ScriptType, x.ScriptType) }), Builders.Update.Set(y => y.Content, x.Content) + .Set(x => x.UpdatedTime, DateTime.UtcNow) )) .ToList(); @@ -91,6 +92,8 @@ public partial class MongoRepository var script = AgentCodeScriptDocument.ToMongoModel(x); script.AgentId = agentId; script.Id = x.Id.IfNullOrEmptyAs(Guid.NewGuid().ToString()); + script.CreatedTime = DateTime.UtcNow; + script.UpdatedTime = DateTime.UtcNow; return script; }).ToList();