mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 20:31:48 +00:00
client/cody: fix usages of addErrorAsAssistantResponse (#53185)
Some callsites were incorrectly wrapping the error in HTML before calling `addErrorAsAssistantResponse`, which then wraps it in another error div. ## Test plan n/a
This commit is contained in:
parent
7a7ed5d470
commit
2a63d0dc6f
@ -138,9 +138,7 @@ export async function createClient({
|
||||
},
|
||||
onError(error) {
|
||||
// Display error message as assistant response
|
||||
transcript.addErrorAsAssistantResponse(
|
||||
`<div class="cody-chat-error"><span>Request failed: </span>${error}</div>`
|
||||
)
|
||||
transcript.addErrorAsAssistantResponse(error)
|
||||
isMessageInProgress = false
|
||||
sendTranscript()
|
||||
console.error(`Completion request failed: ${error}`)
|
||||
|
||||
@ -113,6 +113,12 @@ export class Transcript {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a error div to the assistant response. If the assistant has collected
|
||||
* some response before, we will add the error message after it.
|
||||
*
|
||||
* @param errorText The error TEXT to be displayed. Do not wrap it in HTML tags.
|
||||
*/
|
||||
public addErrorAsAssistantResponse(errorText: string): void {
|
||||
const lastInteraction = this.getLastInteraction()
|
||||
if (!lastInteraction) {
|
||||
|
||||
@ -266,9 +266,7 @@ export const useClient = ({
|
||||
},
|
||||
onError(error) {
|
||||
// Display error message as assistant response
|
||||
transcript.addErrorAsAssistantResponse(
|
||||
`<div class="cody-chat-error"><span>Request failed: </span>${error}</div>`
|
||||
)
|
||||
transcript.addErrorAsAssistantResponse(error)
|
||||
|
||||
console.error(`Completion request failed: ${error}`)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user