Skip to content

Commit

Permalink
click the play button works
Browse files Browse the repository at this point in the history
  • Loading branch information
PankajBhojwani committed Nov 19, 2024
1 parent d81fd81 commit be40fb2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cascadia/QueryExtension/ExtensionPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ namespace winrt::Microsoft::Terminal::Query::Extension::implementation
std::vector<IInspectable> messageParts;

const auto chatMsg = winrt::make<ChatMessage>(winrt::to_hstring(response.Message()), false, false);
chatMsg.RunCommandClicked([this](auto&&, const auto commandlines) {
_InputSuggestionRequestedHandlers(*this, commandlines);
_close();
});
messageParts.push_back(chatMsg);

const auto brandingData = _lmProvider ? _lmProvider.BrandingData() : nullptr;
Expand Down Expand Up @@ -496,6 +500,9 @@ namespace winrt::Microsoft::Terminal::Query::Extension::implementation
{
codeBlock.Foreground(foregroundBrush);
}
codeBlock.RequestRunCommands([this, commandlines = codeBlock.Commandlines()](auto&&, auto&&) {
_RunCommandClickedHandlers(*this, commandlines);
});
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/QueryExtension/ExtensionPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ namespace winrt::Microsoft::Terminal::Query::Extension::implementation
winrt::hstring MessageContent() const { return _messageContent; };
winrt::Windows::UI::Xaml::Controls::RichTextBlock RichBlock() const { return _richBlock; };

TYPED_EVENT(RunCommandClicked, winrt::Microsoft::Terminal::Query::Extension::ChatMessage, winrt::hstring);

private:
bool _isQuery;
bool _isCode;
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/QueryExtension/ExtensionPalette.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Microsoft.Terminal.Query.Extension
Boolean IsQuery { get; };
Boolean IsCode { get; };
Windows.UI.Xaml.Controls.RichTextBlock RichBlock { get; };
event Windows.Foundation.TypedEventHandler<ChatMessage, String> RunCommandClicked;
}

runtimeclass GroupedChatMessages : Windows.Foundation.Collections.IVector<IInspectable>
Expand Down

0 comments on commit be40fb2

Please sign in to comment.