|
|
@@ -1,13 +1,9 @@
|
|
|
<template>
|
|
|
<div class="conversation-chat-container">
|
|
|
<div class="conversation-chat-main" ref="chat_scrren_container">
|
|
|
- <DialogHeader
|
|
|
- class="conversation-chat-header"
|
|
|
- :agent_info="CHAT_AGENT_INFOMATION"
|
|
|
- :style="{ height: header_height + 'px' }"
|
|
|
- />
|
|
|
+ <DialogHeader class="conversation-chat-header" :agent_info="CHAT_AGENT_INFOMATION" :style="style_header" />
|
|
|
|
|
|
- <div class="conversation-chat-content" :style="{ height: chat_height - 30 - 30 + 'px' }">
|
|
|
+ <div class="conversation-chat-content" :style="style_body">
|
|
|
<div class="conversation-chat-main-container">
|
|
|
<template v-if="show_welcome">
|
|
|
<!-- 有会话ID 获取历史记录,显示加载中状态 -->
|
|
|
@@ -48,6 +44,7 @@
|
|
|
class="conversation-chat-input"
|
|
|
:style="input_style"
|
|
|
:disabled="input_disabled"
|
|
|
+ :enable_text_input="enable_text_input"
|
|
|
:enable_file_upload="enable_file_upload"
|
|
|
:file_accept="file_accept"
|
|
|
@sizeChange="handleInputSizeChange"
|
|
|
@@ -66,35 +63,26 @@
|
|
|
</DialogInput>
|
|
|
</div>
|
|
|
|
|
|
- <DialogFooter class="conversation-chat-footer" :style="{ height: footer_height + 'px' }" />
|
|
|
+ <DialogFooter class="conversation-chat-footer" :style="style_footer" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, getCurrentInstance, onMounted, onUnmounted, computed, nextTick } from 'vue';
|
|
|
+import { ref, onMounted, onUnmounted, computed, nextTick } from 'vue';
|
|
|
import { Message } from '@arco-design/web-vue';
|
|
|
|
|
|
-import { jsonParse, jsonStringify } from '../../utils/utils';
|
|
|
+import { jsonStringify } from '../../utils/utils';
|
|
|
|
|
|
-import DialogAsideLeft from '../../modules/conversation-chat/DialogAsideLeft.vue';
|
|
|
import DialogHeader from '../../modules/conversation-chat/DialogHeader.vue';
|
|
|
import DialogWelcome from '../../modules/conversation-chat/DialogWelcome.vue';
|
|
|
import DialogList from '../../modules/conversation-chat/DialogList.vue';
|
|
|
import DialogInput from '../../modules/conversation-chat/DialogInput.vue';
|
|
|
import DialogInputTop from '../../modules/conversation-chat/DialogInputTop.vue';
|
|
|
import DialogFooter from '../../modules/conversation-chat/DialogFooter.vue';
|
|
|
-import DialogAsideRight from '../../modules/conversation-chat/DialogAsideRight.vue';
|
|
|
|
|
|
import useWebSocketChat from '../../modules/conversation-dialog/use-websocket-chat';
|
|
|
-import {
|
|
|
- getHistoryLogs,
|
|
|
- getDialogChatId,
|
|
|
- uploadFiles,
|
|
|
- uploadCombineExcelFiles,
|
|
|
- uploadFileByAgentInfo
|
|
|
-} from '../../modules/conversation-dialog/api-dialog';
|
|
|
-import { files2Formdata } from '../../modules/file-preview/files-2-formdata';
|
|
|
+import { getHistoryLogs, getDialogChatId, uploadFileByAgentInfo } from '../../modules/conversation-dialog/api-dialog';
|
|
|
|
|
|
import formatDialogSendOptions from '../../modules/conversation-dialog/format-dialog-send-options';
|
|
|
|
|
|
@@ -106,7 +94,6 @@ import formatDialogAnswerForException from '../../modules/conversation-dialog/fo
|
|
|
import formatDialogAnswerFromWebsocketReceiveMessage from '../../modules/conversation-dialog/format-dialog-answer-from-websocket_receive_message';
|
|
|
|
|
|
import useEleSizeV1 from '../../utils/use-ele-size-v1';
|
|
|
-import useEleSizeV2 from '../../utils/use-ele-size-v2';
|
|
|
import useInputClear from './use-input-clear';
|
|
|
import useInputGetOptions from './use-input-get-options';
|
|
|
import useScroll2Bottom from './use-scroll-bottom';
|
|
|
@@ -171,6 +158,16 @@ const input_style = computed(() => {
|
|
|
};
|
|
|
});
|
|
|
|
|
|
+const style_header = computed(() => {
|
|
|
+ return { height: header_height + 'px' };
|
|
|
+});
|
|
|
+const style_body = computed(() => {
|
|
|
+ return { height: chat_height - 30 - 30 + 'px' };
|
|
|
+});
|
|
|
+const style_footer = computed(() => {
|
|
|
+ return { height: footer_height + 'px' };
|
|
|
+});
|
|
|
+
|
|
|
// ------------------------------------------------------------------
|
|
|
// ------------------------------------------------------------------
|
|
|
// ------------------------------------------------------------------
|
|
|
@@ -240,7 +237,7 @@ const current_menu_id = computed(() => {
|
|
|
const show_welcome = ref(true);
|
|
|
|
|
|
/**
|
|
|
- * 表单区域:是否显示附件参数表单
|
|
|
+ * 表单区域:是否显示附加参数表单
|
|
|
* 文档报告场景下需要显示此组件
|
|
|
*/
|
|
|
const show_input_others_opts = computed(() => {
|
|
|
@@ -257,8 +254,47 @@ const show_input_others_opts = computed(() => {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
+/**
|
|
|
+ * 是否支持文本输入
|
|
|
+ * 返回 true,输入区域将不存在文本输入框
|
|
|
+ * 返回 false,输入区域将可以进行文本输入
|
|
|
+ */
|
|
|
+const enable_text_input = computed(() => {
|
|
|
+ const menu_id = current_menu_id.value;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 1 报表合并:上传几个文档,进行合并 允许 .xlsx
|
|
|
+ * 无需输入
|
|
|
+ */
|
|
|
+ if (menu_id === 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+});
|
|
|
+
|
|
|
+/**
|
|
|
+ * 默认的文本值
|
|
|
+ */
|
|
|
+const default_text_value = computed(() => {
|
|
|
+ const menu_id = current_menu_id.value;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 某些情况下,无需输入文本
|
|
|
+ * 但是在对话部分,需要展示用户的提问,此时可以给一个默认的文本值
|
|
|
+ * 例如在报表合并情况下,仅需要上传文件,不需要输入文字
|
|
|
+ */
|
|
|
+ if (menu_id === 1) {
|
|
|
+ return '合并Excel';
|
|
|
+ }
|
|
|
+
|
|
|
+ return '';
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* 表单区域:是否允许文件上传
|
|
|
+ * 返回 ture,输入区域将会有文件上传按钮
|
|
|
+ * 返回 false,输入区域将没有文件上传按钮
|
|
|
*/
|
|
|
const enable_file_upload = computed(() => {
|
|
|
const menu_id = current_menu_id.value;
|
|
|
@@ -277,7 +313,7 @@ const enable_file_upload = computed(() => {
|
|
|
return false;
|
|
|
});
|
|
|
/**
|
|
|
- * 表单区域:是否允许文件上传的类型
|
|
|
+ * 表单区域:文件上传允许的文件类型
|
|
|
* 对应表单参数的 accept
|
|
|
*/
|
|
|
const file_accept = computed(() => {
|
|
|
@@ -290,7 +326,6 @@ const file_accept = computed(() => {
|
|
|
* 6 小数绘图:上传图片,描述图片的内容 允许 .png/jpg/jpeg
|
|
|
* 9 文档报告: 允许 .docx
|
|
|
*/
|
|
|
-
|
|
|
if (menu_id === 1) {
|
|
|
return '.xlsx';
|
|
|
}
|
|
|
@@ -394,13 +429,17 @@ const handleInputSizeChange = (size) => {
|
|
|
* 4. 接收 socket 返回的数据项
|
|
|
*/
|
|
|
const handleInputSubmit = async (options) => {
|
|
|
- const ask_text = options.text; // 文本
|
|
|
+ let ask_text = options.text; // 文本
|
|
|
const ask_files = options.files; // 文件列表
|
|
|
|
|
|
// TODO: 内容检查,如果文本内容不合法,则不允许发送
|
|
|
- if (!ask_text) {
|
|
|
- handleErrorMessage('请输入文字');
|
|
|
- return;
|
|
|
+ if (enable_text_input.value) {
|
|
|
+ if (!ask_text) {
|
|
|
+ handleErrorMessage('请输入文字');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ask_text = default_text_value.value;
|
|
|
}
|
|
|
|
|
|
// --------------------------------------------
|