Explorar el Código

添加Loading

Kevin Jiang hace 2 años
padre
commit
7fb6ac7a96
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      src/views/report/components/ChapterEditor.vue

+ 8 - 0
src/views/report/components/ChapterEditor.vue

@@ -8,6 +8,7 @@ import ContentEditor from "../components/ContentEditor.vue";
 import ReferenceDraw from "../components/reference/ReferenceDraw.vue";
 import { useRoute } from 'vue-router';
 import * as testService from "@/services/test.service"
+import { message } from 'ant-design-vue';
 
 const props = defineProps({
   title: {
@@ -143,13 +144,20 @@ function notifyRepetitiveWarning(data: boolean){
 }
 
 function test1() {
+  const loadingHandler = message.loading({content: 'AI正在撰写章节内容,请稍等……'})
   const prompt = `根据R&D报告的标题、章节标题和关键词续写章节内容:\n` +
             `标题:${props.title}\n`+
             `章节标题:${props.data.title}\n关键词:${props.data.keywords}\n续写:`
   testService.test1(prompt).then((resp) => {
     onContentChange(resp)
+    if (loadingHandler) {
+      loadingHandler()
+    }
   }).catch((err) => {
     console.log('err', err)
+    if (loadingHandler) {
+      loadingHandler()
+    }
   })
 }