Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/sim/app/api/mothership/chat/stop/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { and, eq, sql } from 'drizzle-orm'
import { type NextRequest, NextResponse } from 'next/server'
import { z } from 'zod'
import { getSession } from '@/lib/auth'
import { releasePendingChatStream } from '@/lib/copilot/chat-streaming'
import { taskPubSub } from '@/lib/copilot/task-events'

const logger = createLogger('MothershipChatStopAPI')
Expand Down Expand Up @@ -58,6 +59,8 @@ export async function POST(req: NextRequest) {

const { chatId, streamId, content, contentBlocks } = StopSchema.parse(await req.json())

await releasePendingChatStream(chatId, streamId)

const setClause: Record<string, unknown> = {
conversationId: null,
updatedAt: new Date(),
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,8 @@ export function useChat(
}

if (options?.error) {
pendingRecoveryMessageRef.current = null
setPendingRecoveryMessage(null)
setMessageQueue([])
return
}
Expand Down
Loading