Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98b3701

Browse files
committed
cleanup comments
Former-commit-id: 51d33d3 Former-commit-id: 521302095795a2a7533681782d3fa4bf85048f64
1 parent 24256d9 commit 98b3701

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

examples/voice/src/workflows/agent/agent.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function agentWorkflow({
2121

2222
let openaiChatMessages: any[] = [];
2323

24-
// Get tools definition and start conversation
24+
// Get tools definition and start conversation.
2525

2626
const tools = await step<typeof functions>({
2727
taskQueue: "erp",
@@ -40,7 +40,7 @@ export async function agentWorkflow({
4040
openaiChatMessages = initialMessages.messages;
4141
}
4242

43-
// Send reply to AI chat with previous messages to continue conversation
43+
// On user reply, send it to AI chat with previous messages to continue conversation.
4444

4545
onEvent(replyEvent, async ({ streamSid, text }: Reply) => {
4646
const replyMessage = await step<typeof functions>({
@@ -60,7 +60,7 @@ export async function agentWorkflow({
6060
return { text };
6161
});
6262

63-
// When AI answer is a tool call, execute function and push results to conversation
63+
// When AI answer is a tool call, execute function and push results to conversation.
6464

6565
onEvent(toolCallEvent, async ({ function: toolFunction }: ToolCall) => {
6666
log.info("toolCallEvent", { toolFunction });
@@ -107,9 +107,10 @@ export async function agentWorkflow({
107107
return { function: toolFunction };
108108
});
109109

110+
// Terminate AI agent workflow.
111+
110112
let ended = false;
111113
onEvent(agentEnd, async () => {
112-
// Terminate AI agent workflow
113114
log.info(`agentEnd received`);
114115
ended = true;
115116
});

examples/voice/src/workflows/stream/stream.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function streamWorkflow() {
3131
let isSendingAudio = false;
3232
let childAgentRunId = "";
3333

34-
// Start long running websocket and send welcome message.
34+
// Start long running websocket and stream welcome message to websocket.
3535
onEvent(streamInfoEvent, async ({ streamSid }: StreamInfo) => {
3636
log.info(`Workflow update with streamSid: ${streamSid}`);
3737
step<typeof functions>({
@@ -64,7 +64,7 @@ export async function streamWorkflow() {
6464
return { streamSid };
6565
});
6666

67-
// Transcribe audio and send it to AI agent
67+
// Receives audio, transcribe it and send transcription to AI agent.
6868

6969
onEvent(audioInEvent, async ({ streamSid, payload }: AudioIn) => {
7070
log.info(`Workflow update with streamSid: ${streamSid}`);
@@ -107,7 +107,7 @@ export async function streamWorkflow() {
107107
return { streamSid };
108108
});
109109

110-
// Generate audio from AI answer and send it to websocket
110+
// Receives AI answer, generates audio and stream it to websocket.
111111

112112
onEvent(answerEvent, async ({ streamSid, response, isLast }: Answer) => {
113113
const { audio } = await step<typeof functions>({
@@ -144,7 +144,7 @@ export async function streamWorkflow() {
144144
return { streamSid };
145145
});
146146

147-
// Terminates stream workflow
147+
// Terminates stream workflow.
148148

149149
let ended = false;
150150

0 commit comments

Comments
 (0)