mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
Merge pull request #1355 from Srayash/Srayash/issue#1283
Bug Fix: react web widget prints undefined before printing an answer.
This commit is contained in:
@@ -453,8 +453,11 @@ export const DocsGPTWidget = ({
|
||||
setQueries(updatedQueries);
|
||||
setStatus('idle')
|
||||
}
|
||||
else if (data.type === 'source') {
|
||||
// handle the case where data type === 'source'
|
||||
}
|
||||
else {
|
||||
const result = data.answer;
|
||||
const result = data.answer ? data.answer : ''; //Fallback to an empty string if data.answer is undefined
|
||||
const streamingResponse = queries[queries.length - 1].response ? queries[queries.length - 1].response : '';
|
||||
const updatedQueries = [...queries];
|
||||
updatedQueries[updatedQueries.length - 1].response = streamingResponse + result;
|
||||
|
||||
Reference in New Issue
Block a user