edit #74

Merged
lyc merged 1 commits from lyc-dev into main 2024-11-27 14:38:50 +08:00
3 changed files with 16 additions and 6 deletions
Showing only changes of commit 8a1c5d7186 - Show all commits

View File

@ -52,7 +52,7 @@ watch(() => props.item.answer, (newVal) => {
const onSave = () =>{
editTempResult({id: props.item.reultId, content: textarea.value}).then( res =>{
editTempResult({id: props.item.resultId, content: textarea.value}).then( res =>{
isDialog.value = false
ElMessage.success('操作成功')
emitter.emit('onGetChild', textarea.value)

View File

@ -84,7 +84,7 @@
<script setup>
import { ref, reactive, onMounted, watch, onUnmounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { tempSave, completion, modelList, removeChildTemp, tempResult } from '@/api/mode/index'
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
import { sessionStore } from '@/utils/store'
import keywordDialog from './keyword-dialog.vue';
import AdjustDialog from './adjust-dialog.vue'
@ -155,13 +155,13 @@ const getChildTemplate = () => {
//
const getTempResult = () => {
tempResult({ mainModelId: curTemplate.id }).then(res => {
tempResult({ mainModelId: curTemplate.id, pageNum: 1, pageSize: 10000 }).then(res => {
let rows = res.rows
childTempList.value.forEach(item => {
rows.forEach(el => {
if (item.id == el.modelId) {
item.answer = el.content
item.reultId = el.id
item.resultId = el.id
}
})
})
@ -268,7 +268,7 @@ const againResult = async (index, item) => {
let answer = data.answer
childTempList.value[index].oldAnswer = answer
childTempList.value[index].answer = getResult(answer);
onSaveTemp(item)
onEditSave(item)
} finally {
childTempList.value[index].loading = false
}
@ -290,6 +290,15 @@ const getCompletion = async () => {
}
}
//
const onEditSave = async (item) =>{
const { res } = await editTempResult({id: item.resultId, content: item.oldAnswer})
ElMessage.success(res)
getChildTemplate()
}
//
const onSaveTemp = (item) => {
const data = {

View File

@ -143,7 +143,8 @@ const getCompletion = async () => {
for (let item of childTempList.value) {
try {
item.loading = true
params.prompt = `根据${curNode.edustage}${curNode.edusubject},提炼出${item.prompt}`
// params.prompt = `${curNode.edustage}${curNode.edusubject}${item.prompt}`
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}考试 对${curNode.itemtitle}进行教学分析`
const { data } = await completion(params)
let answer = data.answer
item.oldAnswer = answer