Skip to content

Commit

Permalink
udpate (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleLittleCloud authored Aug 30, 2024
1 parent 3220c91 commit 7650f91
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ChatRoom.sln
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChatRoom.Planner", "ChatRoo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChatRoom.Planner.Tests", "test\ChatRoom.Planner.Tests\ChatRoom.Planner.Tests.csproj", "{8669DBAE-75B0-4347-9648-1B8C6E389035}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hello-world", "example\dotnet\hello-world\hello-world.csproj", "{F8A1FDE5-930E-48D0-A26C-00620701CB78}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hello-world", "example\dotnet\hello-world\hello-world.csproj", "{F8A1FDE5-930E-48D0-A26C-00620701CB78}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "agent-chatroom-release-room", "example\dotnet\gh-release-note-room\agent-chatroom-release-room.csproj", "{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -276,6 +278,18 @@ Global
{F8A1FDE5-930E-48D0-A26C-00620701CB78}.Release|x64.Build.0 = Release|Any CPU
{F8A1FDE5-930E-48D0-A26C-00620701CB78}.Release|x86.ActiveCfg = Release|Any CPU
{F8A1FDE5-930E-48D0-A26C-00620701CB78}.Release|x86.Build.0 = Release|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Debug|x64.ActiveCfg = Debug|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Debug|x64.Build.0 = Debug|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Debug|x86.ActiveCfg = Debug|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Debug|x86.Build.0 = Debug|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Release|Any CPU.Build.0 = Release|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Release|x64.ActiveCfg = Release|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Release|x64.Build.0 = Release|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Release|x86.ActiveCfg = Release|Any CPU
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -299,6 +313,7 @@ Global
{0B450A6C-5EF2-409D-8079-B61D235E1FB7} = {C0FE0076-894A-4462-8B31-3099EDBCE0A7}
{8669DBAE-75B0-4347-9648-1B8C6E389035} = {4503B3D3-D2C7-4FE8-A450-5A051089635C}
{F8A1FDE5-930E-48D0-A26C-00620701CB78} = {24BF590F-A466-4AB2-B750-A14C4CA2EFF2}
{9D8E5FD9-E067-4C5E-B648-FE431A8ED52B} = {24BF590F-A466-4AB2-B750-A14C4CA2EFF2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E2F0A4B1-A064-41DD-B0C3-A4FF892EF46A}
Expand Down
1 change: 1 addition & 0 deletions ChatRoom/ChatRoom.Github/ChatRoom.Github.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ItemGroup>
<InternalsVisibleTo Include="ChatRoom.Github.Tests" />
<InternalsVisibleTo Include="ChatRoom.Client" />
<InternalsVisibleTo Include="agent-chatroom-release-room" />
</ItemGroup>

<ItemGroup>
Expand Down
74 changes: 74 additions & 0 deletions example/dotnet/gh-release-note-room/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using AutoGen.Core;
using AutoGen.OpenAI;
using AutoGen.OpenAI.Extension;
using Azure.AI.OpenAI;
using ChatRoom.Github;
using ChatRoom.SDK;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Octokit;

var roomConfig = new RoomConfiguration
{
Room = "room",
Port = 30000,
};

var serverConfig = new ChatRoomServerConfiguration
{
RoomConfig = roomConfig,
YourName = "User",
ServerConfig = new ServerConfiguration
{
Urls = "http://localhost:50001",
},
};

using var host = Host.CreateDefaultBuilder()
.UseChatRoomServer(serverConfig)
.Build();

await host.StartAsync();
var client = host.Services.GetRequiredService<ChatPlatformClient>();

var openAIApiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? throw new Exception("OPENAI_API_KEY is not set.");
var openAIClient = new OpenAIClient(openAIApiKey);
var ghClient = new GitHubClient(new ProductHeaderValue("ChatRoom"));
var repoOwner = "LittleLittleCloud";
var repoName = "Agent-ChatRoom";

var issueHelper = GithubAgentFactory.CreateIssueHelperAgent(openAIClient, "gpt-4o-mini", ghClient, repoOwner, repoName);

var gpt4oWriter = new OpenAIChatAgent(
openAIClient: openAIClient,
name: "release-note-writer",
modelName: "gpt-4o-mini",
systemMessage: """
You write release notes based on github issues.
The release note should include the following sections:
- New Features
- Bug Fixes
- Improvements
- Documentation
""")
.RegisterMessageConnector()
.RegisterPrintMessage();

var groupChatAdmin = new OpenAIChatAgent(
openAIClient: openAIClient,
name: "admin",
modelName: "gpt-4o-mini")
.RegisterMessageConnector()
.RegisterPrintMessage();


// the user agent's name must match with ChatRoomServerConfiguration.YourName field.
// When chatroom starts, it will be replaced by a built-in user agent.
var userAgent = new DefaultReplyAgent("User", "<dummy>");

var groupChat = new GroupChat([userAgent, issueHelper, gpt4oWriter], admin: groupChatAdmin);

// add groupchat to chatroom
await client.RegisterAutoGenGroupChatAsync("release-room", groupChat);
await host.WaitForShutdownAsync();
3 changes: 3 additions & 0 deletions example/dotnet/gh-release-note-room/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Agent-Chat release room

This room is for drafting release notes for new releases of the Agent-Chatroom project.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>gh_release_note_room</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\ChatRoom\ChatRoom.Github\ChatRoom.Github.csproj" />
<ProjectReference Include="..\..\..\ChatRoom\ChatRoom.Common\ChatRoom.SDK.csproj" />
<ProjectReference Include="..\..\..\ChatRoom\ChatRoom.StaticWebUI\ChatRoom.StaticWebUI.csproj" />
</ItemGroup>

</Project>

0 comments on commit 7650f91

Please sign in to comment.