mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 05:45:19 +00:00
refac
This commit is contained in:
parent
feaf434d4e
commit
b612af29e9
1 changed files with 18 additions and 1 deletions
|
|
@ -152,7 +152,24 @@
|
||||||
chatInputElement.focus();
|
chatInputElement.focus();
|
||||||
chatInputElement.dispatchEvent(new Event('input'));
|
chatInputElement.dispatchEvent(new Event('input'));
|
||||||
|
|
||||||
chatInputElement.scrollTop = chatInputElement.scrollHeight;
|
const words = extractCurlyBraceWords(prompt);
|
||||||
|
|
||||||
|
if (words.length > 0) {
|
||||||
|
const word = words.at(0);
|
||||||
|
const fullPrompt = prompt;
|
||||||
|
|
||||||
|
prompt = prompt.substring(0, word?.endIndex + 1);
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
chatInputElement.scrollTop = chatInputElement.scrollHeight;
|
||||||
|
|
||||||
|
prompt = fullPrompt;
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
chatInputElement.setSelectionRange(word?.startIndex, word.endIndex + 1);
|
||||||
|
} else {
|
||||||
|
chatInputElement.scrollTop = chatInputElement.scrollHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue