CzRger 1 vecka sedan
förälder
incheckning
adde8520dd

+ 7 - 5
src/views/smart-ask-answer/assistant-2/chat.vue

@@ -114,9 +114,6 @@ const onSend = (text = '') => {
       content: state.params.query + ''
     }
     state.chats.push(ask)
-    const floatingDiv = ref_auto.value
-    floatingDiv.style.visibility = 'hidden';
-    floatingDiv.style.display = 'flex';
     const answer = reactive({
       type: 'answer',
       content: '',
@@ -125,6 +122,9 @@ const onSend = (text = '') => {
     })
     state.chats.push(answer)
     scrollToEnd()
+    const floatingDiv = ref_auto.value
+    floatingDiv.style.visibility = 'hidden';
+    floatingDiv.style.display = 'flex';
     ssePost(`/installed-apps/${window.czrConfig.dify.appId}/chat-messages`, {
       body: state.params,
     }, {
@@ -334,8 +334,10 @@ const initTextHandle = () => {
       state.autoList = res?.data?.list.map(v => v.title) || []
       if (state.autoList.length > 0) {
         setTimeout(() => {
-          floatingDiv.style.top = (-floatingDiv.clientHeight - 2 - 20) + 'px';
-          floatingDiv.style.visibility = 'visible';
+          if (state.text) {
+            floatingDiv.style.top = (-floatingDiv.clientHeight - 2 - 20) + 'px';
+            floatingDiv.style.visibility = 'visible';
+          }
         }, 10)
       }
     })

+ 8 - 3
src/views/smart-ask-answer/assistant/chat.vue

@@ -122,6 +122,9 @@ const onSend = (text = '') => {
     })
     state.chats.push(answer)
     scrollToEnd()
+    const floatingDiv = ref_auto.value
+    floatingDiv.style.visibility = 'hidden';
+    floatingDiv.style.display = 'flex';
     ssePost(`/installed-apps/${window.czrConfig.dify.appId}/chat-messages`, {
       body: state.params,
     }, {
@@ -269,7 +272,7 @@ const onNormal = (item) => {
 }
 const initTextHandle = () => {
   let debounceTimer;
-  const DEBOUNCE_TIME = 300;
+  const DEBOUNCE_TIME = 500;
   const textarea = ref_text.value
   const floatingDiv = ref_auto.value
 
@@ -331,8 +334,10 @@ const initTextHandle = () => {
       state.autoList = res?.data?.list.map(v => v.title) || []
       if (state.autoList.length > 0) {
         setTimeout(() => {
-          floatingDiv.style.top = (-floatingDiv.clientHeight - 2 - 20) + 'px';
-          floatingDiv.style.visibility = 'visible';
+          if (state.text) {
+            floatingDiv.style.top = (-floatingDiv.clientHeight - 2 - 20) + 'px';
+            floatingDiv.style.visibility = 'visible';
+          }
         }, 10)
       }
     })