mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
fix: do not print [object Object] when enhancing prompt
This commit is contained in:
parent
6a9cb78fd6
commit
bfe7e12783
@ -34,15 +34,15 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
|
||||
|
||||
const transformStream = new TransformStream({
|
||||
transform(chunk, controller) {
|
||||
const processedChunk = decoder
|
||||
.decode(chunk)
|
||||
.split('\n')
|
||||
.filter((line) => line !== '')
|
||||
.map(parseStreamPart)
|
||||
.map((part) => part.value)
|
||||
.join('');
|
||||
|
||||
controller.enqueue(encoder.encode(processedChunk));
|
||||
const decodedChunk = decoder.decode(chunk);
|
||||
const parts = decodedChunk.split('\n').filter((line) => line !== '');
|
||||
for (const part of parts) {
|
||||
const parsed = parseStreamPart(part);
|
||||
if (parsed.type === 'text') {
|
||||
controller.enqueue(encoder.encode(parsed.value));
|
||||
}
|
||||
// Non-text chunks are ignored
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user