I am trying to build an assistant using the Openai integration (Complete Chat (with history). During the week, I had different problems:
Never saw ‘after submit’ works (as part of integration), only if I set up without history on the column;
The add row action needed also is not working, which makes the message from the user and assistant be in the same row not differentiating the user from assistant on the bubbles even having the column role;
I am not sure if only one ‘Chat History’ table is enough (besides the user table);
Anyone with similar problems who would like to talk through the community chat? (kudos to the team for this feature, very helpful but very hidden haha)
Openai integration is all ok (API key, the account is active and with funds), and I am sure because when I set it as a column, it works as you can see here:
If I run manually (click on ‘run’ button), it works:
Considering that the response of Openai appears in the same row as the user message, I added this Add row so it will add a row with the response info as the main message but with a hardcoded name and email from the “assistant.”
The logic is that if the Content is not empty, the user sent a message, therefore we have Result. Then, change Content to Result so it will display as an “assistant” message, as you can see in the first screenshot.
First up, seems like you should have had the model name as “gpt-3.5-turbo” instead of “gpt-3.5 turbo” like the screenshot.
For your “add row” action, is there a reason why you don’t add it as part of your on-submit action?
I would do it like this for the chat component’s on-submit action:
Add an “AI Result” column in your chat table.
In your on-submit action of the chat component, add a new action so you can have multiple steps.
Add complete chat with history as your first step, reference the right table (or relation, in this case, since I believe you would have multiple convos going on in that same table). Write the result to “AI Result”.
Wait for condition step until “AI Result” is not empty.
Add row to the same Chat table with “AI Result” as the content.
I think the main difference is that my action is not on after submit. The rest, I think, is basically the same: I called Result, what you are calling AI Result, etc
I don’t know how to add a second action there (after submit). It looks like I can only have one action there.
I will try to record it because it happens right after the action happens - I see the new row with the data collapse and 2s, it disappears - staying only the row from the user message.
Part of the problem is that it seems you are using a User Specific column to store the user/assistant values in the Role column inside the Users Table. This means those values will be invisible to any other user that logs into the application and the bot user would role value would have to be set manually to “assistant” by every user. You may want to have the Role column as a permanent regular column instead.
It also seems you are using User Specific columns to save your chat messages. If you are logged in as anyone else except the user that created those messages they will disappear.
Thank you for answering! It is a bit frustrating the amount of back-and-forth and still kind to make one chat work by myself
I was using the specific user row for saving messages because the idea is to have an assistant that can assist different users (there is only one feature: the chat with the assistant), so indeed, it is supposed to not appear to a different user. But based on other posts I was reading and doc, it looks like this “simple logic” of having one chat history table is not enough to handle one (assistant) x multiples (users, individually). If it was a forum and a post where everybody could answer, I think what you said would make more sense, but maybe I do not understand something here.
Regarding the role, I thought of a specific user column because one row is for the assistant, and the other is for the user, so technically, it is specific, right?
The concept of user specific columns can be a bit confusing. Data stored in user specific columns is only visible to the user that entered that data. For any parameter that needs to be permanent across all users for the app’s logic to work, you need to use regular columns, otherwise that data is invisible to any other user. For the bot’s role of “assistant” that is a parameter that needs to be the same for all users, therefore it must be a permanent or regular text column type. There is more info on how User Specific columns work here → User-specific columns | Glide Docs
I don’t think using user specific columns is going to save rows. Each message and response is going to require each a row, otherwise the chat component won’t be able to render a chat thread with multiple messages.
I recommend you take a look at my AI Chat tutorial. It explains in detail how to set up an AI chat that multiple users can interact with. It uses Row Owners columns to protect data across different users.
I did all the fixes you all mentioned and still see it disappear from the table, not from the layout view.
Maybe I am having trouble explaining what is happening on my end, or maybe I should reread the documentation and the videos since the onboarding clearly did not help me.
Currently, I only have 2 tables, which makes me wonder if it is enough. I understood the differences between row owners and user-specific columns and have made the changes based on the videos and support.
So, technically, I now have:
chat history table where only the user e-mail column is the owner of the row;
action after submit that contains: condition, openai chat settings, add row