add demo script
This commit is contained in:
parent
5be85d3f4b
commit
babb8795b3
|
|
@ -80,6 +80,7 @@
|
|||
<None Remove="data\agents\01fcc3e5-0af7-49e6-ad7a-a760bd12dc4d\instructions\instruction.liquid" />
|
||||
<None Remove="data\agents\01e2fc5c-2c89-4ec7-8470-7688608b496c\agent.json" />
|
||||
<None Remove="data\agents\01e2fc5c-2c89-4ec7-8470-7688608b496c\instructions\instruction.liquid" />
|
||||
<None Remove="data\agents\01e2fc5c-2c89-4ec7-8470-7688608b496c\codes\src\demo.py" />
|
||||
<None Remove="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\agent.json" />
|
||||
<None Remove="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\instructions\instruction.liquid" />
|
||||
<None Remove="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\templates\.welcome.liquid" />
|
||||
|
|
@ -126,7 +127,7 @@
|
|||
<Content Include="data\agents\01e2fc5c-2c89-4ec7-8470-7688608b496c\instructions\instruction.liquid">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\agent.json">
|
||||
<Content Include="data\agents\01e2fc5c-2c89-4ec7-8470-7688608b496c\codes\src\demo.py">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\functions\response_to_user.json">
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@ public partial class InstructService
|
|||
response = new InstructResult
|
||||
{
|
||||
MessageId = message.MessageId,
|
||||
Template = scriptName,
|
||||
Text = result?.Result?.ToString()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace BotSharp.Core.Repository;
|
|||
|
||||
public partial class FileRepository
|
||||
{
|
||||
#region Code
|
||||
#region Code script
|
||||
public List<AgentCodeScript> GetAgentCodeScripts(string agentId, AgentCodeScriptFilter? filter = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(agentId))
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace BotSharp.Plugin.MongoStorage.Repository;
|
|||
|
||||
public partial class MongoRepository
|
||||
{
|
||||
#region Code
|
||||
#region Code script
|
||||
public List<AgentCodeScript> 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<AgentCodeScriptDocument>.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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue