zhangxiao
2024-08-29 920ef65777ff78128b7a2021f2fe1223c6c0bd37
src/views/sessionManager/components/seniorAgentSession.vue
@@ -219,7 +219,7 @@
          />
        </template>
        <template #content>
          <a-spin :loading="onFileSelectedLoading" dot>
          <a-spin :loading="loading" dot style="width: 100%">
            <a-textarea
              readonly
              auto-size
@@ -283,7 +283,7 @@
        ></updataFile> -->
        <span v-if="getAent"></span>
        <uploadFile
          v-if="agentObj.id == 'excel_talk' || dialog_id == 'excel_talk'"
          v-if="!getAent"
          ref="fileInput"
          :sessionId="activeSessionId"
          @selectFileCallback="selectFileCallback"
@@ -596,6 +596,7 @@
        id: agentObj.id,
      }),
    });
    refreshScroll();
    const reader = response?.body
      ?.pipeThrough(new TextDecoderStream())
@@ -612,7 +613,11 @@
          const d = val?.data;
          if (typeof d !== 'boolean') {
            console.info('data:', d);
            streamStr.value = d.content;
            if (d?.content) {
              streamStr.value = d.content;
            } else {
              streamStr.value = d.code + d.sql;
            }
            startDisplayStr();
          }
        } catch (e) {
@@ -676,11 +681,9 @@
  const getAentId = (id) => {
    if (id == 'excel_talk') {
      console.log(1);
      getAent.value = false;
    }
    if (id == 'questions_talk') {
      console.log(2);
      getAent.value = true;
    }
  };
@@ -785,6 +788,11 @@
    try {
      loading.value = true;
      chatDis.value = true;
      let name = inputMsg.value;
      if (val) {
        name = val[0].name.split('.')[0];
      }
      if (!activeSessionId.value) {
        let message = [
@@ -792,15 +800,11 @@
            content: sessionDetailList.value[0].content,
            role: 'assistant',
          },
          {
            content: inputMsg.value,
            role: 'user',
          },
        ];
        const res = await agentConversationSetApi({
          id: '',
          app_id: agentObj.id,
          name: inputMsg.value,
          name: name,
          message: message,
        });
        // console.log(res, "res");
@@ -811,6 +815,7 @@
          if (!val) {
            startChat(inputMsg.value);
            inputMsg.value = '';
            uploaditemList.value = [];
          } else {
            loading.value = false;
            chatDis.value = false;
@@ -852,7 +857,7 @@
      const formData = new FormData();
      uploaditemList.value = resData;
      if (!activeSessionId.value) {
        await createSession(1);
        await createSession(resData);
      }
      onFileSelectedLoading.value = true;
@@ -963,7 +968,13 @@
            if (typeof d !== 'boolean') {
              console.info('data:', d);
              streamStr.value = d.content;
              if (d?.content) {
                streamStr.value = d.content;
              } else {
                streamStr.value = d.code;
              }
              startDisplayStr();
            }
          } catch (e) {
@@ -1044,6 +1055,7 @@
    if (timer) {
      clearTimeout(timer!);
    }
    const res = streamStr.value;
    // 将数组中的字符串拼接起来