-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* do it all :) * save implementation as it comes * add sandbox skill * generate files via the sandbox skill in output/src --------- Co-authored-by: Kosta Petan <[email protected]>
- Loading branch information
1 parent
0b920fc
commit 1fcac01
Showing
7 changed files
with
108 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
# Mono auto generated files | ||
mono_crash.* | ||
|
||
output | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using DotNet.Testcontainers.Builders; | ||
using Microsoft.SemanticKernel.SkillDefinition; | ||
|
||
public class SandboxSkill | ||
{ | ||
[SKFunction("Run a script in Alpine sandbox")] | ||
[SKFunctionInput(Description = "The script to be executed")] | ||
[SKFunctionName("RunInAlpine")] | ||
public async Task<string> RunInAlpineAsync(string input) | ||
{ | ||
return await RunInContainer(input, "alpine"); | ||
} | ||
|
||
[SKFunction("Run a script in dotnet alpine sandbox")] | ||
[SKFunctionInput(Description = "The script to be executed")] | ||
[SKFunctionName("RunInDotnetAlpine")] | ||
public async Task<string> RunInDotnetAlpineAsync(string input) | ||
{ | ||
return await RunInContainer(input, "mcr.microsoft.com/dotnet/sdk:7.0"); | ||
} | ||
|
||
private async Task<string> RunInContainer(string input, string image) | ||
{ | ||
var tempScriptFile = $"{Guid.NewGuid().ToString()}.sh"; | ||
var tempScriptPath = $"./output/{tempScriptFile}"; | ||
await File.WriteAllTextAsync(tempScriptPath, input); | ||
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(),"output", "src")); | ||
var dotnetContainer = new ContainerBuilder() | ||
.WithName(Guid.NewGuid().ToString("D")) | ||
.WithImage(image) | ||
.WithBindMount(Path.Combine(Directory.GetCurrentDirectory(),"output", "src"), "/src") | ||
.WithBindMount(Path.Combine(Directory.GetCurrentDirectory(), tempScriptPath), $"/src/{tempScriptFile}") | ||
.WithWorkingDirectory("/src") | ||
.WithCommand("sh", tempScriptFile) | ||
.Build(); | ||
|
||
await dotnetContainer.StartAsync() | ||
.ConfigureAwait(false); | ||
// Cleanup | ||
File.Delete(tempScriptPath); | ||
File.Delete(Path.Combine(Directory.GetCurrentDirectory(), "output", "src", tempScriptFile)); | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
I'd like to build a typical Todo List Application: a simple productivity tool that allows users to create, manage, and track tasks or to-do items. | ||
Key features of the Todo List application include the ability to add, edit, and delete tasks, set due dates and reminders, categorize tasks by project or priority, and mark tasks as complete. | ||
The Todo List applications also offer collaboration features, such as sharing tasks with others or assigning tasks to team members. | ||
Additionally, the Todo List application will offer offer mobile and web-based interfaces, allowing users to access their tasks from anywhere. | ||
Additionally, the Todo List application will offer offer mobile and web-based interfaces, allowing users to access their tasks from anywhere. | ||
Use C# as the language. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
You are a Developer for an application. | ||
Please output the code or script required to accomplish the task assigned to you below. | ||
Please output the code required to accomplish the task assigned to you below and wrap it in a bash script that creates the files. | ||
Do not use any IDE commands and do not build and run the code. | ||
Make specific choices about implementation. Do not offer a range of options. | ||
Use comments in the code to describe the intent. Do not include other text other than code and code comments. | ||
Input: {{$input}} |