-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from LittleLittleCloud/u/xiaoyun/cleanup
U/xiaoyun/cleanup
- Loading branch information
Showing
46 changed files
with
1,243 additions
and
88 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-repl": { | ||
"version": "0.1.205", | ||
"commands": [ | ||
"dotnet-repl" | ||
] | ||
}, | ||
"docfx": { | ||
"version": "2.67.5", | ||
"commands": [ | ||
"docfx" | ||
] | ||
} | ||
} | ||
} |
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,79 @@ | ||
# Your GitHub workflow file under .github/workflows/ | ||
# Trigger the action on push to main | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# * is a special character in YAML so you have to quote this string | ||
- cron: '30 5,17 * * *' | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
actions: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
publish-docs: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
# checkout autogen library | ||
# url: https://github.com/microsoft/autogen/tree/dotnet | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: ls | ||
run: ls | ||
- name: Dotnet Setup | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
global-json-file: global.json | ||
|
||
- run: dotnet tool update -g docfx | ||
- run: docfx website/docfx.json | ||
|
||
- name: insert clarity snippet to website/_site/index.html | ||
run: | | ||
# import os | ||
# clarity_script = """ | ||
# <script type="text/javascript"> | ||
# (function(c,l,a,r,i,t,y){ | ||
# c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; | ||
# t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; | ||
# y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); | ||
# })(window, document, "clarity", "script", "lnypewntq4"); | ||
# </script> | ||
# """ | ||
# site_folder = 'website/_site/' | ||
# for root, dirs, files in os.walk(site_folder): | ||
# for file in files: | ||
# if file.endswith('.html'): | ||
# html_path = os.path.join(root, file) | ||
# # insert the script into the html's head section | ||
# with open(html_path, 'r') as file: | ||
# html = file.read() | ||
# html = html.replace('</head>', clarity_script + '</head>') | ||
# with open(html_path, 'w') as file: | ||
# file.write(html) | ||
# print(f'Clarity script inserted into {html_path}') | ||
shell: python | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
# Upload entire repository | ||
path: 'dotnet/website/_site' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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 |
---|---|---|
|
@@ -402,4 +402,7 @@ FodyWeavers.xsd | |
|
||
# bin | ||
bin | ||
obj | ||
obj | ||
|
||
# website | ||
_site |
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,71 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Spectre.Console.Cli; | ||
|
||
namespace ChatRoom.Client; | ||
|
||
public class ChatRoomClientCommandSettings : CommandSettings | ||
{ | ||
[Description("The room name to create.")] | ||
[CommandOption("-r|--room <ROOM>")] | ||
public string? Room { get; init; } = null; | ||
|
||
[Description("The port to listen.")] | ||
[CommandOption("-p|--port <PORT>")] | ||
public int? Port { get; init; } = null; | ||
|
||
[Description("Your name in the room")] | ||
[CommandOption("-n|--name <NAME>")] | ||
public string YourName { get; init; } = "User"; | ||
|
||
[Description("Configuration file")] | ||
[CommandOption("-c|--config <CONFIG>")] | ||
public string? ConfigFile { get; init; } = null; | ||
} | ||
|
||
public class ChatRoomClientCommand : AsyncCommand<ChatRoomClientCommandSettings> | ||
{ | ||
public override async Task<int> ExecuteAsync(CommandContext context, ChatRoomClientCommandSettings command) | ||
{ | ||
var config = command.ConfigFile is not null | ||
? JsonSerializer.Deserialize<ChatRoomClientConfiguration>(File.ReadAllText(command.ConfigFile))! | ||
: new ChatRoomClientConfiguration(); | ||
|
||
config.RoomConfig.Room = command.Room ?? config.RoomConfig.Room; | ||
config.RoomConfig.Port = command.Port ?? config.RoomConfig.Port; | ||
config.YourName = command.YourName; | ||
|
||
var host = Host.CreateDefaultBuilder() | ||
.UseOrleans(siloBuilder => | ||
{ | ||
siloBuilder | ||
.UseLocalhostClustering(config.RoomConfig.Port) | ||
.AddMemoryGrainStorage("PubSubStore") | ||
.ConfigureLogging(logBuilder => | ||
{ | ||
logBuilder | ||
.ClearProviders(); | ||
}); | ||
}) | ||
.ConfigureServices(serviceCollection => | ||
{ | ||
serviceCollection.AddSingleton(config); | ||
serviceCollection.AddSingleton(config.RoomConfig); | ||
serviceCollection.AddSingleton(config.ChannelConfig); | ||
serviceCollection.AddHostedService<ConsoleChatRoomService>(); | ||
}) | ||
.Build(); | ||
|
||
await host.RunAsync(); | ||
|
||
return 0; | ||
} | ||
} |
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,29 @@ | ||
using System.Text.Json.Serialization; | ||
using ChatRoom.Room; | ||
using Json.Schema.Generation; | ||
|
||
namespace ChatRoom.Client; | ||
|
||
public class ChatRoomClientConfiguration | ||
{ | ||
[Description("The configuration for the chat room")] | ||
[JsonPropertyName("room_config")] | ||
public RoomConfiguration RoomConfig { get; set; } = new RoomConfiguration(); | ||
|
||
[Description("The configuration for the chat channel")] | ||
[JsonPropertyName("channel_config")] | ||
public ChannelConfiguration ChannelConfig { get; set; } = new ChannelConfiguration(); | ||
|
||
[JsonPropertyName("agent_extensions")] | ||
public List<AgentExtensionConfiguration> AgentExtensions { get; set; } = []; | ||
|
||
[JsonPropertyName("name")] | ||
[Description("Your name in the chat room")] | ||
public string YourName { get; set; } = "User"; | ||
} | ||
|
||
public class AgentExtensionConfiguration | ||
{ | ||
[JsonPropertyName("name")] | ||
public string Name { get; init; } = null!; | ||
} |
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,8 @@ | ||
using AutoGen.Core; | ||
|
||
namespace ChatRoom.SDK | ||
{ | ||
internal class AgentCollectionService : List<IAgent> | ||
{ | ||
} | ||
} |
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
Oops, something went wrong.