Răsfoiți Sursa

fix:优化,修改点击历史记录,跳过欢迎页面,弹框的样式问题

hanyang 1 an în urmă
părinte
comite
cc8782a47d

+ 4 - 0
src/components/DeleteModal.vue

@@ -56,4 +56,8 @@ const handleCancel = () => {
   font-weight: 500;
   margin-left: 8px;
 }
+.arco-modal-container {
+  width: 100%;
+  margin: auto;
+}
 </style>

+ 0 - 1
src/modules/conversation-content/DialogWebPage.vue

@@ -48,7 +48,6 @@ const buttonText = computed(() => {
 });
 
 const mouseChange = (status) => {
-  console.log(props.answer_status, typeof props.answer_status);
   if (props.answer_status / 1 !== 2) {
     return;
   } else {

+ 3 - 2
src/modules/conversation-dialog/use-sse-chat.js

@@ -98,10 +98,10 @@ export default function useFetchEventSource() {
         Accept: 'text/event-stream',
         Connection: 'keep-alive'
       },
-      openWhenHidden: true,
+      // openWhenHidden: true,
       body: JSON.stringify(params),
       signal: abortController.signal, // 支持取消请求messages
-      // openWhenHidden: true, //页面退至后台后保持连接
+      openWhenHidden: true, //页面退至后台后保持连接
       onmessage(ev) {
         onMessage(ev);
       },
@@ -124,6 +124,7 @@ export default function useFetchEventSource() {
    */
   const stopStream = () => {
     abortController.abort();
+
     isLoading.value = false;
     isConnected.value = false;
     console.log('Stream aborted');

+ 4 - 0
src/modules/form-dynamic/BtnConfigDynamic copy.vue

@@ -71,4 +71,8 @@ const handleCancel = () => {
   width: 100%;
   height: 80vh;
 }
+.arco-modal-container {
+  width: 100%;
+  margin: auto;
+}
 </style>

+ 16 - 16
src/modules/form-dynamic/BtnConfigDynamic.vue

@@ -2,7 +2,6 @@
   <a-button @click="handleClick" class="chujuan-btn">
     <img class="chujuan-logo-img" :src="logo" /> {{ $t('wendangchujuan.dynamic_title') }}
   </a-button>
-
   <a-modal
     v-model:visible="visible"
     :mask-closable="false"
@@ -10,14 +9,13 @@
     :hide-cancel="is_init_model"
     :hide-ok="is_init_model"
     :mask="false"
+    :popup-container="chat_scrren_container"
     ref="modelVal"
-    modal-class="dynamicform-config-container-modal"
-    body-class="dynamicform-config-container-body"
+    modal-class="dynamicform-config-container-modal-1"
+    body-class="dynamicform-config-container-body-1"
     :body-style="bodyStyle"
   >
     <template #title> <img class="chujuan-logo-img" :src="logo" /> {{ $t('wendangchujuan.dynamic_title') }} </template>
-
-    <!-- <DynamicFormWraper ref="confForm" /> -->
     <DynamicFormBasic
       ref="confForm"
       :is_init_model="is_init_model"
@@ -59,6 +57,7 @@ const handleClick = () => {
     };
   }
 };
+const chat_scrren_container = ref(null);
 
 const toCancel = () => {
   visible.value = false;
@@ -91,36 +90,37 @@ onMounted(() => {
   margin-right: 5px;
 }
 </style>
+<style>
+/* .arco-modal-wrapper; */
 
-<style scoped>
-.dynamicform-config-container-modal.arco-modal {
-  width: 100%;
+.dynamicform-config-container-modal-1.arco-modal {
+  width: 40%;
   box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.3);
 }
-.dynamicform-config-container-body.arco-modal-body {
+.dynamicform-config-container-body-1.arco-modal-body {
   padding: 30px;
   max-height: 60vh;
   overflow-y: auto;
 }
-.dynamicform-config-container-body.arco-modal-body .chujuan-iframe {
+.dynamicform-config-container-body-1.arco-modal-body .chujuan-iframe {
   width: 100%;
   height: 80vh;
 }
-.dynamicform-config-container-modal.arco-modal .arco-modal-header {
+.dynamicform-config-container-modal-1.arco-modal .arco-modal-header {
   background-color: var(--color-fill-2);
 }
-.dynamicform-config-container-modal.arco-modal .arco-modal-header .arco-modal-title {
+.dynamicform-config-container-modal-1.arco-modal .arco-modal-header .arco-modal-title {
   justify-content: flex-start;
 }
-.dynamicform-config-container-modal.arco-modal .arco-modal-footer .arco-btn {
+.dynamicform-config-container-modal-1.arco-modal .arco-modal-footer .arco-btn {
   display: none;
 }
 .arco-modal-container {
-  width: 40%;
-  margin: auto;
+  z-index: 1 !important;
+  height: calc(100% - 60px) !important;
+  top: 60px !important;
 }
 .arco-modal-wrapper.arco-modal-wrapper-align-center .arco-modal {
   top: -5vh;
 }
-/* .arco-modal-wrapper; */
 </style>

+ 2 - 1
src/views/ConversationHistory.vue

@@ -43,7 +43,8 @@ const content_style = computed(() => {
 
 const handleHistoryActive = ({ target_id, agent_id }) => {
   const query = {
-    session: target_id
+    session: target_id,
+    history: 'history'
   };
   if (agent_id) {
     query.agent = agent_id;

+ 8 - 0
src/views/ConversationQA.vue

@@ -9,6 +9,7 @@
           :agent_id="chat_agent"
           :CHAT_AGENT_INFOMATION="CHAT_AGENT_INFOMATION"
           :session_id="chat_session"
+          :chat_history="chat_history"
           :key="chat_key"
           :conversation_params="conversation_params"
           @updateSessionId="updateSessionId"
@@ -73,6 +74,7 @@ const allAgent = useAllAgentStore();
 
 const chat_agent = ref('');
 const chat_session = ref('');
+const chat_history = ref('');
 
 const conversation_chat_container = ref(null);
 
@@ -218,9 +220,13 @@ const newChat = async () => {
 watch(
   () => route,
   (val) => {
+    console.log(route);
     if (route.query.chat) {
+      chat_history.value = '';
       newChat();
     }
+
+    chat_history.value = route.query.history || '';
   },
   {
     deep: true,
@@ -297,10 +303,12 @@ async function init() {
  * 监听路由参数的变化
  */
 onBeforeRouteUpdate(async (to, from) => {
+  console.log(to.query);
   if (to.path === '/chat' || to.path === '/chat/qa') {
     if (!to.query.session) {
       chat_session.value = null;
     }
+
     // if (!to.query.agent) {
     //   const default_agent_id = await getDefaultAgentId();
 

+ 10 - 3
src/views/conversation/ConversationChatContainer.vue

@@ -202,6 +202,7 @@ const props = defineProps({
    * 如果有此参数,则意味着获取该对话的记录内容
    */
   session_id: String,
+  chat_history: String,
   /**
    * 动态表单数据
    * 根据智能体的agent_id 获取到动态表单数据
@@ -1329,6 +1330,7 @@ const sseOnMessage = (ev) => {
   if (res_data.message_id) {
     minMap_messageId.value = res_data.message_id;
   }
+  console.log(res_data);
 
   //sse流式结束
   if (res_data.event === 'message_end') {
@@ -1559,10 +1561,15 @@ onMounted(() => {
    * 如果选择智能体,则不显示欢迎页面
    *
    */
-  if (!agent_id && !session_id) {
-    show_welcome.value = true;
-  } else {
+  if (props.chat_history) {
     show_welcome.value = false;
+    console.log(11111111111111111111);
+  } else {
+    if (!agent_id && !session_id) {
+      show_welcome.value = true;
+    } else {
+      show_welcome.value = false;
+    }
   }
 
   // 组件挂载