|
|
@@ -1,11 +1,13 @@
|
|
|
<!-- 章节编辑器 -->
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, watch, type PropType } from 'vue';
|
|
|
+import { computed, ref, watch, type PropType } from 'vue';
|
|
|
import { EditOutlined, DownOutlined } from '@ant-design/icons-vue';
|
|
|
import type { Chapter } from '@/types/report.types';
|
|
|
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"
|
|
|
|
|
|
const props = defineProps({
|
|
|
reportKeywords: {
|
|
|
@@ -23,6 +25,10 @@ const props = defineProps({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+const route = useRoute()
|
|
|
+
|
|
|
+const isAI = computed(() => route.query.ai)
|
|
|
+
|
|
|
const titleEditor = ref<HTMLInputElement | null>(null);
|
|
|
|
|
|
const titleEditing = ref(false);
|
|
|
@@ -34,7 +40,7 @@ const keywordsEditor = ref<HTMLInputElement | null>(null);
|
|
|
const keywordsEditing = ref(false);
|
|
|
|
|
|
const repetitiveWarning = ref(false);
|
|
|
-
|
|
|
+
|
|
|
const fullTitle = ref('');
|
|
|
// 参考文献抽屉组件ref
|
|
|
const referenceDraw = ref<InstanceType<typeof ReferenceDraw> | null>(null);
|
|
|
@@ -132,10 +138,19 @@ function notifyRepetitiveWarning(data: boolean){
|
|
|
repetitiveWarning.value = data;
|
|
|
}
|
|
|
|
|
|
+function test1() {
|
|
|
+ const prompt = `根据章节标题和关键词续写章节内容:\n` +
|
|
|
+ `章节标题:${props.data.title}\n关键词:${props.data.keywords}\n续写`
|
|
|
+ testService.test1(prompt).then((resp) => {
|
|
|
+ onContentChange(resp)
|
|
|
+ }).catch((err) => {
|
|
|
+ console.log('err', err)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
defineExpose({
|
|
|
- notifyRepetitiveWarning
|
|
|
+ notifyRepetitiveWarning
|
|
|
})
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -202,7 +217,7 @@ defineExpose({
|
|
|
<div class="chapter-button-group" v-if="contentEditorVisible">
|
|
|
<a-space>
|
|
|
<a-button @click="searchReference">查找参考文献</a-button>
|
|
|
- <a-button disabled>自动生成(二期)</a-button>
|
|
|
+ <a-button :disabled="!isAI" @click="test1">自动生成(二期)</a-button>
|
|
|
</a-space>
|
|
|
</div>
|
|
|
</div>
|