Hi Team,
I am building an AI chat kind of application, where the response needs to be streamed just like chatGPT does.
API team has provided an API to get the response for the question which will be asked from the fron-end. I have used SEE event HUB component to stream the response in the UI, however, I am getting only the first piece of information to the event listener even though entire response is received from the API, I have attached the screenshots of the workflow, please guide me to fix the issue.
Thanks
Sai
Hi @Jeevan Sai Sabbavarapu
If you’re storing the response in a variable, make sure it’s not limited by data type constraints (like Text vs. Long Text). Please check this.
Thanks ,
Regards
Karnika.
Hi @Karnika-EONE, I have used text variable to store the response, and it was assigned and displayed properly when i used directly before i used this component.
Hi Jeevan,
It looks like your message is being truncated. Please have in mind:
- SSE follows a text protocol, messages are ended following two new lines \n\n. You could try to remove the \n (new lines) before sending the message to see if that's the issue.
- SSE is a light-weight signaling mechanism. For your scenario, it's purpose would be to signal the clients that the response is ready, stored on your server. Your clients would then fetch the response via a normal action/aggregate. So you should for this scenario:
Hi @Nuno Damaso, I have removed the newline() function from the code and still no luck, I am attaching the network window from the developer options and general log message for better understanding, please review and let me know if any further changes are required.
event: sseClientToken
data: da0c342f-9207-4c0b-9f55-639071cae802
: HeartBeat Outsystems SSE da0c342f-9207-4c0b-9f55-639071cae802
data: To raise a ticket in ServiceNow, follow these steps:
1. Log in to your ServiceNow account.
2. Go to the "Service Catalog" or "Request" module, depending on your organization's setup.
3. Browse or search for the service or item you want to request.
4. Click on the service or item to open the request form.
5. Fill out the required fields on the form, providing as much detail as possible about your request.
6. Click the "Submit" button to raise the ticket.
7. You will receive a confirmation email with the ticket number and details of your request.
8. You can track the progress of your ticket in the "My Requests" or "My Tickets" section of your ServiceNow account.
Alternatively, if you are unable to raise a ticket through the self-service portal, you can contact your organization's IT service desk or help desk to raise a ticket on your behalf.
Regards,
Hey Sai,
I can see the new lines from the moon :) Here:
It is not removing the newlines from code, it is parsing the text to remove new lines.
I want to reiterate that SSE is not mean to send the whole data package, you should follow the guide lines I wrote before:
If you really, really, really want/need to send the whole text, the best way is to serialize the message (your text) in JSON, and deserialize on the receiving end - this will properly escape the content.