ソースを参照

feat: 根据需求重新调整一些文档报告的功能

zhupei 1 年間 前
コミット
cdf39ec391

+ 12 - 13
src/components/DialogWrap.vue

@@ -173,11 +173,11 @@
                         </p>
                         <p v-else></p>
                         <div v-if="chat_type !== 'huitu'">
-                            <a-tooltip content="重新生成">
+                            <!-- <a-tooltip content="重新生成">
                                 <p @click="reQuestion(item.question)" :class="[readonly ? 'disabled' : '']">
                                     <img src="@/assets/icons/refresh.png" width="15" />
                                 </p>
-                            </a-tooltip>
+                            </a-tooltip> -->
 
                             <a-tooltip content="复制">
                                 <p @click="copyAnswer(item.answer)" :class="[readonly ? 'disabled' : '']">
@@ -186,7 +186,7 @@
                             </a-tooltip>
 
 
-                            <a-tooltip content="收藏">
+                            <!-- <a-tooltip content="收藏">
                                 <p @click="saveAnswer(key)" :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
                                     <img src="@/assets/icons/star-full.png" width="15" v-if="menuList[key]?.save" />
                                     <img src="@/assets/icons/star.png" width="15" v-else />
@@ -206,7 +206,7 @@
                                 <p :class="[readonly ? 'disabled' : '']" v-if="!isSetting">
                                     <img src="@/assets/icons/share.png" width="15" />
                                 </p>
-                            </a-tooltip>
+                            </a-tooltip> -->
                         </div>
                     </div>
                 </div>
