diff --git a/src/server.ts b/src/server.ts index f3adf21..9539722 100644 --- a/src/server.ts +++ b/src/server.ts @@ -34,7 +34,7 @@ export class Chat extends AIChatAgent { */ async onChatMessage( onFinish: StreamTextOnFinishCallback, - _options?: { abortSignal?: AbortSignal } + options?: { abortSignal?: AbortSignal } ) { // const mcpConnection = await this.mcp.connect( // "https://path-to-mcp-server/sse" @@ -76,7 +76,8 @@ If the user asks to schedule a task, use the schedule tool to schedule the task. onFinish: onFinish as unknown as StreamTextOnFinishCallback< typeof allTools >, - stopWhen: stepCountIs(10) + stopWhen: stepCountIs(10), + abortSignal: options?.abortSignal }); writer.merge(result.toUIMessageStream());