-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add in Chat UI to Quickstart Playground #3913
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Data; | ||
|
||
namespace DevHome.Common.Environments.Converters; | ||
|
||
/// <summary> | ||
/// Converter to convert the PromptStatus bool value to a style that will be used by the GenerateButton. | ||
/// </summary> | ||
public class PromptStatusToGenerateButtonStyle : IValueConverter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This converter works on a bool and has domain knowledge and "PromptStyle" I suggest to rename the class to something generic |
||
{ | ||
public object? Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
bool validStatus = (bool)value; | ||
|
||
switch (validStatus) | ||
{ | ||
case true: | ||
return Application.Current.Resources["AccentButtonStyle"] as Style; | ||
case false: | ||
return Application.Current.Resources["DefaultButtonStyle"] as Style; | ||
} | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Data; | ||
|
||
namespace DevHome.Common.Environments.Converters; | ||
|
||
/// <summary> | ||
/// Converter to convert the PromptStatus bool value to a style that will be used by the SubmitButton. | ||
/// </summary> | ||
public class PromptStatusToSubmitButtonStyle : IValueConverter | ||
{ | ||
public object? Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
bool validStatus = (bool)value; | ||
|
||
switch (validStatus) | ||
{ | ||
case true: | ||
return Application.Current.Resources["DefaultButtonStyle"] as Style; | ||
case false: | ||
return Application.Current.Resources["AccentButtonStyle"] as Style; | ||
} | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
namespace DevHome.SetupFlow.Models; | ||
|
||
/// <summary> | ||
/// Wrapper class for the IQuickStartProjectProvider interface that can be used throughout the application. | ||
/// Wrapper class for the IQuickStartProjectProvider2 interface that can be used throughout the application. | ||
/// Note: Additional methods added to this class should be wrapped in try/catch blocks to ensure that | ||
/// exceptions don't bubble up to the caller as the methods are cross proc COM calls. | ||
/// </summary> | ||
|
@@ -21,7 +21,7 @@ | |
|
||
private readonly string _errorString; | ||
|
||
private readonly IQuickStartProjectProvider _quickStartProjectProvider; | ||
private readonly IQuickStartProjectProvider2 _quickStartProjectProvider; | ||
Check failure on line 24 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, x64, windows-latest, 8.0.x)
Check failure on line 24 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)
Check failure on line 24 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)
Check failure on line 24 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Debug, x86, windows-latest, 8.0.x)
|
||
|
||
public string PackageFullName { get; } | ||
|
||
|
@@ -34,7 +34,7 @@ | |
public string[] SamplePrompts { get; } | ||
|
||
public QuickStartProjectProvider( | ||
IQuickStartProjectProvider quickStartProjectProvider, | ||
IQuickStartProjectProvider2 quickStartProjectProvider, | ||
Check failure on line 37 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, x64, windows-latest, 8.0.x)
Check failure on line 37 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)
Check failure on line 37 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)
Check failure on line 37 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Debug, x86, windows-latest, 8.0.x)
|
||
ISetupFlowStringResource setupFlowStringResource, | ||
string packageFullName) | ||
{ | ||
|
@@ -77,6 +77,21 @@ | |
} | ||
} | ||
|
||
public IQuickStartChatStyleGenerationOperation CreateChatStyleGenerationOperation(string prompt) | ||
Check failure on line 80 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, x64, windows-latest, 8.0.x)
Check failure on line 80 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)
Check failure on line 80 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)
Check failure on line 80 in tools/SetupFlow/DevHome.SetupFlow/Models/QuickStartProjectProvider.cs GitHub Actions / build-and-test (Debug, x86, windows-latest, 8.0.x)
|
||
{ | ||
try | ||
{ | ||
TelemetryFactory.Get<ITelemetry>().LogCritical("QuickstartPlaygroundCreateChatStyleGenerationOperation"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow the standard event naming convention. |
||
return _quickStartProjectProvider.CreateChatStyleGenerationOperation(prompt); | ||
} | ||
catch (Exception ex) | ||
{ | ||
TelemetryFactory.Get<ITelemetry>().LogException("QuickstartPlaygroundCreateChatStyleGenerationOperation", ex); | ||
_log.Error(ex, $"CreateProjectGenerationOperation for: {this} failed due to exception"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what will |
||
return null; | ||
} | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"QuickStartProject provider: {DisplayName}"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ public async Task<List<QuickStartProjectProvider>> GetQuickStartProjectProviders | |
{ | ||
try | ||
{ | ||
var quickStartProjectProviders = (await extension.GetListOfProvidersAsync<IQuickStartProjectProvider>()).ToList(); | ||
var quickStartProjectProviders = (await extension.GetListOfProvidersAsync<IQuickStartProjectProvider2>()).ToList(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if this releases but no extensions implement |
||
foreach (var quickStartProjectProvider in quickStartProjectProviders) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
if (quickStartProjectProvider != null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can |
||
|
@@ -44,7 +44,7 @@ public async Task<List<QuickStartProjectProvider>> GetQuickStartProjectProviders | |
} | ||
catch (Exception ex) | ||
{ | ||
_log.Error(ex, $"Failed to get {nameof(IQuickStartProjectProvider)} provider from '{extension.PackageFullName}'"); | ||
_log.Error(ex, $"Failed to get {nameof(IQuickStartProjectProvider2)} provider from '{extension.PackageFullName}'"); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1919,6 +1919,14 @@ | |
<value>Generate project</value> | ||
<comment>Tooltip for the generate button on the QuickstartPlayground page</comment> | ||
</data> | ||
<data name="QuickstartPlaygroundSubmitButton.Content" xml:space="preserve"> | ||
<value>Submit</value> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use submit Change the name to the action that will happen when the button is clicked. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for "Submit prompt" |
||
<comment>Label for the submit button on the QuickstartPlayground page</comment> | ||
</data> | ||
<data name="QuickstartPlaygroundSubmitButtonTooltip.Content" xml:space="preserve"> | ||
<value>Submit prompt</value> | ||
<comment>Tooltip for the submit button on the QuickstartPlayground page</comment> | ||
</data> | ||
<data name="QuickstartPlaygroundLaunchDropDownButton.Content" xml:space="preserve"> | ||
<value>Open in Editor</value> | ||
<comment>Drop down button to launch QuickstartPlayground project</comment> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converts a PromptStatus...
Devs know this is a converter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with the other converter.