Skip to content

Commit

Permalink
remove unused, needless transcript-errors/isTranscriptError (#5742)
Browse files Browse the repository at this point in the history
This was only used to control whether to show feedback buttons after a
message, and any message with isTranscriptError would also have an
assistant reply with an error as well, so this did not do anything.

## Test plan

CI
  • Loading branch information
sqs committed Sep 28, 2024
1 parent b38e74e commit a69ae86
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 35 deletions.
4 changes: 0 additions & 4 deletions vscode/src/chat/chat-view/ChatController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,6 @@ export class ChatController implements vscode.Disposable, vscode.WebviewViewProv
if (type === 'transcript') {
this.chatBuilder.addErrorAsBotMessage(error, ChatBuilder.NO_MODEL)
this.postViewTranscript()
void this.postMessage({
type: 'transcript-errors',
isTranscriptError: true,
})
return
}

Expand Down
1 change: 0 additions & 1 deletion vscode/src/chat/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export type ExtensionMessage =
| ({ type: 'transcript' } & ExtensionTranscriptMessage)
| { type: 'view'; view: View }
| { type: 'errors'; errors: string }
| { type: 'transcript-errors'; isTranscriptError: boolean }
| {
type: 'clientAction'
addContextItemsToLastHumanInput?: ContextItem[] | null | undefined
Expand Down
6 changes: 0 additions & 6 deletions vscode/webviews/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
const [userHistory, setUserHistory] = useState<SerializedChatTranscript[]>()

const [errorMessages, setErrorMessages] = useState<string[]>([])
const [isTranscriptError, setIsTranscriptError] = useState<boolean>(false)

const dispatchClientAction = useClientActionDispatcher()

Expand Down Expand Up @@ -70,7 +69,6 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
const msgLength = deserializedMessages.length - 1
setTranscript(deserializedMessages.slice(0, msgLength))
setMessageInProgress(deserializedMessages[msgLength])
setIsTranscriptError(false)
} else {
setTranscript(deserializedMessages)
setMessageInProgress(null)
Expand Down Expand Up @@ -98,9 +96,6 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
case 'view':
setView(message.view)
break
case 'transcript-errors':
setIsTranscriptError(message.isTranscriptError)
break
case 'attribution':
if (message.attribution) {
guardrails.notifyAttributionSuccess(message.snippet, {
Expand Down Expand Up @@ -202,7 +197,6 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc
messageInProgress={messageInProgress}
transcript={transcript}
vscodeAPI={vscodeAPI}
isTranscriptError={isTranscriptError}
guardrails={guardrails}
userHistory={userHistory ?? []}
smartApplyEnabled={config.config.smartApply}
Expand Down
1 change: 0 additions & 1 deletion vscode/webviews/Chat.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const meta: Meta<typeof Chat> = {
postMessage: () => {},
onMessage: () => () => {},
},
isTranscriptError: false,
setView: () => {},
} satisfies React.ComponentProps<typeof Chat>,

Expand Down
3 changes: 0 additions & 3 deletions vscode/webviews/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ interface ChatboxProps {
messageInProgress: ChatMessage | null
transcript: ChatMessage[]
vscodeAPI: Pick<VSCodeWrapper, 'postMessage' | 'onMessage'>
isTranscriptError: boolean
guardrails?: Guardrails
scrollableParent?: HTMLElement | null
showWelcomeMessage?: boolean
Expand All @@ -38,7 +37,6 @@ export const Chat: React.FunctionComponent<React.PropsWithChildren<ChatboxProps>
messageInProgress,
transcript,
vscodeAPI,
isTranscriptError,
chatEnabled = true,
guardrails,
scrollableParent,
Expand Down Expand Up @@ -220,7 +218,6 @@ export const Chat: React.FunctionComponent<React.PropsWithChildren<ChatboxProps>
copyButtonOnSubmit={copyButtonOnSubmit}
insertButtonOnSubmit={insertButtonOnSubmit}
smartApply={smartApply}
isTranscriptError={isTranscriptError}
userInfo={userInfo}
chatEnabled={chatEnabled}
postMessage={postMessage}
Expand Down
1 change: 0 additions & 1 deletion vscode/webviews/CodyPanel.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const meta: Meta<typeof CodyPanel> = {
postMessage: () => {},
onMessage: () => () => {},
},
isTranscriptError: false,
view: View.Chat,
setView: () => {},
configuration: {
Expand Down
3 changes: 0 additions & 3 deletions vscode/webviews/CodyPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const CodyPanel: FunctionComponent<
| 'messageInProgress'
| 'transcript'
| 'vscodeAPI'
| 'isTranscriptError'
| 'guardrails'
| 'showWelcomeMessage'
| 'showIDESnippetActions'
Expand All @@ -44,7 +43,6 @@ export const CodyPanel: FunctionComponent<
messageInProgress,
transcript,
vscodeAPI,
isTranscriptError,
guardrails,
showIDESnippetActions,
showWelcomeMessage,
Expand Down Expand Up @@ -93,7 +91,6 @@ export const CodyPanel: FunctionComponent<
messageInProgress={messageInProgress}
transcript={transcript}
vscodeAPI={vscodeAPI}
isTranscriptError={isTranscriptError}
guardrails={attributionEnabled ? guardrails : undefined}
showIDESnippetActions={showIDESnippetActions}
showWelcomeMessage={showWelcomeMessage}
Expand Down
5 changes: 0 additions & 5 deletions vscode/webviews/chat/Transcript.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export const WithError: StoryObj<typeof meta> = {
{ speaker: 'human', text: ps`What color is the sky?'`, contextFiles: [] },
{ speaker: 'assistant', error: errorToChatError(new Error('some error')) },
]),
isTranscriptError: true,
},
}

Expand All @@ -141,7 +140,6 @@ export const WithRateLimitError: StoryObj<typeof meta> = {
),
},
]),
isTranscriptError: true,
},
}

