refac
This commit is contained in:
@@ -200,6 +200,11 @@
|
||||
window.setTimeout(() => scrollToBottom(), 0);
|
||||
|
||||
await tick();
|
||||
|
||||
// Mark chat read when initially loading it
|
||||
if (chatIdProp && !$temporaryChatEnabled) {
|
||||
updateLastReadAt(chatIdProp);
|
||||
}
|
||||
|
||||
// Process any queued requests if the chat is idle
|
||||
const lastMessage = history.currentId ? history.messages[history.currentId] : null;
|
||||
@@ -403,6 +408,13 @@
|
||||
saveChatHandler(_chatId, history);
|
||||
};
|
||||
|
||||
const updateLastReadAt = (id) => {
|
||||
$socket?.emit('events:chat', {
|
||||
chat_id: id,
|
||||
data: { type: 'last_read_at' }
|
||||
});
|
||||
};
|
||||
|
||||
const terminalEventHandler = (type: string, data: any) => {
|
||||
if (type === 'terminal:display_file') {
|
||||
if (!data?.path) return;
|
||||
@@ -768,6 +780,9 @@
|
||||
|
||||
return () => {
|
||||
try {
|
||||
if (chatIdProp && !$temporaryChatEnabled) {
|
||||
updateLastReadAt(chatIdProp);
|
||||
}
|
||||
pageSubscribe();
|
||||
showControlsSubscribe();
|
||||
selectedFolderSubscribe();
|
||||
|
||||
Reference in New Issue
Block a user