-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Blazor sample. * Added missed files. * Collapsed if statements.
- Loading branch information
Showing
57 changed files
with
21,438 additions
and
14 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
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,12 @@ | ||
{ | ||
"profiles": { | ||
"Whetstone.ChatGPT.Test": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:52444;http://localhost:52449" | ||
} | ||
} | ||
} |
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
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
12 changes: 12 additions & 0 deletions
12
src/examples/Whetstone.ChatGPT.CommandLineBot/Properties/launchSettings.json
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,12 @@ | ||
{ | ||
"profiles": { | ||
"Whetstone.ChatGPT.CommandLineBot": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:52443;http://localhost:52448" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/examples/Whetstone.ChatGPT.SimpleCommandlineBot/Properties/launchSettings.json
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,12 @@ | ||
{ | ||
"profiles": { | ||
"Whetstone.ChatGPT.SimpleCommandLineBot": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:52450;http://localhost:52452" | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/examples/blazor/Whetstone.ChatGPT.Blazor.App/Whetstone.ChatGPT.Blazor.App/App.razor
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,48 @@ | ||
<Blazorise.ThemeProvider Theme="@theme"> | ||
<Router AppAssembly="typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="routeData" DefaultLayout="typeof(Whetstone.ChatGPT.Blazor.App.Layouts.MainLayout)" /> | ||
</Found> | ||
<NotFound> | ||
<p>Sorry, there's nothing at this address.</p> | ||
</NotFound> | ||
</Router> | ||
<MessageProvider /> | ||
< NotificationProvider /> | ||
<PageProgressProvider /> | ||
</Blazorise.ThemeProvider> | ||
@code { | ||
private Theme theme = new() | ||
{ | ||
BarOptions = new() | ||
{ | ||
HorizontalHeight = "72px" | ||
}, | ||
ColorOptions = new() | ||
{ | ||
Primary = "#0288D1", | ||
Secondary = "#A65529", | ||
Success = "#23C02E", | ||
Info = "#9BD8FE", | ||
Warning = "#F8B86C", | ||
Danger = "#F95741", | ||
Light = "#F0F0F0", | ||
Dark = "#535353", | ||
}, | ||
BackgroundOptions = new() | ||
{ | ||
Primary = "#0288D1", | ||
Secondary = "#A65529", | ||
Success = "#23C02E", | ||
Info = "#9BD8FE", | ||
Warning = "#F8B86C", | ||
Danger = "#F95741", | ||
Light = "#F0F0F0", | ||
Dark = "#535353", | ||
}, | ||
InputOptions = new() | ||
{ | ||
CheckColor = "#0288D1", | ||
} | ||
}; | ||
} |
34 changes: 34 additions & 0 deletions
34
...one.ChatGPT.Blazor.App/Whetstone.ChatGPT.Blazor.App/Components/AuthenticationStatus.razor
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,34 @@ | ||
|
||
@inject NavigationManager Navigation | ||
|
||
@inject ApplicationState CurrentState | ||
@inject IChatGPTClient ChatClient | ||
|
||
|
||
|
||
<h4> | ||
@if (CurrentState.IsOpenAIAuthenticated) | ||
{ | ||
<Button Clicked="@PurgeCredentials"><Blazorise.Icons.FontAwesome.Icon Name="IconName.LockOpen" IconSize="IconSize.Large" />Clear API Key</Button> | ||
} | ||
else | ||
{ | ||
<Button Clicked="@ShowLogin"> | ||
<Blazorise.Icons.FontAwesome.Icon Name="IconName.LockOpen" IconSize="IconSize.Large"/>Validate API Key</Button> | ||
} | ||
</h4> | ||
|
||
<LogIn @ref="loginModal"></LogIn> | ||
|
||
<!-- | ||
<Button Color="" @onclick="() => smModal?.ShowAsync()">Small modal</Button> | ||
<Modal @ref="smModal" Title="Small modal" Size="ModalSize.Small"> | ||
<BodyTemplate>Small modal</BodyTemplate> | ||
</Modal> | ||
--> |
25 changes: 25 additions & 0 deletions
25
....ChatGPT.Blazor.App/Whetstone.ChatGPT.Blazor.App/Components/AuthenticationStatus.razor.cs
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,25 @@ | ||
| ||
using Blazorise.Bootstrap5; | ||
using Whetstone.ChatGPT.Blazor.App.State; | ||
|
||
namespace Whetstone.ChatGPT.Blazor.App.Components | ||
{ | ||
public partial class AuthenticationStatus | ||
{ | ||
private LogIn? loginModal; | ||
|
||
private void ShowLogin() | ||
{ | ||
if (loginModal is not null) | ||
{ | ||
loginModal?.Show(); | ||
} | ||
} | ||
|
||
public void PurgeCredentials() | ||
{ | ||
ChatClient.Credentials = null; | ||
CurrentState.IsOpenAIAuthenticated = false; | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...tstone.ChatGPT.Blazor.App/Whetstone.ChatGPT.Blazor.App/Components/ErrorNotification.razor
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,43 @@ | ||
|
||
<Alert Color="Color.Danger" @ref="errAlert"> | ||
<CloseButton Float="Float.End" Clicked="@ErrorClosedAsync"/> | ||
<AlertDescription> | ||
@if(StatusCode is not null) | ||
{ | ||
<div class="row"> | ||
Status: @StatusCode | ||
</div> | ||
} | ||
|
||
@if(chatError is null) | ||
{ | ||
<div class="row"> | ||
Message: @exception?.Message | ||
</div> | ||
} | ||
else | ||
{ | ||
@if (chatError?.Message is not null) | ||
{ | ||
<div class="row"> | ||
Message: @chatError.Message | ||
</div> | ||
} | ||
|
||
@if (chatError?.Type is not null) | ||
{ | ||
<div class="row"> | ||
Type: @chatError.Type | ||
</div> | ||
} | ||
|
||
@if (chatError?.Code is not null) | ||
{ | ||
<div class="row"> | ||
Code: @chatError.Code | ||
</div> | ||
} | ||
} | ||
</AlertDescription> | ||
|
||
</Alert> |
Oops, something went wrong.