Compare commits

...

2 Commits

Author SHA1 Message Date
lyc 58e80d590e Merge pull request 'edit' (#74) from lyc-dev into main 2024-11-27 14:38:49 +08:00
lyc 8a1c5d7186 edit 2024-11-27 14:38:22 +08:00
3 changed files with 16 additions and 6 deletions

View File

@ -52,7 +52,7 @@ watch(() => props.item.answer, (newVal) => {
const onSave = () =>{ 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 isDialog.value = false
ElMessage.success('操作成功') ElMessage.success('操作成功')
emitter.emit('onGetChild', textarea.value) emitter.emit('onGetChild', textarea.value)

View File

@ -84,7 +84,7 @@
<script setup> <script setup>
import { ref, reactive, onMounted, watch, onUnmounted } from 'vue' import { ref, reactive, onMounted, watch, onUnmounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' 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 { sessionStore } from '@/utils/store'
import keywordDialog from './keyword-dialog.vue'; import keywordDialog from './keyword-dialog.vue';
import AdjustDialog from './adjust-dialog.vue' import AdjustDialog from './adjust-dialog.vue'
@ -155,13 +155,13 @@ const getChildTemplate = () => {
// //
const getTempResult = () => { const getTempResult = () => {
tempResult({ mainModelId: curTemplate.id }).then(res => { tempResult({ mainModelId: curTemplate.id, pageNum: 1, pageSize: 10000 }).then(res => {
let rows = res.rows let rows = res.rows
childTempList.value.forEach(item => { childTempList.value.forEach(item => {
rows.forEach(el => { rows.forEach(el => {
if (item.id == el.modelId) { if (item.id == el.modelId) {
item.answer = el.content 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 let answer = data.answer
childTempList.value[index].oldAnswer = answer childTempList.value[index].oldAnswer = answer
childTempList.value[index].answer = getResult(answer); childTempList.value[index].answer = getResult(answer);
onSaveTemp(item) onEditSave(item)
} finally { } finally {
childTempList.value[index].loading = false 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 onSaveTemp = (item) => {
const data = { const data = {

View File

@ -143,7 +143,8 @@ const getCompletion = async () => {
for (let item of childTempList.value) { for (let item of childTempList.value) {
try { try {
item.loading = true 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) const { data } = await completion(params)
let answer = data.answer let answer = data.answer
item.oldAnswer = answer item.oldAnswer = answer