浏览代码

【功能】联调ccd

xcbosa mbp16 9 月之前
父节点
当前提交
dcd24f4814
共有 1 个文件被更改,包括 39 次插入5 次删除
  1. 39 5
      src/components/CCDChatSystem.vue

+ 39 - 5
src/components/CCDChatSystem.vue

@@ -1,7 +1,7 @@
 <template>
   <view-full-screen :is-full-screen="true"  class="right">
     <div :class="bodyClass">
-      <div ref="scrollView" class="chatBubbleContainer" :style="{ 'height': 'calc(100% - ' + (52 + safeAreaInsets.bottom) + 'px)' }">
+      <div ref="scrollView" class="chatBubbleContainer" :style="{ 'height': 'calc(100% - ' + (environmentInfo.hasInputBar ? (52 + safeAreaInsets.bottom) : 0) + 'px)' }">
         <template v-if="environmentInfo.hasTopTitle">
          <CCDTitleCell :title="botInfo.botName" :image="botInfo.botIcon"></CCDTitleCell>
         </template>
@@ -11,7 +11,7 @@
         </template>
         <div style="height: 30px; display: table-row; width: 100%; float: left"></div>
       </div>
-      <div class="bottomAskBar" style="height: 50px; padding-right: 4px" :hidden="!enableInput">
+      <div v-if="environmentInfo.hasInputBar" class="bottomAskBar" style="height: 50px; padding-right: 4px" :hidden="!enableInput">
         <div style="height: 50px; width: calc(100% - 50px);">
           <input :style="{
             marginTop: isHostInApp ? '-4px' : '0px'
@@ -156,7 +156,9 @@ export default {
           markdown: "",
           prompt: "",
           exists: false
-        }
+        },
+        hasInputBar: true,
+        variant: "none"
       },
       allowInput: true,
       model: [
@@ -173,7 +175,8 @@ export default {
       inAppPendingCard: null,
       inAppSSEHandle: null,
       abortController: null,
-      enableInput: true
+      enableInput: true,
+      hasSuccessRequest: false
     }
   },
   mounted() {
@@ -181,7 +184,8 @@ export default {
     self.botInfo.botId = self.$route.params.botId
     if (!isNil(xcwk)) {
       self.environmentInfo.hasTopTitle = boolValue(nilDefault(self.$route.query.hasTopTitle, true))
-      console.log("!!!!!XC" + self.$route.query.askFirst)
+      self.environmentInfo.hasInputBar = boolValue(nilDefault(self.$route.query.hasInputBar, true))
+      self.environmentInfo.variant = nilDefault(self.$route.query.variant, "none")
       if (self.$route.query.askFirst) {
         self.environmentInfo.askFirst = JSON.parse(self.$route.query.askFirst)
         self.environmentInfo.askFirst.exists = !isNilOrEmpty(self.environmentInfo.askFirst.markdown) && !isNilOrEmpty(self.environmentInfo.askFirst.prompt)
@@ -217,6 +221,22 @@ export default {
             self.doubleSelectTabBar(params.dict)
           }
         }
+        else if (key == "ailc.forceStop") {
+          self.doShutdownManually()
+        }
+        else if (key == "ailc.sendMessage") {
+          self.startCompletionWithMessage(params.dict.message)
+        }
+        else if (key == "fe.loginStatusChanged") {
+          if (!self.hasSuccessRequest) {
+            if (params.dict.status) {
+              if (self.environmentInfo.askFirst.exists) {
+                self.model = []
+                self.startCompletionWithMarkdownAndPrompt(self.environmentInfo.askFirst.markdown, self.environmentInfo.askFirst.prompt)
+              }
+            }
+          }
+        }
       })
       xcwk.std.isLogin({ }, function (params) {
         if (!params.isLogin) {
@@ -455,7 +475,13 @@ export default {
         }
       }, function (params) {
         self.inAppSSEHandle = params.sseId
+        self.hasSuccessRequest = true
         IntentManager.llmResponseBegin()
+        if (!isNil(xcwk.ailc)) {
+          xcwk.ailc.markAnswerOutputing({
+            "output" : true
+          })
+        }
       })
     },
     doInAppSSE_ReceiveMessage(message) {
@@ -519,6 +545,9 @@ export default {
           //     id--;
           //   }
           // }
+          xcwk.ailc.markAnswerOutputing({
+            "output" : false
+          })
           break
         }
       }
@@ -641,6 +670,11 @@ export default {
         self.allowInput = true
         self.abortController = null
         self.inAppPendingCard = null
+        if (!isNil(xcwk.ailc)) {
+          xcwk.ailc.markAnswerOutputing({
+            "output" : false
+          })
+        }
         // for (let id = 0; id < self.model.length; id++) {
         //   if (self.model[id].type == "answerTyping") {
         //     self.model.splice(id, 1)