|
@@ -152,7 +152,24 @@
|
|
|
chatInputElement.focus();
|
|
|
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>
|