Skip to content

Commit

Permalink
fix chat mode streaming with non-multiturn columns
Browse files Browse the repository at this point in the history
  • Loading branch information
deafnv committed Nov 28, 2024
1 parent 1d5a570 commit 28a254f
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
]
];
// generationStatus = true;
generationStatus = true;
loadedStreams = Object.fromEntries(
tableData.cols
.map((col) =>
Expand Down Expand Up @@ -194,16 +194,18 @@
}
}
} else {
if ((parsedValue.choices[0].message.content ?? '').includes('\n')) {
loadedStreams[parsedValue.output_column_name] = [
...loadedStreams[parsedValue.output_column_name],
latestStreams[parsedValue.output_column_name] +
(parsedValue.choices[0]?.message?.content ?? '')
];
latestStreams[parsedValue.output_column_name] = '';
} else {
latestStreams[parsedValue.output_column_name] +=
parsedValue.choices[0]?.message?.content ?? '';
if (loadedStreams[parsedValue.output_column_name]) {
if ((parsedValue.choices[0].message.content ?? '').includes('\n')) {
loadedStreams[parsedValue.output_column_name] = [
...loadedStreams[parsedValue.output_column_name],
latestStreams[parsedValue.output_column_name] +
(parsedValue.choices[0]?.message?.content ?? '')
];
latestStreams[parsedValue.output_column_name] = '';
} else {
latestStreams[parsedValue.output_column_name] +=
parsedValue.choices[0]?.message?.content ?? '';
}
}
}
} else {
Expand Down

0 comments on commit 28a254f

Please sign in to comment.