Skip to content

Commit c764319

Browse files
fix(mothership): hang condition (#3852)
1 parent e5aef61 commit c764319

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

apps/sim/app/api/mothership/chat/stop/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { and, eq, sql } from 'drizzle-orm'
55
import { type NextRequest, NextResponse } from 'next/server'
66
import { z } from 'zod'
77
import { getSession } from '@/lib/auth'
8+
import { releasePendingChatStream } from '@/lib/copilot/chat-streaming'
89
import { taskPubSub } from '@/lib/copilot/task-events'
910

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

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

62+
await releasePendingChatStream(chatId, streamId)
63+
6164
const setClause: Record<string, unknown> = {
6265
conversationId: null,
6366
updatedAt: new Date(),

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,8 @@ export function useChat(
17371737
}
17381738

17391739
if (options?.error) {
1740+
pendingRecoveryMessageRef.current = null
1741+
setPendingRecoveryMessage(null)
17401742
setMessageQueue([])
17411743
return
17421744
}

0 commit comments

Comments
 (0)