refac
This commit is contained in:
1 parent
e212e3c7f4
commit
cea991260f
6 files changed
+48
-11
No files matched your search
@@ -991,7 +991,7 @@
|
|||||||
} else if (type === 'chat:message:follow_ups') {
|
} else if (type === 'chat:message:follow_ups') {
|
||||||
message.followUps = data.follow_ups;
|
message.followUps = data.follow_ups;
|
||||||
|
|
||||||
if (autoScroll) {
|
if (shouldAutoScrollResponse()) {
|
||||||
scrollToBottom('smooth');
|
scrollToBottom('smooth');
|
||||||
}
|
}
|
||||||
} else if (type === 'chat:outlet') {
|
} else if (type === 'chat:outlet') {
|
||||||
@@ -2105,9 +2105,14 @@
|
|||||||
await messagesRef?.scrollToTop();
|
await messagesRef?.scrollToTop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const shouldAutoScrollResponse = () =>
|
||||||
|
autoScroll && ($settings?.scrollOnResponseGeneration ?? true);
|
||||||
|
|
||||||
let scrollRAF = null;
|
let scrollRAF = null;
|
||||||
let contentsRAF = null;
|
let contentsRAF = null;
|
||||||
const scheduleScrollToBottom = () => {
|
const scheduleResponseScrollToBottom = () => {
|
||||||
|
if (!shouldAutoScrollResponse()) return;
|
||||||
|
|
||||||
if (!scrollRAF) {
|
if (!scrollRAF) {
|
||||||
scrollRAF = requestAnimationFrame(async () => {
|
scrollRAF = requestAnimationFrame(async () => {
|
||||||
scrollRAF = null;
|
scrollRAF = null;
|
||||||
@@ -2426,7 +2431,7 @@
|
|||||||
history.messages[message.id] = message;
|
history.messages[message.id] = message;
|
||||||
|
|
||||||
await tick();
|
await tick();
|
||||||
if (autoScroll) {
|
if (shouldAutoScrollResponse()) {
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2447,9 +2452,7 @@
|
|||||||
console.log(data);
|
console.log(data);
|
||||||
await tick();
|
await tick();
|
||||||
|
|
||||||
if (autoScroll) {
|
scheduleResponseScrollToBottom();
|
||||||
scheduleScrollToBottom();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
@@ -3209,7 +3212,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
await tick();
|
await tick();
|
||||||
scrollToBottom();
|
if (shouldAutoScrollResponse()) {
|
||||||
|
scrollToBottom();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOpenAIError = async (error, responseMessage) => {
|
const handleOpenAIError = async (error, responseMessage) => {
|
||||||
@@ -3282,7 +3287,7 @@
|
|||||||
|
|
||||||
history.messages[history.currentId] = responseMessage;
|
history.messages[history.currentId] = responseMessage;
|
||||||
|
|
||||||
if (autoScroll) {
|
if (shouldAutoScrollResponse()) {
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3430,9 +3435,7 @@
|
|||||||
history.messages[messageId] = message;
|
history.messages[messageId] = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoScroll) {
|
scheduleResponseScrollToBottom();
|
||||||
scheduleScrollToBottom();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveChatHandler(_chatId, history);
|
await saveChatHandler(_chatId, history);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
let widescreenMode = false;
|
let widescreenMode = false;
|
||||||
let splitLargeChunks = false;
|
let splitLargeChunks = false;
|
||||||
let scrollOnBranchChange = true;
|
let scrollOnBranchChange = true;
|
||||||
|
let scrollOnResponseGeneration = true;
|
||||||
let showFilesOnTerminalSelect = true;
|
let showFilesOnTerminalSelect = true;
|
||||||
let userLocation = false;
|
let userLocation = false;
|
||||||
|
|
||||||
@@ -250,6 +251,7 @@
|
|||||||
widescreenMode = $settings?.widescreenMode ?? false;
|
widescreenMode = $settings?.widescreenMode ?? false;
|
||||||
splitLargeChunks = $settings?.splitLargeChunks ?? false;
|
splitLargeChunks = $settings?.splitLargeChunks ?? false;
|
||||||
scrollOnBranchChange = $settings?.scrollOnBranchChange ?? true;
|
scrollOnBranchChange = $settings?.scrollOnBranchChange ?? true;
|
||||||
|
scrollOnResponseGeneration = $settings?.scrollOnResponseGeneration ?? true;
|
||||||
showFilesOnTerminalSelect = $settings?.showFilesOnTerminalSelect ?? true;
|
showFilesOnTerminalSelect = $settings?.showFilesOnTerminalSelect ?? true;
|
||||||
|
|
||||||
temporaryChatByDefault = $settings?.temporaryChatByDefault ?? false;
|
temporaryChatByDefault = $settings?.temporaryChatByDefault ?? false;
|
||||||
@@ -929,6 +931,28 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class={settingRowClass}>
|
||||||
|
<div id="response-auto-scroll-label" class={settingLabelClass}>
|
||||||
|
{$i18n.t('Response Auto-Scroll')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class={settingControlClass}>
|
||||||
|
<Switch
|
||||||
|
ariaLabelledbyId="response-auto-scroll-label"
|
||||||
|
tooltip={true}
|
||||||
|
bind:state={scrollOnResponseGeneration}
|
||||||
|
on:change={() => {
|
||||||
|
saveSettings({ scrollOnResponseGeneration });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class={settingDescriptionClass}>
|
||||||
|
{$i18n.t('Follow assistant responses as they are generated.')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class={settingRowClass}>
|
<div class={settingRowClass}>
|
||||||
<div id="insert-suggestion-prompt-label" class={settingLabelClass}>
|
<div id="insert-suggestion-prompt-label" class={settingLabelClass}>
|
||||||
|
|||||||
@@ -259,8 +259,13 @@
|
|||||||
'pastelargetextasfile',
|
'pastelargetextasfile',
|
||||||
'reset background',
|
'reset background',
|
||||||
'resetbackground',
|
'resetbackground',
|
||||||
|
'disable auto scroll',
|
||||||
|
'disableautoscroll',
|
||||||
'response auto copy',
|
'response auto copy',
|
||||||
|
'response auto scroll',
|
||||||
|
'response auto-scroll',
|
||||||
'responseautocopy',
|
'responseautocopy',
|
||||||
|
'responseautoscroll',
|
||||||
'rich text input for chat',
|
'rich text input for chat',
|
||||||
'richtextinputforchat',
|
'richtextinputforchat',
|
||||||
'right to left',
|
'right to left',
|
||||||
|
|||||||
@@ -1257,6 +1257,7 @@
|
|||||||
"Format Markdown in previews and compact content surfaces.": "",
|
"Format Markdown in previews and compact content surfaces.": "",
|
||||||
"Format Markdown syntax in assistant responses.": "",
|
"Format Markdown syntax in assistant responses.": "",
|
||||||
"Format Markdown syntax in your own messages.": "",
|
"Format Markdown syntax in your own messages.": "",
|
||||||
|
"Follow assistant responses as they are generated.": "",
|
||||||
"Formatting may be inconsistent from source.": "",
|
"Formatting may be inconsistent from source.": "",
|
||||||
"Forward": "",
|
"Forward": "",
|
||||||
"Forwards system user OAuth access token to authenticate": "",
|
"Forwards system user OAuth access token to authenticate": "",
|
||||||
@@ -2177,6 +2178,7 @@
|
|||||||
"Reset Vector Storage/Knowledge": "",
|
"Reset Vector Storage/Knowledge": "",
|
||||||
"Reset view": "",
|
"Reset view": "",
|
||||||
"Response": "",
|
"Response": "",
|
||||||
|
"Response Auto-Scroll": "",
|
||||||
"Response notifications cannot be activated as the website permissions have been denied. Please visit your browser settings to grant the necessary access.": "",
|
"Response notifications cannot be activated as the website permissions have been denied. Please visit your browser settings to grant the necessary access.": "",
|
||||||
"Response Splitting": "",
|
"Response Splitting": "",
|
||||||
"Response Watermark": "",
|
"Response Watermark": "",
|
||||||
|
|||||||
@@ -1257,6 +1257,7 @@
|
|||||||
"Format Markdown in previews and compact content surfaces.": "",
|
"Format Markdown in previews and compact content surfaces.": "",
|
||||||
"Format Markdown syntax in assistant responses.": "",
|
"Format Markdown syntax in assistant responses.": "",
|
||||||
"Format Markdown syntax in your own messages.": "",
|
"Format Markdown syntax in your own messages.": "",
|
||||||
|
"Follow assistant responses as they are generated.": "",
|
||||||
"Formatting may be inconsistent from source.": "",
|
"Formatting may be inconsistent from source.": "",
|
||||||
"Forward": "",
|
"Forward": "",
|
||||||
"Forwards system user OAuth access token to authenticate": "",
|
"Forwards system user OAuth access token to authenticate": "",
|
||||||
@@ -2177,6 +2178,7 @@
|
|||||||
"Reset Vector Storage/Knowledge": "",
|
"Reset Vector Storage/Knowledge": "",
|
||||||
"Reset view": "",
|
"Reset view": "",
|
||||||
"Response": "",
|
"Response": "",
|
||||||
|
"Response Auto-Scroll": "",
|
||||||
"Response notifications cannot be activated as the website permissions have been denied. Please visit your browser settings to grant the necessary access.": "",
|
"Response notifications cannot be activated as the website permissions have been denied. Please visit your browser settings to grant the necessary access.": "",
|
||||||
"Response Splitting": "",
|
"Response Splitting": "",
|
||||||
"Response Watermark": "",
|
"Response Watermark": "",
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ type Settings = {
|
|||||||
iframeSandboxAllowForms?: boolean;
|
iframeSandboxAllowForms?: boolean;
|
||||||
iframeSandboxAllowSameOrigin?: boolean;
|
iframeSandboxAllowSameOrigin?: boolean;
|
||||||
scrollOnBranchChange?: boolean;
|
scrollOnBranchChange?: boolean;
|
||||||
|
scrollOnResponseGeneration?: boolean;
|
||||||
showFilesOnTerminalSelect?: boolean;
|
showFilesOnTerminalSelect?: boolean;
|
||||||
directConnections?: null;
|
directConnections?: null;
|
||||||
chatBubble?: boolean;
|
chatBubble?: boolean;
|
||||||
|
|||||||
Reference in new issue
Block a user