Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotdauber committed Jan 7, 2025
1 parent 5e20f32 commit 407b385
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/core/src/chat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,7 @@ export async function* submitChat(
...(eventsPromise ? [eventsPromise] : []),
]);

const isEventObject = result.type === 'events';

if (isEventObject && result.value) {
events.push(result.value.event);
yield structuredClone({ events });
}

if (isEventObject) {
if (result.type === 'events') {
eventsPromise = undefined;

if (result.value) {
Expand All @@ -332,8 +325,8 @@ export async function* submitChat(
continue;
}

// if its not an event object, it's a chat object

// if it's not an event object, it's a chat object
chatPromise = undefined;
const chatValue = result.value;
if (chatValue) {
// if it's metadata, yield it and also save it
Expand All @@ -347,8 +340,11 @@ export async function* submitChat(
return { ...chatValue, ...metadata };
}

console.log('yield chatValue');
// its not metadata and not a full message, so just yield it
yield chatValue;
} else if (result.done) {
return;
}
}
}
Expand Down

0 comments on commit 407b385

Please sign in to comment.