Browse Source

添加ai对话框

xiaoguang_li 1 month ago
parent
commit
4f4937b75e
1 changed files with 6 additions and 3 deletions
  1. 6 3
      desktop/core/src/desktop/templates/assist.mako

+ 6 - 3
desktop/core/src/desktop/templates/assist.mako

@@ -2862,13 +2862,13 @@ from desktop.views import _ko
         let self = this;
         if (event.key === 'Enter' || event.keyCode === 13) {
           event.preventDefault();
-          self.answer();
+          self.answer(data, event);
           return false;
         }
         return true;
       };
 
-      ChatPanel.prototype.answer = function () {
+      ChatPanel.prototype.answer = function (data, event) {
         let self = this;
         if (self.query().trim() === '') {
             return
@@ -2877,6 +2877,9 @@ from desktop.views import _ko
         self.messages.push({type:'ai', content: '感谢提问!我已经收到你的消息:' + self.query().trim()});
 
         self.query('');
+
+        // 清空输入框后 调用 autoResize
+        self.autoResize(data, event);
       };
 
       ChatPanel.prototype.initFunctions = function (dialect) {
@@ -2887,7 +2890,7 @@ from desktop.views import _ko
       ChatPanel.prototype.autoResize = function (data, event) {
         let inputArea = event.target;
         inputArea.style.height = 'auto';
-        inputArea.style.height = inputArea.scrollHeight -23 + 'px';
+        inputArea.style.height = inputArea.scrollHeight -20 + 'px';
       };
 
       // 滚动到底部函数