mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
fix payload accesses
This commit is contained in:
@@ -1033,7 +1033,7 @@ export function useChat(
|
||||
if (previewPhase === 'file_preview_complete') {
|
||||
const fileId =
|
||||
typeof payload.fileId === 'string' ? payload.fileId : prevSession.fileId
|
||||
const resultData = asPayloadRecord(payload.data)
|
||||
const resultData = asPayloadRecord(payload.output)
|
||||
sessions.delete(id)
|
||||
activeFilePreviewToolCallIdRef.current = null
|
||||
|
||||
|
||||
@@ -418,10 +418,7 @@ export async function runStreamLoop(
|
||||
toolName: 'workspace_file',
|
||||
previewPhase: 'file_preview_complete',
|
||||
fileId: context.activeFileIntent.target.fileId,
|
||||
data:
|
||||
streamEvent.payload.result !== undefined
|
||||
? streamEvent.payload.result
|
||||
: streamEvent.payload.data,
|
||||
output: streamEvent.payload.output,
|
||||
},
|
||||
...(streamEvent.scope ? { scope: streamEvent.scope } : {}),
|
||||
})
|
||||
|
||||
@@ -209,7 +209,7 @@ export async function emitSyntheticToolResult(
|
||||
mode: MothershipStreamV1ToolMode.async,
|
||||
phase: MothershipStreamV1ToolPhase.result,
|
||||
success,
|
||||
result: resultPayload,
|
||||
output: resultPayload,
|
||||
...(completion?.status ? { status: completion.status } : {}),
|
||||
...(!success && completion?.message ? { error: completion.message } : {}),
|
||||
},
|
||||
|
||||
@@ -423,7 +423,7 @@ export async function executeToolAndReport(
|
||||
mode: MothershipStreamV1ToolMode.async,
|
||||
phase: MothershipStreamV1ToolPhase.result,
|
||||
success: result.success,
|
||||
result: result.output,
|
||||
output: result.output,
|
||||
...(result.success
|
||||
? { status: MothershipStreamV1ToolOutcome.success }
|
||||
: { status: MothershipStreamV1ToolOutcome.error }),
|
||||
@@ -527,7 +527,7 @@ export async function executeToolAndReport(
|
||||
phase: MothershipStreamV1ToolPhase.result,
|
||||
status: MothershipStreamV1ToolOutcome.error,
|
||||
error: toolCall.error,
|
||||
result: { error: toolCall.error },
|
||||
output: { error: toolCall.error },
|
||||
},
|
||||
}
|
||||
await options?.onEvent?.(errorEvent)
|
||||
|
||||
Reference in New Issue
Block a user