diff --git a/packages/spike/src/ai.ts b/packages/spike/src/ai.ts index 8d49ad8..224c401 100644 --- a/packages/spike/src/ai.ts +++ b/packages/spike/src/ai.ts @@ -91,14 +91,16 @@ const reactionAgent = new Agent({ const reactionGuardrail: InputGuardrail = { name: "Reaction Guardrail", execute: async ({ input, context }) => { - // const result = await run(reactionAgent, input.slice(-1), { context }) - const emoji = " %F0%9F%91%8D " //result.finalOutput?.trim() + const result = await run(reactionAgent, input.slice(-1), { context }) + const emoji = result.finalOutput?.trim() if (emoji && emoji !== "0") { console.log(`😐 Spike reacted with ${emoji}`) const msg = (context.context as UserContext).msg const history = (historyForChannel[msg.channel.id] ||= []) history.push(system(`Spike reacted with ${emoji}`)) - msg.react(emoji) + msg.react(emoji).catch((error) => { + console.error(`💥 Failed to react with ${emoji}:`, error) + }) } // Always return false, we aren't really using this for a guardrail