Skip to content

Commit

Permalink
fix: writer is just streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser committed Sep 26, 2024
1 parent 6ecd5f8 commit 0679c37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions templates/components/multiagent/typescript/workflow/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ export const createWorkflow = (chatHistory: ChatMessage[]) => {
}

if (ev.data.isGood || tooManyAttempts) {
// TODO: the text is already written, so we don't need to run the writer again
// The text is ready for publication, we just use the writer to stream the output
const writer = createWriter(chatHistory);
const writeRes = (await runAgent(context, writer, {
message: ev.data.input,
const content = context.get("result");

return (await runAgent(context, writer, {
message: `You're blog post is ready for publication. Please respond with just the blog post. Blog post: \`\`\`${content}\`\`\``,
streaming: true,
})) as unknown as StopEvent<AsyncGenerator<ChatResponseChunk>>;

return writeRes; // stop the workflow
}

const writer = createWriter(chatHistory);
Expand Down Expand Up @@ -103,7 +103,7 @@ export const createWorkflow = (chatHistory: ChatMessage[]) => {
);
if (postIsGood) {
return new WriteEvent({
input: `You're blog post is ready for publication. Please respond with just the blog post. Blog post: \`\`\`${oldContent}\`\`\``,
input: "",
isGood: true,
});
}
Expand Down

0 comments on commit 0679c37

Please sign in to comment.