Просмотр исходного кода

Merge branch 'shanghaidiankeyuan' of http://gitlab.smartai.com/qi/xiaoshu into shanghaidiankeyuan

zhupei 1 год назад
Родитель
Сommit
5cfddca576

+ 20 - 0
src/components/DialogWrap.vue

@@ -194,6 +194,16 @@
                                     <img src="@/assets/icons/copy.png" width="15" />
                                 </p>
                             </a-tooltip>
+                            <a-tooltip content="查看日志">
+                                <p @click="checkLogs(item)" :class="[readonly ? 'disabled' : '']">
+                                    <icon-calendar />
+                                </p>
+                            </a-tooltip>
+                            <a-tooltip content="生成报告">
+                                <p @click="generateReport(item)" :class="[readonly ? 'disabled' : '']">
+                                    <icon-bookmark />
+                                </p>
+                            </a-tooltip>
 
 
                             <!-- <a-tooltip content="收藏">
@@ -429,6 +439,14 @@ export default defineComponent({
                 }
             }
         };
+        const checkLogs = (item) => {
+            // TODO: 查看日志
+        }
+        const generateReport = (item) => {
+            // TODO: 生成报告
+            // console.log(item)
+            // helper.write('generate-report',item)
+        }
 
 
         const reQuestion = (text) => {
@@ -1143,6 +1161,8 @@ export default defineComponent({
 
             showFeedback,
             copyAnswer,
+            checkLogs,
+            generateReport,
             dialogList,
             getHTML,
             // selectSuggestion,

+ 75 - 39
src/components/DocumentReportFooter.vue

@@ -1,7 +1,7 @@
 <template>
     <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">
+            <div v-if="act_type === 3 && init_status" class="form-fold-btn" @click="handleFormFold">
                 <icon-menu-fold :size="20" />
             </div>
 
@@ -15,36 +15,38 @@
 
             <div class="vertical-placeholder"></div>
 
-            <a-typography-text>
-                请上传文件<span class="attention-requred">*</span>
-            </a-typography-text>
-
-            <a-upload :file-list="file_list" :multiple="true" :limit="MAX_ACCEPT_FILE" :auto-upload="false"
-                :show-upload-button="{ showOnExceedLimit: false }" accept=".pdf,.docx" @change="handleFileChange">
-                <template #upload-button>
-                    <a-tooltip :content="upload_warning_text">
-                        <a-button class="upload-button">
-                            <template #icon>
-                                <icon-upload />
-                            </template>
-
-                            <template #default>点击上传</template>
-                        </a-button>
-                    </a-tooltip>
-                </template>
-
-                <template #file-name="{ fileItem }">
-                    <a-tooltip :content="fileItem.name">
-                        <span>{{fileItem.name}}</span>
-                    </a-tooltip>
-                </template>
-
-                <!-- <template #upload-item="{ fileItem, index }">
+            <a-space :direction="act_type === 3 ? 'horizonta' : 'vertical'" fill>
+                <a-typography-text class="label-class">
+                    请上传文件<span class="attention-requred">*</span>
+                </a-typography-text>
+
+                <a-upload :file-list="file_list" :multiple="true" :limit="MAX_ACCEPT_FILE" :auto-upload="false"
+                    :show-upload-button="{ showOnExceedLimit: false }" accept=".pdf,.docx" @change="handleFileChange">
+                    <template #upload-button>
+                        <a-tooltip :content="upload_warning_text">
+                            <a-button class="upload-button">
+                                <template #icon>
+                                    <icon-upload />
+                                </template>
+
+                                <template #default>点击上传</template>
+                            </a-button>
+                        </a-tooltip>
+                    </template>
+
+                    <template #file-name="{ fileItem }">
+                        <a-tooltip :content="fileItem.name">
+                            <span>{{ fileItem.name }}</span>
+                        </a-tooltip>
+                    </template>
+
+                    <!-- <template #upload-item="{ fileItem, index }">
                 <div>
                     <div>{{ fileItem.name }}</div>
                 </div>
             </template> -->
-            </a-upload>
+                </a-upload>
+            </a-space>
 
 
             <template v-if="act_type === 2 || act_type === 1 || show_start_btn">
@@ -59,7 +61,12 @@
             <div class="message-input-container">
                 <div v-show="!doc_form_show" class="form-fold-btn open" @click="handleFormOpen">
                     <!-- <icon-menu-fold :size="20" /> -->
-                    <icon-menu-unfold :size="20" />
+                    <a-space>
+                        <icon-menu-unfold :size="20" />
+                        <a-typography-text>
+                            用户上传管理
+                        </a-typography-text>
+                    </a-space>
                 </div>
 
                 <MessageInputV2 :readonly="readonly" @message="handleChatMessageUpdate" />
@@ -90,13 +97,21 @@ const props = defineProps({
 
 const { config, helper, ajax } = inject("$global");
 
+/**
+ * 初始状态未点击开始前
+ *用来控制弹框右上角是否显示收起按钮
+ * 初始不显示:false
+ * 点击开始后:true
+ */
+const init_status = ref(false)
+
 /**
  * 操作类型
  * 1 文档清洗
  * 2 报告生成
  * 3 小标题生成
  */
-const act_type = ref(1);
+const act_type = ref(3);
 const text_title = ref(""); // 单行文本:标题
 const text_description = ref(""); // 多行文本:描述
 const chat_message = ref(''); // 对话输入框的消息
@@ -291,9 +306,9 @@ const handleStart = async () => {
         //     showMsg('请填写小标题');
         //     return;
         // }
-
         if (is_first_generate.value) {
             // 第一次
+            init_status.value = true; // 标记为已点击开始,显示收起按钮
         } else {
             // 非第一次
             if (!chat_message.value) {
@@ -468,30 +483,47 @@ const radio_shengcheng_text = "对上传的(经过清洗的)文档生成报告
 
     position: relative;
 }
-.form-fold-btn{
+
+.form-fold-btn {
     position: absolute;
     right: 10px;
     cursor: pointer;
     z-index: 9;
+
 }
-.form-fold-btn.open{
+
+.form-fold-btn.open {
     left: 4px;
-    top: -4px;
+    top: -10px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width: 130px;
+    padding: 3px;
+    border-radius: 5px;
+    background-color: #eee;
+
 }
 
 .attention-requred {
     color: red;
 }
 
-.wendangbaogaoshengcheng-footer {
-
+.label-class {
+    display: block;
+    width: 100px;
+    margin-right: 10px;
+    text-align: right;
 }
 
+
+.wendangbaogaoshengcheng-footer {}
+
 .max-limit-warning {
     font-size: 12px;
 }
 
-.upload-button{
+.upload-button {
     background-color: rgb(var(--primary-6));
     color: #fff;
 }
@@ -501,7 +533,7 @@ const radio_shengcheng_text = "对上传的(经过清洗的)文档生成报告
     color: #fff;
 }
 
-.message-input-container{
+.message-input-container {
     position: relative;
 }
 </style>
@@ -515,17 +547,21 @@ const radio_shengcheng_text = "对上传的(经过清洗的)文档生成报告
 }
 
 .wendangbaogaoshengcheng-footer .arco-upload-list.arco-upload-list-type-text,
-.wendangbaogaoshengcheng-footer .arco-upload-list.arco-upload-list-type-picture{
+.wendangbaogaoshengcheng-footer .arco-upload-list.arco-upload-list-type-picture {
+    min-width: 355px;
     width: 100%;
     max-height: 400px;
     overflow-y: auto;
     padding-right: 5px;
 }
+.wendangbaogaoshengcheng-footer .arco-upload-list.arco-upload-list-type-text .arco-upload-list-item {
+    margin-top: 10px;
+}
 </style>
 
 
 <style>
 .arco-textarea-wrapper[flag="document-report-generate"] .arco-textarea {
-    font-size: 13px;
+    font-size: 12px;
 }
 </style>

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

@@ -5,11 +5,11 @@
         </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">
-            <a-radio :value="2" :model-value="act_type" @click="handleRadioClick(2)">报告生成</a-radio>
+            <a-radio :value="2" :model-value="act_type" @click="handleRadioClick(2)">生成报告</a-radio>
         </a-tooltip>
     </a-space>
 </template>
@@ -24,7 +24,7 @@ const emit = defineEmits(['change']);
  * 2 报告生成
  * 3 小标题生成
  */
-const act_type = ref(1);
+const act_type = ref(3);
 const handleRadioClick = (value) => {
     act_type.value = value / 1;
 

+ 81 - 18
src/components/document-report/TextInputType3.vue

@@ -1,20 +1,50 @@
 <template>
-    <a-typography-text>
-        小标题数量
-    </a-typography-text>
-    <a-input :style="{ flex: '1' }" v-model="text_title" :placeholder="`请输入标题`" allow-clear
-        @input="handleInputChange" />
+    <a-space>
+        <a-typography-text class="label-class">
+            小标题数量<span class="attention-requred">*</span>
+        </a-typography-text>
+        <a-input class="input-class" v-model="text_title" :placeholder="`请输入标题`" allow-clear @input="handleInputChange" />
 
+    </a-space>
     <div class="vertical-placeholder"></div>
-
-    <a-typography-text>
-        风格示例(选填)
-    </a-typography-text>
-    <a-textarea flag="document-report-generate" :max-length="maxLength" v-model="wendangzhineng_text_input"
-        :disabled="parseStatus" :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>
+    <a-space>
+        <a-typography-text class="label-class">
+            风格示例
+        </a-typography-text>
+        <a-textarea class="input-class" flag="document-report-generate" :max-length="maxLength"
+            v-model="wendangzhineng_text_input" :disabled="parseStatus"
+            :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>
+    </a-space>
+    <div class="vertical-placeholder"></div>
+    <a-space>
+        <a-tooltip :content="tip_content_document_clear">
+            <a-space>
+                <a-typography-text class="label-class">
+                    文档清洗
+                </a-typography-text>
+                <a-switch v-model="document_clear_status" @change="handleClearChange">
+                    <template #checked>
+                        开
+                    </template>
+                    <template #unchecked>
+                        关
+                    </template>
+                </a-switch>
+            </a-space>
+        </a-tooltip>
+        <a-tooltip :content="tip_content_token_count">
+            <a-space v-if="!document_clear_status">
+                <a-typography-text class="label-class">
+                    最大TOKEN数<span class="attention-requred">*</span>
+                </a-typography-text>
+                <a-input-number v-model="token_count" placeholder="请输入" class="input-demo" :min="0" :max="100"
+                    @change="handleTokenCountChange" />
+            </a-space>
+        </a-tooltip>
+    </a-space>
 </template>
 
 <script setup>
@@ -27,13 +57,18 @@ const str = `
 立足本质安全,在应急中彰显水平
 `
 
-const placeholder_str = `
-请输入您希望生成的小标题风格,并提供至少三个同类型的小标题示例以供参考。这将帮助我们更准确地理解并满足您的要求。
+const placeholder_str = `请输入您希望生成的小标题风格,并提供至少三个同类型的小标题示例以供参考。这将帮助我们更准确地理解并满足您的要求。
 例如:
 1、坚持现场优先,在检测中锻炼队伍
 2、立足本质安全,在应急中彰显水平
 3、常态生产管控,在流程中树立地位
 `
+const tip_content_document_clear = `
+文档清洗的目的是减少token占用、优化输入,去除冗余图片、并对文字进行摘要、提取关键信息总结,以达到更好的报告生成效果。
+`
+const tip_content_token_count = `
+当上传文档的TOKEN数大于用户输入的最大TOKEN数时,自动经过文档清洗工作流,以减少token占用、优化输入,去除冗余信息
+`
 
 // 标题
 const text_title = ref("8"); // 单行文本:标题
@@ -54,7 +89,18 @@ const text_area_style = {
     // paddingBottom: `${text_title.value.length > maxLength.value / 2 ? '20px' : ''}`
 };
 
+const document_clear_status = ref(true);
+const token_count = ref(50);
+
 const handleChange = () => {
+    const data = {
+        title: text_title.value,
+        description: text_description.value,
+        document_clear_status: document_clear_status.value,
+    }
+    if (!document_clear_status.value) {
+        data.token_count = token_count.value;
+    }
     nextTick(() => {
         emit('change', {
             title: text_title.value,
@@ -82,7 +128,14 @@ const handleDescriptionChange = (value) => {
 
     handleChange();
 }
-
+// 文档清洗状态变化
+const handleClearChange = (value) => {
+    handleChange();
+}
+// token数量变化
+const handleTokenCountChange = (value) => {
+    handleChange();
+}
 /**
  * 用户按键事件
  * @param e
@@ -98,7 +151,17 @@ const handleTextKeyUp = (e) => {
 
 <style lang="scss" scoped>
 .vertical-placeholder {
-    height: 10px;
+    height: 15px;
+}
+
+.label-class {
+    width: 100px;
+    text-align: right;
+}
+
+.input-class {
+    width: 355px;
+    font-size: 12px;
 }
 
 .attention-requred {