-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Allow Github Copilot to be used with Terminal Chat #18014
Conversation
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.
i'm at 43/48 files (sorry for the delay!)
HorizontalAlignment="Left" | ||
VerticalAlignment="Bottom" | ||
Spacing="4"> | ||
<mux:ImageIcon Source="{x:Bind BadgeBitmapImage}"/> |
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.
Highly amazed this worked. It should have failed because WUX and MUX image sources are different (????)
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.
I wish I had an answer for this haha
const auto randomStateString = unbox_value_or<hstring>(authValues.TryLookup(stateKey).try_as<IPropertyValue>(), L""); | ||
// only handle this if the state strings match | ||
if (randomStateString == parsedUrl.QueryParsed().GetFirstValueByName(stateKey)) |
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.
do we also confirm that the random state string matches the one stored on the app?
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.
Not sure I understand the question - randomStateString
here is the one stored on the app
…nto dev/pabhoj/featurellm_openai
df03bf9
to
0564bc5
Compare
authValuesJson.SetNamedValue(L"url", WDJ::JsonValue::CreateStringValue(uriString)); | ||
authValuesJson.SetNamedValue(L"state", WDJ::JsonValue::CreateStringValue(randomStateString)); | ||
|
||
_createAndSetAuthenticationForLMProvider(LLMProvider::GithubCopilot, authValuesJson.ToString()); |
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.
this is a JSON key contract between App and Provider that we should have been avoiding - what does it communicate, and why does it need to know the internal format of the auth blob?
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.
This is not the blob that ends up getting stored, this is the one to complete the auth flow, i.e. to hand the correct uri (which contains the necessary code
to complete the authentication) and the random state string to the provider. The one that eventually gets stored has a format unknown to the App
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.
Eventually, this should be promoted to being a real function on an interface like IOAuthAuthenticatedProvider
or similar. We don't need to do that now, but it IS still currently effectively a secret and undocumented contract (and the kind of thing I hate: using JSON to pass data from one part of the app to another (which is different from the 'opaque blob' thing, which uses JSON as an implementation detail for one component to save data about ITSELF))
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.
FWIW, you don't have to change the Azure and OAI ones to use the opaque blob thing. It's fine - the app already HAS to peek inside it.
const auto uriString{ uriArgs.Uri() }; | ||
if (!uriString.empty()) | ||
{ | ||
Windows::Foundation::Uri uri{ uriString }; |
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.
technically this will throw if the URI string is wrong. wt handle-uri foobarbaz
will maybe make terminal blow up
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.
You may want to fix this in a followup!
authValuesJson.SetNamedValue(L"url", WDJ::JsonValue::CreateStringValue(uriString)); | ||
authValuesJson.SetNamedValue(L"state", WDJ::JsonValue::CreateStringValue(randomStateString)); | ||
|
||
_createAndSetAuthenticationForLMProvider(LLMProvider::GithubCopilot, authValuesJson.ToString()); |
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.
Eventually, this should be promoted to being a real function on an interface like IOAuthAuthenticatedProvider
or similar. We don't need to do that now, but it IS still currently effectively a secret and undocumented contract (and the kind of thing I hate: using JSON to pass data from one part of the app to another (which is different from the 'opaque blob' thing, which uses JSON as an implementation detail for one component to save data about ITSELF))
Summary of the Pull Request
GithubCopilotLLMProvider
, which is an implementation ofILMProvider
that leverages Github CopilotILMProvider
interface to include anIBrandingData
interface, that allows a provider to specify how it wants certain elements of the TerminalChat UI to lookValidation Steps Performed
PR Checklist