Skip to content

Commit

Permalink
[Backport jb-v7.6.x] [Backport vscode-v1.52.x] Fix manual intent sele…
Browse files Browse the repository at this point in the history
…ction for onebox (#6339)

Ship blocking bug - A bug was introduced as part of
#6294 which causes manual
selection of the intent to be ignored.
This PR fixes the bug.

## Test plan

https://www.loom.com/share/dfcfcc6decca4ca19cfb3220d8026a07?sid=99e6d5f1-84d5-4838-8ed8-200126c17305
## Changelog


<br> Backport 893922e from #6324
<br> Backport 104931c from #6325
  • Loading branch information
sourcegraph-release-bot authored Dec 12, 2024
1 parent 610ccf9 commit c002ddf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
14 changes: 11 additions & 3 deletions vscode/webviews/chat/Transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,16 @@ const TranscriptInteraction: FC<TranscriptInteractionProps> = memo(props => {
?.getSerializedValue()
.contextItems.some(item => item.type === 'repository')

const onHumanMessageSubmit = useCallback(
(intent?: ChatMessage['intent']) => {
if (humanMessage.isUnsentFollowup) {
onFollowupSubmit(intent)
}
onEditSubmit(intent)
},
[humanMessage.isUnsentFollowup, onFollowupSubmit, onEditSubmit]
)

return (
<>
<HumanMessageCell
Expand All @@ -570,9 +580,7 @@ const TranscriptInteraction: FC<TranscriptInteractionProps> = memo(props => {
isSent={!humanMessage.isUnsentFollowup}
isPendingPriorResponse={priorAssistantMessageIsLoading}
onChange={onChange}
onSubmit={
humanMessage.isUnsentFollowup ? () => onFollowupSubmit() : () => onEditSubmit()
}
onSubmit={onHumanMessageSubmit}
onStop={onStop}
isFirstInteraction={isFirstInteraction}
isLastInteraction={isLastInteraction}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface HumanMessageCellProps {

onEditorFocusChange?: (focused: boolean) => void
onChange?: (editorState: SerializedPromptEditorValue) => void
onSubmit: (editorState: SerializedPromptEditorValue, intent?: ChatMessage['intent']) => void
onSubmit: (intent?: ChatMessage['intent']) => void
onStop: () => void

isFirstInteraction?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const HumanMessageEditor: FunctionComponent<{

onEditorFocusChange?: (focused: boolean) => void
onChange?: (editorState: SerializedPromptEditorValue) => void
onSubmit: (editorState: SerializedPromptEditorValue, intent?: ChatMessage['intent']) => void
onSubmit: (intent?: ChatMessage['intent']) => void
onStop: () => void

isFirstInteraction?: boolean
Expand Down Expand Up @@ -151,7 +151,7 @@ export const HumanMessageEditor: FunctionComponent<{
}

const value = editorRef.current.getSerializedValue()
parentOnSubmit(value, intent)
parentOnSubmit(intent)

telemetryRecorder.recordEvent('cody.humanMessageEditor', 'submit', {
metadata: {
Expand Down

0 comments on commit c002ddf

Please sign in to comment.