mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix: key auth rate limiting on the socket address only and clear sent drafts after unmount
- auth: drop the AUTH_TRUSTED_PROXY_HEADERS opt-in. Configured headers were trusted from any peer, so direct access to the published port could still rotate them. Better Auth now reads only the Manager-set socket address header; the env, compose forwarding, docs and tests are removed. - composer: a send that completes after the composer unmounted (session switched mid-send) left the submitted text in the per-session draft store. Sends now complete through mutateAsync and clear the stored draft only if it still matches what was submitted, so newer edits are kept.
This commit is contained in:
1 parent
4ec62cd4e7
commit
dabe750920
17 files changed
+268
-233
No files matched your search
@@ -49,9 +49,9 @@ vi.mock('@/lib/toast', () => ({
|
||||
}))
|
||||
|
||||
vi.mock('@/hooks/useOpenCode', () => ({
|
||||
useSendPrompt: () => ({ mutate: mocks.useSendPrompt, isPending: false }),
|
||||
useSendPrompt: () => ({ mutate: mocks.useSendPrompt, mutateAsync: mocks.useSendPrompt, isPending: false }),
|
||||
useInterruptSession: () => ({ mutate: vi.fn() }),
|
||||
useSendShell: () => ({ mutate: vi.fn(), isPending: false }),
|
||||
useSendShell: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(() => Promise.resolve()), isPending: false }),
|
||||
useAgents: () => ({ data: [] }),
|
||||
useSkills: () => ({ data: [] }),
|
||||
}))
|
||||
@@ -118,6 +118,7 @@ describe('PromptInput composer layout', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
useComposerDraftStore.setState({ drafts: {} })
|
||||
mocks.useSendPrompt.mockResolvedValue({ id: 'inbox_1' })
|
||||
mocks.useVoiceConversation.mockReturnValue(createVoiceConversationControllerMock())
|
||||
mocks.hasPendingPermission.mockReturnValue(false)
|
||||
mocks.useMobile.mockReturnValue(false)
|
||||
@@ -193,12 +194,13 @@ describe('PromptInput composer layout', () => {
|
||||
expect(button.parentElement?.contains(controlsRow())).toBe(false)
|
||||
})
|
||||
|
||||
it('sends the typed prompt from the row button', () => {
|
||||
it('sends the typed prompt from the row button', async () => {
|
||||
renderComponent()
|
||||
|
||||
fireEvent.change(promptInput(), { target: { value: 'row send' } })
|
||||
fireEvent.click(screen.getByTitle('Send'))
|
||||
|
||||
await waitFor(() => expect(promptInput()).toHaveValue(''))
|
||||
const [variables] = mocks.useSendPrompt.mock.calls[0] as [{ text: string }]
|
||||
expect(variables.text).toBe('row send')
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
|
||||
import { render, screen, fireEvent, waitFor, act } from '@testing-library/react'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { PromptInput } from './PromptInput'
|
||||
import { useComposerDraftStore } from '@/stores/composerDraftStore'
|
||||
@@ -20,6 +20,7 @@ const mocks = vi.hoisted(() => ({
|
||||
useSendErrorStore: vi.fn(),
|
||||
useHasBackgroundActivity: vi.fn(),
|
||||
useSendPrompt: vi.fn(),
|
||||
useSendShell: vi.fn(),
|
||||
hasPendingPermission: vi.fn(() => false),
|
||||
setShowDialog: vi.fn(),
|
||||
}))
|
||||
@@ -48,9 +49,9 @@ vi.mock('@/lib/toast', () => ({
|
||||
}))
|
||||
|
||||
vi.mock('@/hooks/useOpenCode', () => ({
|
||||
useSendPrompt: () => ({ mutate: mocks.useSendPrompt, isPending: false }),
|
||||
useSendPrompt: () => ({ mutate: mocks.useSendPrompt, mutateAsync: mocks.useSendPrompt, isPending: false }),
|
||||
useInterruptSession: () => ({ mutate: vi.fn() }),
|
||||
useSendShell: () => ({ mutate: vi.fn(), isPending: false }),
|
||||
useSendShell: () => ({ mutate: mocks.useSendShell, mutateAsync: mocks.useSendShell, isPending: false }),
|
||||
useAgents: () => ({ data: [] }),
|
||||
useSkills: () => ({ data: [] }),
|
||||
}))
|
||||
@@ -120,9 +121,8 @@ describe('PromptInput per-session composer draft', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
useComposerDraftStore.setState({ drafts: {} })
|
||||
mocks.useSendPrompt.mockImplementation((_variables, options) => {
|
||||
options?.onSuccess?.()
|
||||
})
|
||||
mocks.useSendPrompt.mockResolvedValue({ id: 'inbox_1' })
|
||||
mocks.useSendShell.mockResolvedValue({ id: 'shell_1' })
|
||||
mocks.useVoiceConversation.mockReturnValue(createVoiceConversationControllerMock())
|
||||
mocks.hasPendingPermission.mockReturnValue(false)
|
||||
mocks.useMobile.mockReturnValue(false)
|
||||
@@ -196,7 +196,7 @@ describe('PromptInput per-session composer draft', () => {
|
||||
expect(screen.getByText('pic.png')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('sends the restored draft to the session that owns it and clears only that draft', () => {
|
||||
it('sends the restored draft to the session that owns it and clears only that draft', async () => {
|
||||
const { rerender } = renderSession('session-a')
|
||||
|
||||
fireEvent.change(promptInput(), { target: { value: 'draft for A' } })
|
||||
@@ -209,14 +209,76 @@ describe('PromptInput per-session composer draft', () => {
|
||||
|
||||
expect(mocks.useSendPrompt).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ sessionID: 'session-a', text: 'draft for A' }),
|
||||
expect.anything(),
|
||||
)
|
||||
expect(promptInput()).toHaveValue('')
|
||||
await waitFor(() => expect(promptInput()).toHaveValue(''))
|
||||
|
||||
rerender(harness('session-b'))
|
||||
expect(promptInput()).toHaveValue('draft for B')
|
||||
})
|
||||
|
||||
it('clears a submitted draft after its session unmounted before the send resolved', async () => {
|
||||
let resolveSend: (value: { id: string }) => void = () => {}
|
||||
mocks.useSendPrompt.mockImplementation(() => new Promise((resolve) => {
|
||||
resolveSend = resolve
|
||||
}))
|
||||
|
||||
const { rerender } = renderSession('session-a')
|
||||
|
||||
fireEvent.change(promptInput(), { target: { value: 'sent while leaving' } })
|
||||
fireEvent.click(screen.getByTitle('Send'))
|
||||
expect(useComposerDraftStore.getState().getDraft('session-a').prompt).toBe('sent while leaving')
|
||||
|
||||
rerender(harness('session-b'))
|
||||
await act(async () => {
|
||||
resolveSend({ id: 'inbox_1' })
|
||||
})
|
||||
|
||||
rerender(harness('session-a'))
|
||||
expect(promptInput()).toHaveValue('')
|
||||
})
|
||||
|
||||
it('clears a submitted bash command after its session unmounted before the send resolved', async () => {
|
||||
let resolveShell: (value: { id: string }) => void = () => {}
|
||||
mocks.useSendShell.mockImplementation(() => new Promise((resolve) => {
|
||||
resolveShell = resolve
|
||||
}))
|
||||
|
||||
const { rerender } = renderSession('session-a')
|
||||
|
||||
fireEvent.change(promptInput(), { target: { value: '!' } })
|
||||
fireEvent.change(screen.getByPlaceholderText('Enter bash command...'), { target: { value: '!ls' } })
|
||||
fireEvent.click(screen.getByTitle('Send'))
|
||||
|
||||
rerender(harness('session-b'))
|
||||
await act(async () => {
|
||||
resolveShell({ id: 'shell_1' })
|
||||
})
|
||||
|
||||
rerender(harness('session-a'))
|
||||
expect(promptInput()).toHaveValue('')
|
||||
expect(screen.queryByTestId('composer-mode-badge')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('keeps text typed after the submit when the send resolves', async () => {
|
||||
let resolveSend: (value: { id: string }) => void = () => {}
|
||||
mocks.useSendPrompt.mockImplementation(() => new Promise((resolve) => {
|
||||
resolveSend = resolve
|
||||
}))
|
||||
|
||||
renderSession('session-a')
|
||||
|
||||
fireEvent.change(promptInput(), { target: { value: 'sent message' } })
|
||||
fireEvent.click(screen.getByTitle('Send'))
|
||||
fireEvent.change(promptInput(), { target: { value: 'sent message plus an edit' } })
|
||||
|
||||
await act(async () => {
|
||||
resolveSend({ id: 'inbox_1' })
|
||||
})
|
||||
|
||||
expect(promptInput()).toHaveValue('sent message plus an edit')
|
||||
expect(useComposerDraftStore.getState().getDraft('session-a').prompt).toBe('sent message plus an edit')
|
||||
})
|
||||
|
||||
it('keeps the draft when Escape is pressed while the session is idle', () => {
|
||||
renderSession('session-a')
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ vi.mock('@/hooks/useOpenCode', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@/hooks/useOpenCode')>()
|
||||
return {
|
||||
...actual,
|
||||
useSendPrompt: () => ({ mutate: mocks.sendPrompt, isPending: false }),
|
||||
useSendShell: () => ({ mutate: mocks.sendShell, isPending: false }),
|
||||
useSendPrompt: () => ({ mutate: mocks.sendPrompt, mutateAsync: mocks.sendPrompt, isPending: false }),
|
||||
useSendShell: () => ({ mutate: mocks.sendShell, mutateAsync: mocks.sendShell, isPending: false }),
|
||||
useInterruptSession: () => ({ mutate: mocks.interrupt }),
|
||||
useAgents: () => ({ data: mocks.agents }),
|
||||
useSkills: () => ({ data: mocks.skills }),
|
||||
@@ -170,6 +170,8 @@ describe('PromptInput goal mode', () => {
|
||||
mocks.useSessionGoal.mockReturnValue({ data: null })
|
||||
mocks.useSessionPermissionMode.mockReturnValue({ data: undefined })
|
||||
mocks.startGoal.mockResolvedValue({ id: 1 })
|
||||
mocks.sendPrompt.mockResolvedValue({ id: 'inbox_1' })
|
||||
mocks.sendShell.mockResolvedValue({ id: 'shell_1' })
|
||||
mocks.agents = []
|
||||
mocks.useMobile.mockReturnValue(false)
|
||||
mocks.useSTT.mockReturnValue({
|
||||
@@ -267,7 +269,6 @@ describe('PromptInput goal mode', () => {
|
||||
}))
|
||||
await waitFor(() => expect(mocks.sendPrompt).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ delivery: 'queue' }),
|
||||
expect.anything(),
|
||||
))
|
||||
expect(mocks.startGoal.mock.invocationCallOrder[0]).toBeLessThan(mocks.sendPrompt.mock.invocationCallOrder[0])
|
||||
})
|
||||
|
||||
@@ -56,7 +56,7 @@ vi.mock('@/hooks/useOpenCode', () => ({
|
||||
isPending: mocks.sendPromptPending(),
|
||||
}),
|
||||
useInterruptSession: () => ({ mutate: vi.fn(), mutateAsync: vi.fn() }),
|
||||
useSendShell: () => ({ mutate: vi.fn(), isPending: false }),
|
||||
useSendShell: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(() => Promise.resolve()), isPending: false }),
|
||||
useAgents: () => ({ data: [] }),
|
||||
useSkills: () => ({ data: [] }),
|
||||
}))
|
||||
@@ -222,9 +222,6 @@ describe('PromptInput voice conversation', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
useComposerDraftStore.setState({ drafts: {} })
|
||||
mocks.useSendPromptMutate.mockImplementation((_variables, options) => {
|
||||
options?.onSuccess?.()
|
||||
})
|
||||
mocks.useSendPromptMutateAsync.mockResolvedValue({ id: 'inbox_1' })
|
||||
mocks.sendPromptPending.mockReturnValue(false)
|
||||
mocks.useMobile.mockReturnValue(true)
|
||||
@@ -426,9 +423,7 @@ describe('PromptInput submission', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
useComposerDraftStore.setState({ drafts: {} })
|
||||
mocks.useSendPromptMutate.mockImplementation((_variables, options) => {
|
||||
options?.onSuccess?.()
|
||||
})
|
||||
mocks.useSendPromptMutateAsync.mockResolvedValue({ id: 'inbox_1' })
|
||||
mocks.sendPromptPending.mockReturnValue(false)
|
||||
mocks.useMobile.mockReturnValue(true)
|
||||
mocks.useSttAvailability.mockReturnValue({ isEnabled: true, isSupported: true })
|
||||
@@ -439,7 +434,7 @@ describe('PromptInput submission', () => {
|
||||
})
|
||||
|
||||
it('keeps submitted text until send succeeds', () => {
|
||||
mocks.useSendPromptMutate.mockImplementation(() => undefined)
|
||||
mocks.useSendPromptMutateAsync.mockImplementation(() => new Promise(() => {}))
|
||||
renderComponent()
|
||||
|
||||
const input = screen.getByPlaceholderText('Send a message...')
|
||||
@@ -462,7 +457,7 @@ describe('PromptInput submission', () => {
|
||||
})
|
||||
|
||||
it('clears submitted text once the server confirms it is processing', async () => {
|
||||
mocks.useSendPromptMutate.mockImplementation(() => undefined)
|
||||
mocks.useSendPromptMutateAsync.mockImplementation(() => new Promise(() => {}))
|
||||
const view = renderComponent()
|
||||
|
||||
const input = screen.getByPlaceholderText('Send a message...')
|
||||
@@ -478,7 +473,7 @@ describe('PromptInput submission', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('allows queuing a follow-up while a non-queued send is pending', () => {
|
||||
it('allows queuing a follow-up while a non-queued send is pending', async () => {
|
||||
mocks.sendPromptPending.mockReturnValue(true)
|
||||
renderComponent({ isStreamingResponse: true })
|
||||
|
||||
@@ -490,7 +485,8 @@ describe('PromptInput submission', () => {
|
||||
|
||||
fireEvent.click(queueButton)
|
||||
|
||||
const [callArgs] = mocks.useSendPromptMutate.mock.calls[0] as [{ text: string }, unknown]
|
||||
await waitFor(() => expect(input).toHaveValue(''))
|
||||
const [callArgs] = mocks.useSendPromptMutateAsync.mock.calls[0] as [{ text: string }]
|
||||
expect(callArgs.text).toBe('follow-up')
|
||||
})
|
||||
|
||||
@@ -501,7 +497,7 @@ describe('PromptInput submission', () => {
|
||||
fireEvent.change(input, { target: { value: 'queued message' } })
|
||||
fireEvent.click(screen.getByTitle('Queue message'))
|
||||
|
||||
const [callArgs] = mocks.useSendPromptMutate.mock.calls[0] as [{ text: string }, unknown]
|
||||
const [callArgs] = mocks.useSendPromptMutateAsync.mock.calls[0] as [{ text: string }]
|
||||
expect(callArgs.text).toBe('queued message')
|
||||
|
||||
await waitFor(() => {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useSttAvailability } from '@/hooks/useSTT'
|
||||
import { useUserBash } from '@/stores/userBashStore'
|
||||
import { useSessionAgentStore } from '@/stores/sessionAgentStore'
|
||||
import { useSendErrorStore } from '@/stores/sendErrorStore'
|
||||
import { useComposerDraftStore } from '@/stores/composerDraftStore'
|
||||
import { useComposerDraftStore, type ComposerDraft } from '@/stores/composerDraftStore'
|
||||
import { useRecentCommandsStore } from '@/stores/recentCommandsStore'
|
||||
import { useHasBackgroundActivity } from '@/stores/sessionStatusStore'
|
||||
import { useTouchTapSelect } from '@/hooks/useTouchTapSelect'
|
||||
@@ -189,6 +189,7 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
|
||||
const saveDraft = useComposerDraftStore((state) => state.saveDraft)
|
||||
const clearDraft = useComposerDraftStore((state) => state.clearDraft)
|
||||
const clearDraftIfUnchanged = useComposerDraftStore((state) => state.clearDraftIfUnchanged)
|
||||
|
||||
useEffect(() => {
|
||||
if (prompt === '' && !isBashMode && attachedFiles.size === 0 && imageAttachments.length === 0) {
|
||||
@@ -215,6 +216,11 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
}
|
||||
}, [])
|
||||
|
||||
const completeSubmittedDraft = useCallback((submitted: ComposerDraft, options?: { keepAttachments?: boolean }) => {
|
||||
clearDraftIfUnchanged(sessionID, submitted, options)
|
||||
clearSubmittedPrompt(submitted.prompt, submitted.attachedFiles, submitted.imageAttachments, options)
|
||||
}, [sessionID, clearDraftIfUnchanged, clearSubmittedPrompt])
|
||||
|
||||
const pendingConfirmClearRef = useRef<{
|
||||
prompt: string
|
||||
files: Map<string, FileAttachmentInfo>
|
||||
@@ -376,27 +382,23 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
if (isStreamingResponse) {
|
||||
onScrollToBottom()
|
||||
const parsed = parsePromptToInput(prompt, attachedFiles, agentNames, skillIds, imageAttachments)
|
||||
const submittedPrompt = prompt
|
||||
const submittedAttachedFiles = attachedFiles
|
||||
const submittedImageAttachments = imageAttachments
|
||||
const submitted: ComposerDraft = { prompt, isBashMode, attachedFiles, imageAttachments }
|
||||
if (isGoalArmed && !isBashMode && !isExactCommandPrompt(prompt)) {
|
||||
const goalStarted = await startArmedGoal(parsed.text)
|
||||
if (!goalStarted) return
|
||||
}
|
||||
sendPrompt.mutate(
|
||||
{
|
||||
sessionID,
|
||||
text: parsed.text,
|
||||
files: parsed.files,
|
||||
agents: parsed.agents,
|
||||
skills: parsed.skills,
|
||||
model: modelRef ?? undefined,
|
||||
agent: currentMode,
|
||||
delivery: 'queue',
|
||||
},
|
||||
{
|
||||
onSuccess: () => clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments)
|
||||
}
|
||||
void sendPrompt.mutateAsync({
|
||||
sessionID,
|
||||
text: parsed.text,
|
||||
files: parsed.files,
|
||||
agents: parsed.agents,
|
||||
skills: parsed.skills,
|
||||
model: modelRef ?? undefined,
|
||||
agent: currentMode,
|
||||
delivery: 'queue',
|
||||
}).then(
|
||||
() => completeSubmittedDraft(submitted),
|
||||
() => undefined,
|
||||
)
|
||||
setStoredAgent(sessionID, currentMode)
|
||||
return
|
||||
@@ -407,19 +409,18 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
if (isBashMode) {
|
||||
const command = prompt.startsWith('!') ? prompt.slice(1) : prompt
|
||||
addUserBashCommand(command)
|
||||
const submittedPrompt = prompt
|
||||
sendShell.mutate(
|
||||
{
|
||||
sessionID,
|
||||
command,
|
||||
const submitted: ComposerDraft = { prompt, isBashMode, attachedFiles, imageAttachments }
|
||||
void sendShell.mutateAsync({
|
||||
sessionID,
|
||||
command,
|
||||
}).then(
|
||||
() => {
|
||||
clearDraftIfUnchanged(sessionID, submitted, { keepAttachments: true })
|
||||
if (promptRef.current !== submitted.prompt) return
|
||||
setPrompt('')
|
||||
setIsBashMode(false)
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
if (promptRef.current !== submittedPrompt) return
|
||||
setPrompt('')
|
||||
setIsBashMode(false)
|
||||
}
|
||||
}
|
||||
() => undefined,
|
||||
)
|
||||
setStoredAgent(sessionID, currentMode)
|
||||
return
|
||||
@@ -434,9 +435,7 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
if (command) {
|
||||
recordCommand(command.name)
|
||||
const parsed = parsePromptToInput(commandPrompt.args?.trim() || '', attachedFiles, agentNames, skillIds, imageAttachments)
|
||||
const submittedPrompt = prompt
|
||||
const submittedAttachedFiles = attachedFiles
|
||||
const submittedImageAttachments = imageAttachments
|
||||
const submitted: ComposerDraft = { prompt, isBashMode, attachedFiles, imageAttachments }
|
||||
|
||||
void executeCommand(command, {
|
||||
text: parsed.text,
|
||||
@@ -445,22 +444,20 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
skills: parsed.skills,
|
||||
}).then((shouldClear) => {
|
||||
if (!shouldClear) return
|
||||
const keepAttachments = isBuiltinCommand(command) && (submittedAttachedFiles.size > 0 || submittedImageAttachments.length > 0)
|
||||
const keepAttachments = isBuiltinCommand(command) && (submitted.attachedFiles.size > 0 || submitted.imageAttachments.length > 0)
|
||||
if (keepAttachments) {
|
||||
clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments, { keepAttachments: true })
|
||||
completeSubmittedDraft(submitted, { keepAttachments: true })
|
||||
showToast.info('Built-in commands do not use attachments; they were kept')
|
||||
return
|
||||
}
|
||||
clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments)
|
||||
completeSubmittedDraft(submitted)
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const parsed = parsePromptToInput(prompt, attachedFiles, agentNames, skillIds, imageAttachments)
|
||||
const submittedPrompt = prompt
|
||||
const submittedAttachedFiles = attachedFiles
|
||||
const submittedImageAttachments = imageAttachments
|
||||
const submitted: ComposerDraft = { prompt, isBashMode, attachedFiles, imageAttachments }
|
||||
|
||||
if (isGoalArmed) {
|
||||
const goalStarted = await startArmedGoal(parsed.text)
|
||||
@@ -468,30 +465,27 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
|
||||
}
|
||||
|
||||
pendingConfirmClearRef.current = {
|
||||
prompt: submittedPrompt,
|
||||
files: submittedAttachedFiles,
|
||||
images: submittedImageAttachments
|
||||
prompt: submitted.prompt,
|
||||
files: submitted.attachedFiles,
|
||||
images: submitted.imageAttachments
|
||||
}
|
||||
|
||||
sendPrompt.mutate(
|
||||
{
|
||||
sessionID,
|
||||
text: parsed.text,
|
||||
files: parsed.files,
|
||||
agents: parsed.agents,
|
||||
skills: parsed.skills,
|
||||
model: modelRef ?? undefined,
|
||||
agent: currentMode,
|
||||
void sendPrompt.mutateAsync({
|
||||
sessionID,
|
||||
text: parsed.text,
|
||||
files: parsed.files,
|
||||
agents: parsed.agents,
|
||||
skills: parsed.skills,
|
||||
model: modelRef ?? undefined,
|
||||
agent: currentMode,
|
||||
}).then(
|
||||
() => {
|
||||
pendingConfirmClearRef.current = null
|
||||
completeSubmittedDraft(submitted)
|
||||
},
|
||||
() => {
|
||||
pendingConfirmClearRef.current = null
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
pendingConfirmClearRef.current = null
|
||||
clearSubmittedPrompt(submittedPrompt, submittedAttachedFiles, submittedImageAttachments)
|
||||
},
|
||||
onError: () => {
|
||||
pendingConfirmClearRef.current = null
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
onScrollToBottom()
|
||||
|
||||
Reference in new issue
Block a user