edit #72

Merged
lyc merged 1 commits from lyc-dev into main 2024-11-27 12:02:37 +08:00
3 changed files with 29 additions and 17 deletions

View File

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

View File

@ -33,7 +33,11 @@ const pdfUrl = ref('')
onMounted(async () => { onMounted(async () => {
await nextTick() await nextTick()
let data = sessionStore.get('subject.curBook') 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> </script>

View File

@ -76,7 +76,7 @@
<!--编辑结果--> <!--编辑结果-->
<EditDialog v-model="isEdit" :item="editItem" /> <EditDialog v-model="isEdit" :item="editItem" />
<!--AI 对话调整--> <!--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" /> <keywordDialog v-model="isWordDialog" :isAdd="isAdd" :item="editItem" />
</template> </template>