https://discord.gg/botpress logo
React App showing Reference Brackets
# 🤝help
m
We’re using the paid version of Botpress for our healthcare organization and have deployed the bot within a React app hosted on a Windows Azure VM. In the React app, no matter how we configure or prompt the bot, it consistently includes bracketed numbers (e.g., references) in its responses. This behavior does not occur in the Webchat preview or the testing module inside the Botpress Studio, it only happens in the published React app. We’ve tried multiple setting changes within the React app, but nothing has resolved the issue. Is there a way to explicitly prevent the bot from displaying these bracketed references in the published environment?
p
Have you tried instructing the policy agent to remove them?
m
Yeah we have, it does remove them in the webchat test agent inside the studio, but not on the published react agent on the server.
@prehistoric-airplane-85682 any suggestions? we'd have to find another tool if we can't find a solution since it's so jarring for customers/end users
p
Here's a code snippet you could put in the "Before Outgoing" hook to remove LLM citation numbers:
Copy code
js
if (outgoingEvent?.payload?.text && typeof outgoingEvent.payload.text === 'string') {
    const previousMessage = outgoingEvent.payload.text;
    outgoingEvent.payload.text = previousMessage.replace(/\s*【\s*[\d\s,]*\s*】\s*/g, '');
  }
m
@prehistoric-airplane-85682 We have been struggling for weeks on this. I cannot tell you how happy you've made me and the entire team. So great and helpful... really appreciate it.
p
Glad it worked! Happy to help :))