@@ -284,7 +284,8 @@ export default defineComponent({
         const DOCUMENT_RESULT = {};
 
         const getHTML = (string) => {
-            return formatAnwserString(string);
+            // return formatAnwserString(string);
+            return string;
         };
         const replaceCode = (text, index) => {
             const icon = `  <span class="circle" data-list-index="${index || 0}"></span>`
@@ -385,12 +386,14 @@ export default defineComponent({
 
         const copyAnswer = (text) => {
             if (!props.readonly) {
+
                 if (props.type !== 'document_report') {
                     // 非文档报告:复制markdown原文
                     copyMarkdown(text, "复制成功", 1);
                 } else {
                     // 文档报告:复制纯文本
-                    copyMarkdown(text, "复制成功", 3);
+                    // copyMarkdown(text, "复制成功", 3);
+                    copyMarkdown(text, "复制成功", 1);
                 }
             }
         };
@@ -954,16 +957,11 @@ export default defineComponent({
                                 workflow: workflow,
                                 title: value,
                                 upload_files: docReport.upload_files,
-
-
-                                /**
-                                 * 当workflow值为2或者3时,存在此参数
-                                 */
-                                sub_titles: '',
                             }
                         }
 
                         if (workflow === 2) {
+                            // 文档报告
                             sendData = {
                                 workflow: workflow,
                                 title: value,
@@ -971,13 +969,14 @@ export default defineComponent({
 
 
                                 /**
-                                 * 当workflow值为2或者3时,存在此参数
+                                 * 当workflow值为2时,存在此参数
                                  */
                                 sub_titles: docReport.sub_titles,
                             }
                         }
 
                         if (workflow === 3) {
+                            // 小标题生成
                             // 第一次参数
                             const is_first = docReport.is_first / 1;
 

+ 60 - 20
src/components/DocumentReportFooter.vue

@@ -236,16 +236,64 @@ const handleStart = async () => {
         return;
     }
 
-    if (!title) {
-        showMsg('请填写标题');
-        return;
+    if (action_type === 1) {
+        if (!title) {
+            showMsg('请填写标题');
+            return;
+        }
+
+        if (f_list.length === 0) {
+            showMsg('请选择文件');
+            return;
+        }
     }
 
-    if (f_list.length === 0) {
-        showMsg('请选择文件');
-        return;
+    if (action_type === 2) {
+        if (!title) {
+            showMsg('请填写标题');
+            return;
+        }
+
+        if (!text_description.value) {
+            showMsg('请填写小标题');
+            return;
+        }
+
+        if (f_list.length === 0) {
+            showMsg('请选择文件');
+            return;
+        }
     }
 
+    if (action_type === 3) {
+        // if (!text_title.value) {
+        //     showMsg('请填写标题');
+        //     return;
+        // }
+
+        // if (!text_description.value) {
+        //     showMsg('请填写小标题');
+        //     return;
+        // }
+
+        if (is_first_generate.value) {
+            // 第一次
+        } else {
+            // 非第一次
+            if (!chat_message.value) {
+                showMsg('请输入您的要求');
+                return;
+            }
+        }
+
+        if (f_list.length === 0) {
+            showMsg('请选择文件');
+            return;
+        }
+    }
+
+
+
     const agent_id = props.agentId;
 
     try {
@@ -344,36 +392,28 @@ const handleStart = async () => {
 
                 upload_files: file_id_list,
                 title: title, // 此参数可以为空
-                title_number: text_title.value, // 小标题数量,默认值
-                title_style: text_description.value,
+                title_number: text_title.value || 8, // 小标题数量,默认值
+                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;
+                tempLocalStoreData.title_query = chat_message.value || 'start';
 
                 is_first_generate.value = false;
             } else {
                 tempLocalStoreData.is_first = 0;
             }
 
+            // 隐藏表单区域,只展示对话区域
+            handleFormFold();
         }
 
-        // 保存小数绘图数据
-        helper.write('sendData', tempLocalStoreData);
 
-        // helper.$bus.emit('send-message', {
-        //     upload_files: file_id_list,
-        //     title: title,
-        //     workflow: action_type,
-        // });
+        helper.write('sendData', tempLocalStoreData);
 
-        // helper.$bus.emit('send-message', title);
         helper.$bus.emit('open-dialog', title);
 
         // 上传成功

+ 1 - 1
src/components/document-report/ActionTypeRadio.vue

@@ -5,7 +5,7 @@
         </a-tooltip>
 
         <a-tooltip :content="radio_xiaobiaoti_text">
-            <a-radio :value="3" :model-value="act_type" @click="handleRadioClick(3)">小标题生成</a-radio>
+            <a-radio :value="3" :model-value="act_type" @click="handleRadioClick(3)">生成标题</a-radio>
         </a-tooltip>
 
         <a-tooltip :content="radio_shengcheng_text">

+ 19 - 11
src/components/document-report/TextInputType2.vue

@@ -8,11 +8,11 @@
     <div class="vertical-placeholder"></div>
 
     <a-typography-text>
-        小标题<span class="attention-requred">*</span>
+        小标题及关键内容<span class="attention-requred">*</span>
     </a-typography-text>
     <a-textarea :max-length="maxLength" v-model="wendangzhineng_text_input" :disabled="parseStatus"
-        :show-word-limit="wendangzhineng_text_input.length > maxLength / 2" :auto-size="{ maxRows: 6 }"
-        placeholder="输入您想了解的内容,Shift+Enter换行" :style="text_area_style" @keyup="handleTextKeyUp"
+        :show-word-limit="wendangzhineng_text_input.length > maxLength / 2" :auto-size="{ minRows: 6, maxRows: 14 }"
+        :placeholder="placeholder_str" :style="text_area_style" @keyup="handleTextKeyUp"
         @input="handleDescriptionChange">
     </a-textarea>
 </template>
@@ -22,6 +22,14 @@ import { ref, inject, computed, nextTick } from "vue";
 
 const emit = defineEmits(['change']);
 
+// : auto - size="{ minRows: 4, maxRows: 10 }"
+
+const placeholder_str = `
+您可以选择以下两种方式来构建“主要工作措施和成效”部分的内容:
+1、使用预设模板:直接复制并粘贴“生成标题”模块生成的标题及内容。
+2、个性化定制:根据实际情况,自定义输入小标题及与之对应的具体项目内容,以更精准地生成报告。
+`
+
 // 标题
 const text_title = ref(""); // 单行文本:标题
 const text_description = ref(""); // 多行文本:描述
@@ -32,14 +40,14 @@ const parseStatus = ref(false);
 
 const wendangzhineng_text_input = ref('');
 const text_area_style = {
-    flex: 1,
-    // borderRadius: '12px',
-    // marginTop: '20px',
-    padding: '0px 10px 0 3px',
-    background: 'transparent',
-    border: '1px solid #e3e3e3',
-    minHeight: '120px',
-    paddingBottom: `${text_title.value.length > maxLength.value / 2 ? '20px' : ''}`
+    // flex: 1,
+    // // borderRadius: '12px',
+    // // marginTop: '20px',
+    // padding: '0px 10px 0 3px',
+    // background: 'transparent',
+    // border: '1px solid #e3e3e3',
+    // minHeight: '120px',
+    // paddingBottom: `${text_title.value.length > maxLength.value / 2 ? '20px' : ''}`
 };
 
 const handleChange = () => {

+ 16 - 9
src/components/document-report/TextInputType3.vue

@@ -8,11 +8,11 @@
     <div class="vertical-placeholder"></div>
 
     <a-typography-text>
-        风格示例
+        风格示例(选填)
     </a-typography-text>
     <a-textarea :max-length="maxLength" v-model="wendangzhineng_text_input" :disabled="parseStatus"
-        :show-word-limit="wendangzhineng_text_input.length > maxLength / 2" :auto-size="{ maxRows: 6 }"
-        placeholder="输入您想了解的内容,Shift+Enter换行" :style="text_area_style" @keyup="handleTextKeyUp"
+        :show-word-limit="wendangzhineng_text_input.length > maxLength / 2" :auto-size="{ minRows: 8, maxRows: 14 }"
+        :placeholder="placeholder_str" :style="text_area_style" @keyup="handleTextKeyUp"
         @input="handleDescriptionChange">
     </a-textarea>
 </template>
@@ -27,6 +27,13 @@ const str = `
 立足本质安全,在应急中彰显水平
 `
 
+const placeholder_str = `
+请输入您希望生成的小标题风格,并提供至少三个同类型的小标题示例以供参考。这将帮助我们更准确地理解并满足您的要求。
+例如:
+1、坚持现场优先,在检测中锻炼队伍
+2、立足本质安全,在应急中彰显水平
+3、常态生产管控,在流程中树立地位
+`
 
 // 标题
 const text_title = ref("8"); // 单行文本:标题
@@ -38,13 +45,13 @@ const parseStatus = ref(false);
 
 const wendangzhineng_text_input = ref('');
 const text_area_style = {
-    flex: 1,
+    // flex: 1,
 
-    padding: '0px 10px 0 3px',
-    background: 'transparent',
-    border: '1px solid #e3e3e3',
-    minHeight: '120px',
-    paddingBottom: `${text_title.value.length > maxLength.value / 2 ? '20px' : ''}`
+    // padding: '0px 10px 0 3px',
+    // background: 'transparent',
+    // border: '1px solid #e3e3e3',
+    // minHeight: '120px',
+    // paddingBottom: `${text_title.value.length > maxLength.value / 2 ? '20px' : ''}`
 };
 
 const handleChange = () => {

+ 1 - 1
src/views/Home.vue

@@ -138,7 +138,7 @@
                         <PictureFooter v-if="navId === 6 && !historyMode" :agentId="selectId" />
 
                         <!-- 文档报告 -->
-                        <DocumentReportFooter v-if="navId === 9" :agentId="selectId" />
+                        <DocumentReportFooter v-if="navId === 9 && !historyMode" :agentId="selectId" />
 
                         <!-- 侧边栏切换按钮 -->
                         <ToggleBtn v-if="navId !== -2" :closeOthers="closeOthers" @toggle="openAll" />