Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Oct 18, 2024
1 parent 3fa0100 commit f875e09
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
8 changes: 7 additions & 1 deletion ee/tabby-ui/components/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ function ChatRenderer(
const nextQaPairs = qaPairs.filter(o => o.user.id !== userMessageId)
setQaPairs(nextQaPairs)
setInput(userMessage.message)
if (userMessage.activeContext) {
onNavigateToContext(userMessage.activeContext, {
openInEditor: true
})
}

deleteThreadMessagePair(threadId, qaPair?.user.id, qaPair?.assistant?.id)
}
Expand Down Expand Up @@ -385,10 +390,11 @@ function ChatRenderer(
message: userMessage.message + selectCodeSnippet,
// If no id is provided, set a fallback id.
id: userMessage.id ?? nanoid(),
// If a temporary user message draft exists, use its selectContext and activeContext
// FIXME: perhaps should use the current active selection
selectContext: userMessageForEditTemp.current
? userMessageForEditTemp.current.selectContext
: userMessage.selectContext,
// todo: use current active selection
activeContext: userMessageForEditTemp.current
? userMessageForEditTemp.current.activeContext
: userMessage.activeContext
Expand Down
22 changes: 11 additions & 11 deletions ee/tabby-ui/components/chat/question-answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,17 @@ function UserMessageCardActions(props: { message: UserMessage }) {
<Button
variant="ghost"
size="icon"
onClick={e => handleMessageAction?.(message.id, 'delete')}
onClick={e => handleMessageAction(message.id, 'edit')}
>
<IconEdit />
<span className="sr-only">Edit message</span>
</Button>
)}
{!isLoading && (
<Button
variant="ghost"
size="icon"
onClick={e => handleMessageAction(message.id, 'delete')}
>
<IconTrash />
<span className="sr-only">Delete message</span>
Expand Down Expand Up @@ -444,16 +454,6 @@ function AssistantMessageCardActions(props: AssistantMessageActionProps) {
<span className="sr-only">Regenerate message</span>
</Button>
)}
{!isGenerating && (
<Button
variant="ghost"
size="icon"
onClick={e => handleMessageAction(userMessageId, 'edit')}
>
<IconEdit />
<span className="sr-only">Edit message</span>
</Button>
)}
<CopyButton value={copyContent} onCopyContent={onCopyContent} />
</ChatMessageActionsWrapper>
)
Expand Down

0 comments on commit f875e09

Please sign in to comment.