Expand All @@ -152,7 +150,6 @@ export const abortedBeforeResponse: StoryObj<typeof meta> = {
{ speaker: 'human', text: ps`What color is the sky?'`, contextFiles: [] },
{ speaker: 'assistant', error: errorToChatError(new Error('aborted')) },
]),
isTranscriptError: true,
},
}

Expand All @@ -167,7 +164,6 @@ export const abortedWithPartialResponse: StoryObj<typeof meta> = {
},
{ speaker: 'assistant', text: ps`Bl`, error: errorToChatError(new Error('aborted')) },
]),
isTranscriptError: true,
},
}

Expand All @@ -185,7 +181,6 @@ export const TextWrapping: StoryObj<typeof meta> = {
text: ps`The sky is blueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblue.\n\n\`\`\`\nconst color = 'blueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblue'\n\`\`\`\n\nMore info:\n\n- Color of sky: blueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblueblue`,
},
]),
isTranscriptError: true,
},
}

Expand Down
5 changes: 0 additions & 5 deletions vscode/webviews/chat/Transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ interface TranscriptProps {

guardrails?: Guardrails
postMessage?: ApiPostMessage
isTranscriptError?: boolean

feedbackButtonsOnSubmit: (text: string) => void
copyButtonOnSubmit: CodeBlockActionsProps['copyButtonOnSubmit']
Expand All @@ -53,7 +52,6 @@ export const Transcript: FC<TranscriptProps> = props => {
messageInProgress,
guardrails,
postMessage,
isTranscriptError,
feedbackButtonsOnSubmit,
copyButtonOnSubmit,
insertButtonOnSubmit,
Expand Down Expand Up @@ -81,7 +79,6 @@ export const Transcript: FC<TranscriptProps> = props => {
interaction={interaction}
guardrails={guardrails}
postMessage={postMessage}
isTranscriptError={isTranscriptError}
feedbackButtonsOnSubmit={feedbackButtonsOnSubmit}
copyButtonOnSubmit={copyButtonOnSubmit}
insertButtonOnSubmit={insertButtonOnSubmit}
Expand Down Expand Up @@ -172,7 +169,6 @@ const TranscriptInteraction: FC<TranscriptInteractionProps> = memo(props => {
isLastInteraction,
isLastSentInteraction,
priorAssistantMessageIsLoading,
isTranscriptError,
userInfo,
chatEnabled,
feedbackButtonsOnSubmit,
Expand Down Expand Up @@ -374,7 +370,6 @@ const TranscriptInteraction: FC<TranscriptInteractionProps> = memo(props => {
isLoading={assistantMessage.isLoading}
showFeedbackButtons={
!assistantMessage.isLoading &&
!isTranscriptError &&
!assistantMessage.error &&
isLastSentInteraction
}
Expand Down
6 changes: 0 additions & 6 deletions web/lib/components/CodyWebChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ const CodyWebPanel: FC<CodyWebPanelProps> = props => {

const dispatchClientAction = useClientActionDispatcher()
const [errorMessages, setErrorMessages] = useState<string[]>([])
const [isTranscriptError, setIsTranscriptError] = useState<boolean>(false)
const [messageInProgress, setMessageInProgress] = useState<ChatMessage | null>(null)
const [transcript, setTranscript] = useState<ChatMessage[]>([])
const [config, setConfig] = useState<Config | null>(null)
Expand All @@ -128,7 +127,6 @@ const CodyWebPanel: FC<CodyWebPanelProps> = props => {
const msgLength = deserializedMessages.length - 1
setTranscript(deserializedMessages.slice(0, msgLength))
setMessageInProgress(deserializedMessages[msgLength])
setIsTranscriptError(false)
} else {
setTranscript(deserializedMessages)
setMessageInProgress(null)
Expand All @@ -141,9 +139,6 @@ const CodyWebPanel: FC<CodyWebPanelProps> = props => {
case 'view':
setView(message.view)
break
case 'transcript-errors':
setIsTranscriptError(message.isTranscriptError)
break
case 'config':
message.config.webviewType = 'sidebar'
message.config.multipleWebviewsEnabled = false
Expand Down Expand Up @@ -265,7 +260,6 @@ const CodyWebPanel: FC<CodyWebPanelProps> = props => {
messageInProgress={messageInProgress}
transcript={transcript}
vscodeAPI={vscodeAPI}
isTranscriptError={isTranscriptError}
/>
</ComposedWrappers>
</ChatMentionContext.Provider>
Expand Down

0 comments on commit a69ae86

Please sign in to comment.