Pending Review
Last Updated: 22 Jun 2026 12:38 by Software
Software
Created on: 22 Jun 2026 12:38
Category: Kendo UI for jQuery
Type: Feature Request
0
AI token streaming in Kendo UI Chat JQuery

Hi,

I've followed your AI integration example but I noticied that when I use the updateMessage method for some reason the chat scroll move toward the start of the message. Maybe I'm wrong but looking at the source code I think that the problem is the chat-widget.js inside this method


_refreshStandardSync(message, isOwnMessage, wasNearBottom) {
        if (!message) {
            return;
        }
        this.renderMessage(message);
        if (isOwnMessage) {
            this.scrollToBottom();
        }
        else if (wasNearBottom && message.uid) {
            this.view.scrollIncomingMessage(message.uid);
        }
    }
I think that if the message is mine is correct that the chat scrolls to the bottom, but maybe the code in the other users branch can lead into this effect. The desired behaviour is giving a Chat-GPT UX, so if the user isn't scrolling the chat must scroll to the bottom, if the user scrolls the chat must keep user position. Actually in my opinion the chat is not fully designed to support streaming token AI, but maybe my code has some problems.


This is my code to manage streaming token AI and kendo chat initialization



$("#copilotChat").kendoChat({
	authorId: "user",
	height: "100%",
	messageBox: {
		mode: "auto"
	},
	fileAttachment: false,
	speechToText: false,
	messageWidthMode: "full",
	skipSanitization: true,
	sendMessage: function (e) {
		if (e.generating) {
			//cancelling request, code omitted
		}
		else {
			//new request, code omitted
		   
		}
	}
});

//receive message via SSE (code omitted)

const chat = $("#copilotChat").data("kendoChat");
let messageObject = chat.dataSource.get(params.runId);

dashboardProposal.currentCopilotChatText += params.content;
if (messageObject) {
	const markdown = markdownInstance.parse(dashboardProposal.currentCopilotChatText);
	chat.updateMessage(messageObject, { text: markdown });
}
else {
	chat.postMessage({
		authorId: "assistant",
		authorName: app.i18n("advice_dashboardProposal_authorNameCopilot"),
		text: params.content,
		id: params.runId
	});
}

I believe this feature would greatly facilitate the integration of AI token streaming into web applications.
Thanks in advance
0 comments