-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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 an AI chat experience to Windows Terminal, powered by the user's Azure OpenAI resource #16285
Conversation
This comment has been minimized.
This comment has been minimized.
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.
31/56 and I've obviously only done the easy ones
This comment has been minimized.
This comment has been minimized.
We definitely got to fix that "desploy", I think everything else that the spell-bot detected is fine though. |
doc/cascadia/profiles.schema.json
Outdated
@@ -393,6 +393,7 @@ | |||
"addMark", | |||
"adjustFontSize", | |||
"adjustOpacity", | |||
"AIChat", |
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.
nts: make this openTerminalChat
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Notes:
I forced us into dark mode to fix 1. |
Padding="16,8,16,8" | ||
CornerRadius="8"> | ||
<StackPanel.Background> | ||
<SolidColorBrush Color="#005EB7" /> |
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.
In the future, we need to use existing xaml color ramp items. Otherwise, we lose theme support.
{ | ||
_AIEndpoint = endpoint; | ||
_AIKey = key; | ||
_httpClient = winrt::Windows::Web::Http::HttpClient{}; |
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.
probably don't need to recreate this every time these change, but I'm OK with it for now
{ | ||
result = RS_(L"UnknownErrorMessage"); | ||
|
||
TraceLoggingWrite( |
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.
too many copies of error handling code. streamline.
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.
fixed stuff
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.
🤏👃,
Let's get these tracked somewhere. There's lots
<SubSystem>Console</SubSystem> | ||
<!-- sets a bunch of Windows Universal properties --> | ||
<OpenConsoleUniversalApp>true</OpenConsoleUniversalApp> | ||
<PgoTarget>false</PgoTarget> |
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.
👀
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.
Eh, it's mostly web request bound.
<data name="AIContentDisclaimerPartOne.Text" xml:space="preserve"> | ||
<value>AI can make mistakes —</value> | ||
<comment>Part one of the disclaimer presented to the user within the chat UI element.</comment> | ||
</data> | ||
<data name="AIContentDisclaimerHyperlink" xml:space="preserve"> | ||
<value>send feedback</value> | ||
<comment>The portion of the disclaimer presented to the user as a hyperlink within the chat UI element.</comment> | ||
</data> | ||
<data name="AIContentDisclaimerPartTwo.Text" xml:space="preserve"> | ||
<value>to help us improve.</value> | ||
<comment>Part two of the disclaimer presented to the user within the chat UI element.</comment> | ||
</data> |
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'd bet that localization eats it on this - breaking the sentence across resources is surely gonna 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.
Given that we only want the relevant parts of the sentence to be hyperlinked, I'm not entirely sure how we can solve this without breaking it up in the resource file... will file a work item to investigate if/how this messes with localization
"0.4001 0 0.2209 0.17909 0.4 0.40003 0.4h3.2003zm-3.2003 1.6001h1.6001c0.221 " | ||
"0 0.4001-0.1791 0.4001-0.4s-0.1791-0.4-0.4001-0.4h-1.6001c-0.22094 0-0.40003 " | ||
"0.1791-0.40003 0.4s0.17909 0.4 0.40003 0.4z" | ||
}; |
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.
horrifying
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.
that's on me, sorry XD
} | ||
|
||
AIChatFlyout.Click({ this, &TerminalPage::_AIChatButtonOnClick }); | ||
newTabFlyout.Items().Append(AIChatFlyout); |
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 append this item always?
I suppose the feature isn't behind velocity, it's in a separate branch. So this will always be in the menu for branches where it's checked in.
Honestly, don't love that, but 🤷
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.
We can make Velocitizing it one of the go live requirements
@@ -880,7 +949,7 @@ namespace winrt::TerminalApp::implementation | |||
}); | |||
// Necessary for fly-out sub items to get focus on a tab before collapsing. Related to #15049 | |||
newTabFlyout.Closing([this](auto&&, auto&&) { | |||
if (!_commandPaletteIs(Visibility::Visible)) | |||
if (!_commandPaletteIs(Visibility::Visible) && (ExtensionPresenter().Visibility() != Visibility::Visible)) |
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.
added the extension presenter here, but we totally still forgot the sxnui
void ExtensionPalette::_backdropPointerPressed(const Windows::Foundation::IInspectable& /*sender*/, | ||
const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e) | ||
{ | ||
e.Handled(true); |
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 was for light-dismiss yea? can we just toss it entirely now?
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 to prevent the palette from dismissing when the user clicks within it, we only want light dismiss if they click out of it. So we still need this here
else if (key == VirtualKey::C && ctrlDown) | ||
{ | ||
_queryBox().CopySelectionToClipboard(); | ||
e.Handled(true); | ||
} | ||
else if (key == VirtualKey::V && ctrlDown) | ||
{ | ||
_queryBox().PasteFromClipboard(); | ||
e.Handled(true); | ||
} |
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.
shouldn't this... just work?
or is this for when the focus isn't in the text box and you want to copy/paste into the text box. okay I think I get it
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.
Nope, NOPE. NOPE. TermControl's Preview Key Handler gets ^V before anyone else. Remember, it is awful.
Width="64" | ||
Height="64" | ||
Margin="0,0,0,20" | ||
Source="ms-appx:///ProfileIcons/terminalChatLogo.png" /> |
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.
does this one work with light & dark theme?
oh wait no this is the thing that has to be in dark mode isn't it
</TextBlock> | ||
</Grid> | ||
</Grid> | ||
</UserControl> |
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.
yep this is XAML
Kept the branch so Pankaj can see my changes |
- [x] Remove the ESC handler that clears the query message - [x] Streamline error handling code - [x] Fix `this` and `&` in several lambdas - [x] Fix getting the [active commandline properly](#16285 (comment)) - [x] Use XAML color ramp resource names instead of hardcoded colors
Summary of the Pull Request
Adds an AI chatbot to Windows Terminal. Currently we do not ship with our own LLM, the user needs to provide their own Azure OpenAI subscription to be able to use this feature.
Validation Steps Performed
References and Relevant Issues
#15000
PR Checklist