I am trying to use the chat component and supply the assistant content myself (users enters a message, my query gets that message and then returns a response that is showed in the chat component as the assistant).
I read this but am not able to get similar outcome:
https://community.retool.com/t/how-do-i-use-my-own-api-and-chat-
functionality-with-the-chat-component/37114
I'm not sure if it's the cause of the issue, but one thing I noticed that is different is that I am not able to specify any value for Query To Trigger, only for the event handler.
Any ideas how I can get the assistant text response back to chat component?
Paulo
July 8, 2024, 6:28pm
2
Hi @Taka_Binancio , here are a couple of topics that should help with your use case:
Goal: I want the Retool AI assistant to send specific messages using Javascript.
Steps: Right now, I'm playing around with the chat1.sendmessage function but this sends the message as the user (me), not as the assistant. I am alternatively also trying to do this by overwriting the message history, but the chat doesn't reflect any updates I make to message history.
it's possible to do this without CSS, here's how I did it:
the 'intro' message that the ai sends as the 1st message should usually be removed from the message history. this message doesn't have any previous context so it shouldn't be used... openai lets you add initial messages to a thread when using the assistants api, which end up being ignored, but since we don't know if this is being used or if Retool is managing history on its own we want to 'normalize' things so it doesn't matter
[imag…