+
*当前模板为系统预设,不支持直接操作。会复制一份为自己的然后再操作
-
+
@@ -60,9 +61,8 @@ const form = reactive({
})
watch(() => props.isAdd, (newVal) => {
+ console.log(newVal)
if (!newVal) {
- console.log(newVal, 'isEditKeyWord');
-
form.name = props.item?.name
form.prompt = props.item?.prompt
}
@@ -76,8 +76,8 @@ const saveAdd = async () => {
try {
var msg = null
// 为主模板预设
- if (props.temp.ex3 == '1') {
- var { msg } = await addKeyWords({ name: form.name, id: props.temp.id })
+ if (props.item.ex3 == '1') {
+ var { msg } = await addKeyWords({ name: form.name, id: props.item.id })
}
else {
// 添加子模板
@@ -85,12 +85,12 @@ const saveAdd = async () => {
name: form.name,
type: 2, // 子模板 固定值为2
sortNum: 1,
- parentId: props.temp.id,
+ parentId: props.item.id,
lmType: 1,
model: props.modeType,
prompt: form.prompt,
- ex1: props.temp.ex1, //学段
- ex2: props.temp.ex2, // 学科
+ ex1: props.item.ex1, //学段
+ ex2: props.item.ex2, // 学科
ex3: '', //是否系统预设 这里默认空
}
var { msg } = await addChildTemp(obj)
@@ -128,4 +128,10 @@ const saveAdd = async () => {
font-weight: bold;
}
}
+.small-tip{
+ text-align: left;
+ font-size: 12px;
+ margin-bottom: 15px;
+ color: #F56C6C;
+}
\ No newline at end of file
diff --git a/src/renderer/src/components/template-study/container/result.vue b/src/renderer/src/components/template-study/container/result.vue
index a685aae..d12aae1 100644
--- a/src/renderer/src/components/template-study/container/result.vue
+++ b/src/renderer/src/components/template-study/container/result.vue
@@ -53,9 +53,9 @@
-
+
-
+
@@ -67,7 +67,7 @@ import AdjustDialog from './adjust-dialog.vue'
import keywordDialog from './keyword-dialog.vue';
import { sessionStore } from '@/utils/store'
import useUserStore from '@/store/modules/user'
-import { conversation, completion, modelList, removeChildTemp } from '@/api/mode/index'
+import { tempSave, completion, modelList, removeChildTemp, tempResult } from '@/api/mode/index'
import { dataSetJson } from '@/utils/comm.js'
const userStore = useUserStore()
@@ -90,16 +90,35 @@ const getChildTemplate = () => {
tempLoading.value = true
modelList({ model: props.modeType, type: 2, parentId: props.tempId }).then(res => {
childTempList.value = res.rows
-
+ getTempResult()
}).finally(() => {
tempLoading.value = false
})
}
+// 查询模板结果
+const getTempResult = () =>{
+ tempResult({mainModelId: props.tempId}).then(res =>{
+ console.log(res,1000)
+ let rows = res.rows
+ childTempList.value.forEach(item =>{
+ rows.forEach(el =>{
+ if(item.id == el.modelId){
+ item.answer = el.content
+ item.reultId = el.id
+ }
+ })
+ })
+ })
+}
+
+
+
const isEdit = ref(false)
watch(() => props.tempId, (newVal) => {
if (newVal) {
// isEdit.value = true
getChildTemplate()
+
}
})
@@ -122,24 +141,38 @@ const getCompletion = async () => {
for (let item of childTempList.value) {
try {
item.loading = true
- params.prompt = `根据${curNode.edustage}语文课标,提炼出${item.name}`
+ params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标,提炼出${item.name}`
const { data } = await completion(params)
let answer = data.answer
item.oldAnswer = answer
item.answer = getResult(answer);
-
+ onSaveTemp(item)
} finally {
item.loading = false
}
}
}
+// 保存模板
+const onSaveTemp = (item) =>{
+ const data = {
+ mainModelId: props.tempId,
+ modelId: item.id,
+ examDocld: '',
+ content: item.oldAnswer
+ }
+ tempSave(data).then(res =>{
+ console.log(res)
+ })
+}
+
+
// 重新研读
const againResult = async (index, item) => {
try {
childTempList.value[index].loading = true
- params.prompt = `根据${curNode.edustage}语文课标,提炼出${item.name}`
+ params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标,提炼出${item.name}`
const { data } = await completion(params)
let answer = data.answer
childTempList.value[index].oldAnswer = answer
@@ -170,9 +203,10 @@ const onEdit = (index, item) => {
// 保存编辑
const saveEdit = (data) => {
- childTempList.value[curIndex.value].oldAnswer = data
- let answer = getResult(data);
- childTempList.value[curIndex.value].answer = answer
+ // childTempList.value[curIndex.value].oldAnswer = data
+ // let answer = getResult(data);
+ // childTempList.value[curIndex.value].answer = answer
+ getChildTemplate()
}
const isAdjust = ref(false)
@@ -191,6 +225,8 @@ const saveAdjust = (item) => {
const keywordItem = reactive({})
const isEditKeyWord = ref(false)
const editKeyWord = (item) =>{
+ console.log(item)
+
isEditKeyWord.value = true
Object.assign(keywordItem, item)
}
@@ -210,6 +246,7 @@ onMounted(() => {
let jsonKey = `${text}-${data.edustage}-${data.edusubject}`
params.dataset_id = dataSetJson[jsonKey]
+
})
defineExpose({