From 7b9287316d36ce5d94ff445fb6279dbc01c62851 Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Wed, 17 Jan 2024 15:39:24 -0800 Subject: [PATCH] touchups to UI for AI chat feature (#237) --- src/app/common/common.less | 4 +--- src/app/workspace/cmdinput/aichat.tsx | 16 ++++++++-------- src/app/workspace/cmdinput/cmdinput.less | 12 ++++++++---- src/app/workspace/cmdinput/cmdinput.tsx | 20 +++++++++++++++++--- src/model/model.ts | 3 +-- waveshell/pkg/packet/packet.go | 2 +- 6 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/app/common/common.less b/src/app/common/common.less index 3a9f65dc..3ca716ae 100644 --- a/src/app/common/common.less +++ b/src/app/common/common.less @@ -407,9 +407,7 @@ } pre.selected { - border-style: solid; - outline-width: 2px; - border-color: @term-green; + outline: 2px solid @term-green; } .title.is-1 { diff --git a/src/app/workspace/cmdinput/aichat.tsx b/src/app/workspace/cmdinput/aichat.tsx index 008fe8eb..debba909 100644 --- a/src/app/workspace/cmdinput/aichat.tsx +++ b/src/app/workspace/cmdinput/aichat.tsx @@ -139,10 +139,10 @@ class AIChat extends React.Component<{}, {}> { let msgClassName = "chat-msg " + senderClassName; let innerHTML: React.JSX.Element = ( - - -

You

-
+
+ +
You
+

{chatItem.userquery}

); @@ -152,13 +152,13 @@ class AIChat extends React.Component<{}, {}> { } else { innerHTML = ( - +
-

ChatGPT

- +
ChatGPT
+
); diff --git a/src/app/workspace/cmdinput/cmdinput.less b/src/app/workspace/cmdinput/cmdinput.less index 07134cb6..4d02cd17 100644 --- a/src/app/workspace/cmdinput/cmdinput.less +++ b/src/app/workspace/cmdinput/cmdinput.less @@ -190,12 +190,16 @@ display: inline-block; margin-right: 0; padding: 0.2em 0.7rem; - opacity: 0.5; - cursor: pointer; border-radius: 4px; vertical-align: super; - &:hover { - opacity: 1; + + .hint-elem { + cursor: pointer; + opacity: 0.5; + + &:hover { + opacity: 1.0; + } } } } diff --git a/src/app/workspace/cmdinput/cmdinput.tsx b/src/app/workspace/cmdinput/cmdinput.tsx index f6b0693b..6625b9df 100644 --- a/src/app/workspace/cmdinput/cmdinput.tsx +++ b/src/app/workspace/cmdinput/cmdinput.tsx @@ -74,6 +74,14 @@ class CmdInput extends React.Component<{}, {}> { GlobalModel.inputModel.giveFocus(); } + @boundMethod + clickAIHint(e: any): void { + e.preventDefault(); + e.stopPropagation(); + let inputModel = GlobalModel.inputModel; + inputModel.openAIAssistantChat(); + } + @boundMethod clickHistoryHint(e: any): void { e.preventDefault(); @@ -218,12 +226,18 @@ class CmdInput extends React.Component<{}, {}> { **/} {!focusVal && (
- focus input ({renderCmdText("I")}) +
focus input ({renderCmdText("I")})
)} {focusVal && ( -
- {historyShow ? "close (esc)" : "history (ctrl-r)"} +
+ +
close (esc)
+
+ +
history (ctrl-r)
+
AI (ctrl-space)
+
)}