Compare commits

...

2 Commits

Author SHA1 Message Date
lyc 231a7b6dce Merge pull request 'edit' (#72) from lyc-dev into main 2024-11-27 12:02:35 +08:00
lyc 310d9d3a2b edit 2024-11-27 12:02:14 +08:00
3 changed files with 29 additions and 17 deletions

View File

@ -40,8 +40,8 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { conversation, completion } from '@/api/mode/index'
import { ref, reactive, onMounted, watch } from 'vue'
import { completion } from '@/api/mode/index'
import { sessionStore } from '@/utils/store'
import { ElMessage } from 'element-plus'
import { dataSetJson } from '@/utils/comm.js'
@ -58,7 +58,7 @@ const props = defineProps({
return { name: '11' }
}
},
modeType: {
type: {
type: Number,
default: 1
}
@ -77,7 +77,7 @@ const send = () =>{
msg: textarea.value
})
loaded.value = true
getConversation(textarea.value)
getCompletion(textarea.value)
textarea.value = ''
}
const curNode = reactive({})
@ -87,16 +87,11 @@ const params = reactive(
dataset_id: ''
}
)
// ID
const getConversation = (val) => {
getCompletion(val)
}
//
const getCompletion = async (val) => {
try {
params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标${props.item.name}${val}`
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value}${curNode.itemtitle}进行教学分析`
const { data } = await completion(params)
let answer = data.answer
msgList.value.push({
@ -117,13 +112,26 @@ const saveAdjust = (item) =>{
}
const modeType = ref('课标')
watch(() => props.type, (newVal) => {
if (newVal == 1){
modeType.value = '课标'
}
if (newVal == 2){
modeType.value = '教材'
}
if (newVal == 2){
modeType.value = '考试'
}
}, { immediate: false })
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
let text = props.modeType == 1||props.modeType == 2 ? '课标' : '考试'
let jsonKey = `${text}-${data.edustage}-${data.edusubject}`
console.log(jsonKey)
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
params.dataset_id = dataSetJson[jsonKey]
})

View File

@ -33,7 +33,11 @@ const pdfUrl = ref('')
onMounted(async () => {
await nextTick()
let data = sessionStore.get('subject.curBook')
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + data.fileurl.replace('.txt', '.pdf')
let fileurl = data.fileurl
if(props.type == 1){
fileurl = `${data.edustage}-${data.edusubject}-课标.txt`
}
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf')
})
</script>

View File

@ -76,7 +76,7 @@
<!--编辑结果-->
<EditDialog v-model="isEdit" :item="editItem" />
<!--AI 对话调整-->
<AdjustDialog v-model="isAdjust" :modeType="type" :item="editItem" />
<AdjustDialog v-model="isAdjust" :type="type" :item="editItem" />
<!--添加编辑提示词-->
<keywordDialog v-model="isWordDialog" :isAdd="isAdd" :item="editItem" />
</template>