mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix: adding debug logs to figure out response format issue
This commit is contained in:
@@ -338,8 +338,6 @@ async function processWebhook(
|
||||
},
|
||||
}
|
||||
} else {
|
||||
// This might be a different type of notification (e.g., status update)
|
||||
console.log('No messages in WhatsApp payload, might be a status update')
|
||||
return new NextResponse('OK', { status: 200 })
|
||||
}
|
||||
} else {
|
||||
@@ -448,6 +446,11 @@ async function processWebhook(
|
||||
{} as Record<string, Record<string, any>>
|
||||
)
|
||||
|
||||
console.log(`[Webhook Debug] Serialized workflow:`, serializedWorkflow)
|
||||
console.log(`[Webhook Debug] Processed block states:`, processedBlockStates)
|
||||
console.log(`[Webhook Debug] Decrypted env vars:`, decryptedEnvVars)
|
||||
console.log(`[Webhook Debug] Enriched input:`, enrichedInput)
|
||||
|
||||
const executor = new Executor(
|
||||
serializedWorkflow,
|
||||
processedBlockStates,
|
||||
@@ -455,6 +458,7 @@ async function processWebhook(
|
||||
enrichedInput
|
||||
)
|
||||
const result = await executor.execute(foundWorkflow.id)
|
||||
console.log(`[Webhook Debug] Final execution result:`, JSON.stringify(result))
|
||||
|
||||
console.log(`Successfully executed workflow ${foundWorkflow.id}`)
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
const parsedContent = JSON.parse(response.content)
|
||||
console.log(`[AgentBlockHandler Debug] Successfully parsed content:`, parsedContent)
|
||||
|
||||
return {
|
||||
const result = {
|
||||
...parsedContent,
|
||||
tokens: response.tokens || {
|
||||
prompt: 0,
|
||||
@@ -317,6 +317,9 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
}
|
||||
: undefined,
|
||||
}
|
||||
|
||||
console.log(`[AgentBlockHandler Debug] Result:`, result)
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error(`[AgentBlockHandler Error] Failed to parse response content:`, error)
|
||||
console.log(`[AgentBlockHandler Debug] Falling back to standard response format`)
|
||||
|
||||
Reference in New Issue
Block a user