Spaces:
Sleeping
Sleeping
wuyiqunLu commited on
fix: timeout error not show in progress (#96)
Browse filesbecause previously was not properly encoded but this enqueue can be
removed since the chat will be refreshed with db data
<img width="982" alt="image"
src="https://github.com/landing-ai/vision-agent-ui/assets/132986242/cfd0bbd5-e1e7-4159-8a4f-14c0225a55fa">
213 unmodified lines21421521621721821922022122222322415 unmodified lines240241242243244245213 unmodified linesif (lines.length === 0) {if (Date.now() - time > TIMEOUT_MILI_SECONDS) {results.push(FINAL_TIMEOUT_ERROR);// https://github.com/vercel/ai/blob/f7002ad2c5aa58ce6ed83e8d31fe22f71ebdb7d7/packages/ui-utils/src/stream-parts.ts#L62controller.enqueue('2:' +encoder.encode(JSON.stringify(FINAL_TIMEOUT_ERROR) + '\n'),);return { done: true, reason: 'timeout' };}} else {15 unmodified linesreturn { done: true, reason: 'api_error', error };} else if (parsedMsg) {results.push(parsedMsg);controller.enqueue(encoder.encode('2:' + JSON.stringify([parsedMsg]) + '\n'),);213 unmodified lines21421521621721821915 unmodified lines235236237238239240241213 unmodified linesif (lines.length === 0) {if (Date.now() - time > TIMEOUT_MILI_SECONDS) {results.push(FINAL_TIMEOUT_ERROR);return { done: true, reason: 'timeout' };}} else {15 unmodified linesreturn { done: true, reason: 'api_error', error };} else if (parsedMsg) {results.push(parsedMsg);// https://github.com/vercel/ai/blob/f7002ad2c5aa58ce6ed83e8d31fe22f71ebdb7d7/packages/ui-utils/src/stream-parts.ts#L62controller.enqueue(encoder.encode('2:' + JSON.stringify([parsedMsg]) + '\n'),);
app/api/vision-agent/route.ts+1-5