Skip to content

Commit be6f60c

Browse files
committed
Add a help chatbot
1 parent 7cdabb5 commit be6f60c

File tree

5 files changed

+72
-4
lines changed

5 files changed

+72
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,4 @@ FakesAssemblies/
191191
*.txt
192192
*.v3
193193
*.v5
194+
*.bin
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Microsoft.SemanticKernel;
2+
3+
namespace GeneralUpdate.Bowl
4+
{
5+
public class BowlBootstrap
6+
{
7+
public async Task Launch()
8+
{
9+
var builder = new KernelBuilder();
10+
11+
builder.WithAzureChatCompletionService(
12+
"gpt-35-turbo", // Azure OpenAI Deployment Name
13+
"https://contoso.openai.azure.com/", // Azure OpenAI Endpoint
14+
"...your Azure OpenAI Key..."); // Azure OpenAI Key
15+
16+
// Alternative using OpenAI
17+
//builder.WithOpenAIChatCompletionService(
18+
// "gpt-3.5-turbo", // OpenAI Model name
19+
// "...your OpenAI API Key..."); // OpenAI API Key
20+
21+
var kernel = builder.Build();
22+
23+
var prompt = @"{{$input}}
24+
25+
One line TLDR with the fewest words.";
26+
27+
var summarize = kernel.CreateSemanticFunction(prompt, maxTokens: 100);
28+
29+
string text1 = @"
30+
1st Law of Thermodynamics - Energy cannot be created or destroyed.
31+
2nd Law of Thermodynamics - For a spontaneous process, the entropy of the universe increases.
32+
3rd Law of Thermodynamics - A perfect crystal at zero Kelvin has zero entropy.";
33+
34+
string text2 = @"
35+
1. An object at rest remains at rest, and an object in motion remains in motion at constant speed and in a straight line unless acted on by an unbalanced force.
36+
2. The acceleration of an object depends on the mass of the object and the amount of force applied.
37+
3. Whenever one object exerts a force on another object, the second object exerts an equal and opposite on the first.";
38+
39+
Console.WriteLine(await summarize.InvokeAsync(text1));
40+
41+
Console.WriteLine(await summarize.InvokeAsync(text2));
42+
43+
// Output:
44+
// Energy conserved, entropy increases, zero entropy at 0K.
45+
// Objects move in response to forces.
46+
}
47+
}
48+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
11+
</ItemGroup>
12+
13+
</Project>

src/WPF/GeneralUpdate.Packet/ViewModels/PacketViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal class PacketViewModel : ViewModeBase
2020

2121
private string sourcePath, targetPath, patchPath, infoMessage, url, packetName;
2222
private List<string> _formats, _encodings, _appTypes;
23-
private string _currentFormat, _currentEncoding, _currnetAppType, _currentVersion, _currentClientAppKey;
23+
private string _currentFormat, _currentEncoding, _currentAppType, _currentVersion, _currentClientAppKey;
2424
private bool isPublish;
2525
private AsyncRelayCommand buildCommand;
2626
private AsyncRelayCommand<string> selectFolderCommand;
@@ -127,8 +127,8 @@ public string CurrentEncoding
127127

128128
public string CurrentAppType
129129
{
130-
get => _currnetAppType;
131-
set => SetProperty(ref _currnetAppType, value);
130+
get => _currentAppType;
131+
set => SetProperty(ref _currentAppType, value);
132132
}
133133

134134
public string CurrentVersion { get => _currentVersion; set => SetProperty(ref _currentVersion, value); }

src/WPF/GeneralUpdate.Tool.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.2.32317.152
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneralUpdate.Packet", "GeneralUpdate.Packet\GeneralUpdate.Packet.csproj", "{C4D2EDCB-D350-4552-B959-E5C7EE1049CC}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneralUpdate.Packet", "GeneralUpdate.Packet\GeneralUpdate.Packet.csproj", "{C4D2EDCB-D350-4552-B959-E5C7EE1049CC}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneralUpdate.Bowl", "GeneralUpdate.Bowl\GeneralUpdate.Bowl.csproj", "{CA88674D-719A-48E4-A7FD-552E71D1C1F1}"
79
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
1517
{C4D2EDCB-D350-4552-B959-E5C7EE1049CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{C4D2EDCB-D350-4552-B959-E5C7EE1049CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{C4D2EDCB-D350-4552-B959-E5C7EE1049CC}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{CA88674D-719A-48E4-A7FD-552E71D1C1F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{CA88674D-719A-48E4-A7FD-552E71D1C1F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{CA88674D-719A-48E4-A7FD-552E71D1C1F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{CA88674D-719A-48E4-A7FD-552E71D1C1F1}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)