|
|
@@ -1,17 +1,17 @@
|
|
|
<template>
|
|
|
- <footer class="wendangbaogaoshengcheng-footer" v-if="start_status !== 3">
|
|
|
+ <footer class="wendangbaogaoshengcheng-footer" v-if="show_doc_rpt_footer">
|
|
|
<div class="upload-footer" v-show="doc_form_show">
|
|
|
<div v-if="act_type === 3" class="form-fold-btn" @click="handleFormFold">
|
|
|
<icon-menu-fold :size="20" />
|
|
|
</div>
|
|
|
|
|
|
- <ActionTypeRadio @change="handleRadioChange"/>
|
|
|
+ <ActionTypeRadio @change="handleRadioChange" />
|
|
|
|
|
|
<div class="vertical-placeholder"></div>
|
|
|
|
|
|
- <TextInputType1 v-if="act_type === 1" @change="handleTextChange"/>
|
|
|
- <TextInputType2 v-if="act_type === 2" @change="handleTextChange"/>
|
|
|
- <TextInputType3 v-if="act_type === 3" @change="handleTextChange"/>
|
|
|
+ <TextInputType1 v-if="act_type === 1" @change="handleTextChange" />
|
|
|
+ <TextInputType2 v-if="act_type === 2" @change="handleTextChange" />
|
|
|
+ <TextInputType3 v-if="act_type === 3" @change="handleTextChange" />
|
|
|
|
|
|
<div class="vertical-placeholder"></div>
|
|
|
|
|
|
@@ -61,7 +61,7 @@
|
|
|
<icon-menu-fold :size="20" />
|
|
|
</div>
|
|
|
|
|
|
- <message-input :readonly="readonly" eventName="open-dialog" />
|
|
|
+ <MessageInputV2 :readonly="readonly" @message="handleChatMessageUpdate" />
|
|
|
</div>
|
|
|
</template>
|
|
|
</footer>
|
|
|
@@ -70,13 +70,17 @@
|
|
|
import { ref, inject, computed } from "vue";
|
|
|
import { Message } from '@arco-design/web-vue';
|
|
|
|
|
|
-import MessageInput from "./MessageInput.vue";
|
|
|
+import MessageInputV2 from "./MessageInputV2.vue";
|
|
|
|
|
|
import ActionTypeRadio from './document-report/ActionTypeRadio.vue'
|
|
|
import TextInputType1 from './document-report/TextInputType1.vue'
|
|
|
import TextInputType2 from './document-report/TextInputType2.vue'
|
|
|
import TextInputType3 from './document-report/TextInputType3.vue'
|
|
|
|
|
|
+/**
|
|
|
+ * 与此组件有关的对话参数的文档可查看此文件同目录下的 DocumentReportFooter.md 文件
|
|
|
+ */
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
agentId: String,
|
|
|
|
|
|
@@ -94,6 +98,30 @@ const { config, helper, ajax } = inject("$global");
|
|
|
const act_type = ref(1);
|
|
|
const text_title = ref(""); // 单行文本:标题
|
|
|
const text_description = ref(""); // 多行文本:描述
|
|
|
+const chat_message = ref(''); // 对话输入框的消息
|
|
|
+
|
|
|
+/**
|
|
|
+ * 是否是第一次 小标题生成
|
|
|
+ */
|
|
|
+const is_first_generate = ref(true);
|
|
|
+
|
|
|
+const show_doc_rpt_footer = computed(() => {
|
|
|
+ /**
|
|
|
+ * 当文档报告功能为 小标题生成 时,底部一只存在,表单区域可以折叠
|
|
|
+ */
|
|
|
+ if (act_type.value === 3) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 当文档报告功能为 1 或者 2 时,依据api调用状态判断是否显示
|
|
|
+ */
|
|
|
+ if (start_status.value !== 3) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+});
|
|
|
|
|
|
/**
|
|
|
* 文本输入区域变化事件
|
|
|
@@ -153,6 +181,17 @@ const handleInputChange = (value) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 对话消息
|
|
|
+ * 当此事件触发,意味着新一轮对话的开始
|
|
|
+ * @param msg
|
|
|
+ */
|
|
|
+const handleChatMessageUpdate = (msg) => {
|
|
|
+ chat_message.value = msg;
|
|
|
+
|
|
|
+ handleStart();
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 文件数据变化
|
|
|
* @param fileList
|
|
|
@@ -189,28 +228,24 @@ const showMsg = (msg) => {
|
|
|
*/
|
|
|
const handleStart = async () => {
|
|
|
const action_type = act_type.value; // 操作类型
|
|
|
- const title = text_title.value; // 标题
|
|
|
+ let title = text_title.value; // 标题
|
|
|
const f_list = file_list.value;
|
|
|
|
|
|
if (!action_type) {
|
|
|
- // Message.error({ content: '请选择类型', position: 'bottom' });
|
|
|
showMsg('请选择类型');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!title) {
|
|
|
- // Message.error({ content: '请填写标题', position: 'bottom' });
|
|
|
showMsg('请填写标题');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (f_list.length === 0) {
|
|
|
- // Message.error({ content: '请选择文件', position: 'bottom' });
|
|
|
showMsg('请选择文件');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
const agent_id = props.agentId;
|
|
|
|
|
|
try {
|
|
|
@@ -244,17 +279,93 @@ const handleStart = async () => {
|
|
|
const file_id_list = files_info.map(item => item.id);
|
|
|
// console.log(file_id_list, '文件ID值');
|
|
|
|
|
|
- // 保存小数绘图数据
|
|
|
- helper.write('sendData', {
|
|
|
+ let tempLocalStoreData = {
|
|
|
name: '文档报告生成',
|
|
|
|
|
|
agent_id: agent_id,
|
|
|
// chat_id: chat_id,
|
|
|
|
|
|
+ workflow: action_type,
|
|
|
+
|
|
|
upload_files: file_id_list,
|
|
|
title: title,
|
|
|
- workflow: action_type,
|
|
|
- });
|
|
|
+ /**
|
|
|
+ * 当workflow值为2或者3时,存在sub_title参数值
|
|
|
+ */
|
|
|
+ sub_titles: text_description.value,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (action_type === 1) {
|
|
|
+ // 文档清洗
|
|
|
+ tempLocalStoreData = {
|
|
|
+ name: '文档报告生成',
|
|
|
+
|
|
|
+ agent_id: agent_id,
|
|
|
+ // chat_id: chat_id,
|
|
|
+
|
|
|
+ workflow: action_type,
|
|
|
+
|
|
|
+ upload_files: file_id_list,
|
|
|
+ title: title,
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (action_type === 2) {
|
|
|
+ // 报告生成
|
|
|
+ tempLocalStoreData = {
|
|
|
+ name: '文档报告生成',
|
|
|
+
|
|
|
+ agent_id: agent_id,
|
|
|
+ // chat_id: chat_id,
|
|
|
+
|
|
|
+ workflow: action_type,
|
|
|
+
|
|
|
+ upload_files: file_id_list,
|
|
|
+ title: title,
|
|
|
+ /**
|
|
|
+ * 当workflow值为2或者3时,存在sub_title参数值
|
|
|
+ */
|
|
|
+ sub_titles: text_description.value,
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (action_type === 3) {
|
|
|
+ title = chat_message.value;
|
|
|
+
|
|
|
+ // 判断是第一次还是后续多轮文化
|
|
|
+ // 小标题生成
|
|
|
+ tempLocalStoreData = {
|
|
|
+ name: '文档报告生成',
|
|
|
+
|
|
|
+ agent_id: agent_id,
|
|
|
+ // chat_id: chat_id,
|
|
|
+
|
|
|
+ workflow: action_type,
|
|
|
+
|
|
|
+ upload_files: file_id_list,
|
|
|
+ title: title, // 此参数可以为空
|
|
|
+ title_number: text_title.value, // 小标题数量,默认值
|
|
|
+ title_style: text_description.value,
|
|
|
+ title_query: chat_message.value,
|
|
|
+
|
|
|
+ // // 增加一个is_first参数,如果值为1,表示第一次
|
|
|
+ // // 如果值为0,表示后续多轮对话
|
|
|
+ // is_first: 1,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (is_first_generate.value) {
|
|
|
+ // 小标题生成
|
|
|
+ tempLocalStoreData.is_first = 1;
|
|
|
+
|
|
|
+ is_first_generate.value = false;
|
|
|
+ } else {
|
|
|
+ tempLocalStoreData.is_first = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存小数绘图数据
|
|
|
+ helper.write('sendData', tempLocalStoreData);
|
|
|
|
|
|
// helper.$bus.emit('send-message', {
|
|
|
// upload_files: file_id_list,
|
|
|
@@ -265,7 +376,6 @@ const handleStart = async () => {
|
|
|
// helper.$bus.emit('send-message', title);
|
|
|
helper.$bus.emit('open-dialog', title);
|
|
|
|
|
|
-
|
|
|
// 上传成功
|
|
|
start_status.value = 3;
|
|
|
start_message.value = 'success';
|