diff --git a/front/components/assistant/conversation/InputBar.tsx b/front/components/assistant/conversation/InputBar.tsx index ced676e5d8c3..5bb91f88d792 100644 --- a/front/components/assistant/conversation/InputBar.tsx +++ b/front/components/assistant/conversation/InputBar.tsx @@ -374,7 +374,7 @@ export function AssistantInputBar({
{ + const element = inputRef.current; + if (element) { + element.scrollTop = element.scrollHeight; + } + }, 0); } + + // Move the cursor to the end of the paste. + const newRange = document.createRange(); + newRange.setStart(node, offset + text.length); + newRange.setEnd(node, offset + text.length); + selection.removeAllRanges(); + selection.addRange(newRange); }} onKeyDown={(e) => { // We prevent the content editable from creating italics, bold and underline. @@ -687,38 +702,45 @@ export function AssistantInputBar({ }} >
-
-
- { - // We construct the HTML for an AgentMention and inject it in the content - // editable with an extra space after it. - const mentionNode = getAgentMentionNode(c); - const contentEditable = - document.getElementById("dust-input-bar"); - if (contentEditable && mentionNode) { - // Add mentionNode as last childe of contentEditable. - contentEditable.appendChild(mentionNode); - const afterTextNode = document.createTextNode(" "); - contentEditable.appendChild(afterTextNode); - contentEditable.focus(); - moveCursorToEnd(contentEditable); - } - }} - assistants={activeAgents} - showBuilderButtons={true} - /> +
+
+
+ { + // We construct the HTML for an AgentMention and inject it in the content + // editable with an extra space after it. + const mentionNode = getAgentMentionNode(c); + const contentEditable = + document.getElementById("dust-input-bar"); + if (contentEditable && mentionNode) { + // Add mentionNode as last childe of contentEditable. + contentEditable.appendChild(mentionNode); + const afterTextNode = document.createTextNode(" "); + contentEditable.appendChild(afterTextNode); + contentEditable.focus(); + moveCursorToEnd(contentEditable); + } + }} + assistants={activeAgents} + showBuilderButtons={true} + /> + + { + void handleSubmit(); + }} + /> +
- { - void handleSubmit(); - }} - />
diff --git a/front/package-lock.json b/front/package-lock.json index 96efb89b2587..327c9b7db419 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -65,6 +65,7 @@ "sqlite3": "^5.1.4", "sse.js": "^0.6.1", "swr": "^2.0.2", + "tailwind-scrollbar-hide": "^1.1.7", "tailwindcss": "^3.2.4", "three": "^0.155.0", "uuid": "^9.0.0" @@ -12178,6 +12179,11 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/tailwind-scrollbar-hide": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/tailwind-scrollbar-hide/-/tailwind-scrollbar-hide-1.1.7.tgz", + "integrity": "sha512-X324n9OtpTmOMqEgDUEA/RgLrNfBF/jwJdctaPZDzB3mppxJk7TLIDmOreEDm1Bq4R9LSPu4Epf8VSdovNU+iA==" + }, "node_modules/tailwindcss": { "version": "3.3.3", "license": "MIT", diff --git a/front/package.json b/front/package.json index 16f4fcdcd0c1..14607ae70021 100644 --- a/front/package.json +++ b/front/package.json @@ -73,6 +73,7 @@ "sqlite3": "^5.1.4", "sse.js": "^0.6.1", "swr": "^2.0.2", + "tailwind-scrollbar-hide": "^1.1.7", "tailwindcss": "^3.2.4", "three": "^0.155.0", "uuid": "^9.0.0" diff --git a/front/tailwind.config.js b/front/tailwind.config.js index f821b9e57255..ed020c356363 100644 --- a/front/tailwind.config.js +++ b/front/tailwind.config.js @@ -161,7 +161,7 @@ module.exports = { backgroundColor: ["dark"], }, }, - plugins: [require("@tailwindcss/forms")], + plugins: [require("@tailwindcss/forms"), require("tailwind-scrollbar-hide")], content: [ "./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}",