Compare commits
No commits in common. "1a267e569621b6de92bb4ffb5ac42cb31289d12b" and "f9b80dd455a348592eb5946144b20758beeb8660" have entirely different histories.
1a267e5696
...
f9b80dd455
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-dialog v-model="isDialog" :show-close="false" width="800" append-to-body destroy-on-close>
|
||||
<el-dialog v-model="isDialog" :show-close="false" width="800" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>{{ item.name }}</span>
|
||||
|
@ -105,9 +105,11 @@ const getCompletion = async (val) => {
|
|||
}
|
||||
|
||||
const saveAdjust = (item) =>{
|
||||
|
||||
isDialog.value = false
|
||||
ElMessage.success('操作成功')
|
||||
emitter.emit('onSaveAdjust', item.msg)
|
||||
emitter.on('saveAdjust', item.msg)
|
||||
|
||||
}
|
||||
|
||||
const modeType = ref('课标')
|
||||
|
|
|
@ -51,9 +51,7 @@
|
|||
<div class="item-icon">
|
||||
<i class="iconfont icon-ai"></i>
|
||||
</div>
|
||||
<div class="item-answer">
|
||||
<TypingEffect :text="item.oldAnswer" :delay="10" :aiShow="item.aiShow" @complete="onSaveTemp(item)" />
|
||||
</div>
|
||||
<div class="item-answer" v-html="item.answer"></div>
|
||||
</div>
|
||||
<div class="ai-btn" v-if="item.answer">
|
||||
<el-button type="primary" link @click="againResult(index, item)">
|
||||
|
@ -70,6 +68,7 @@
|
|||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<el-empty v-if="!childTempList.length" description="暂无模板数据" />
|
||||
</div>
|
||||
|
@ -90,7 +89,6 @@ import { sessionStore } from '@/utils/store'
|
|||
import keywordDialog from './keyword-dialog.vue';
|
||||
import AdjustDialog from './adjust-dialog.vue'
|
||||
import EditDialog from './edit-dialog.vue'
|
||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||
import emitter from '@/utils/mitt';
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
|
||||
|
@ -111,6 +109,7 @@ const onAdd = () => {
|
|||
isAdd.value = true
|
||||
Object.assign(editItem, curTemplate)
|
||||
isWordDialog.value = true
|
||||
|
||||
}
|
||||
|
||||
const editKeyWord = (item, val) => {
|
||||
|
@ -264,14 +263,12 @@ const params = reactive(
|
|||
const againResult = async (index, item) => {
|
||||
try {
|
||||
childTempList.value[index].loading = true
|
||||
item.aiShow = true
|
||||
childTempList.value[index].oldAnswer = ''
|
||||
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
let answer = data.answer
|
||||
childTempList.value[index].oldAnswer = answer
|
||||
childTempList.value[index].answer = getResult(answer);
|
||||
// onEditSave(item)
|
||||
onEditSave(item)
|
||||
} finally {
|
||||
childTempList.value[index].loading = false
|
||||
}
|
||||
|
@ -281,29 +278,18 @@ const getCompletion = async () => {
|
|||
for (let item of childTempList.value) {
|
||||
try {
|
||||
item.loading = true
|
||||
item.aiShow = true
|
||||
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
let answer = data.answer
|
||||
item.oldAnswer = answer
|
||||
item.answer = getResult(answer);
|
||||
|
||||
onSaveTemp(item)
|
||||
} finally {
|
||||
item.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 替换分析结果
|
||||
emitter.on('onSaveAdjust', (item) => {
|
||||
childTempList.value[curIndex.value].oldAnswer = item
|
||||
let answer = getResult(item);
|
||||
childTempList.value[curIndex.value].oldAnswer = item
|
||||
childTempList.value[curIndex.value].answer = answer
|
||||
onEditSave(childTempList.value[curIndex.value])
|
||||
})
|
||||
|
||||
|
||||
// 保存 重新研读后的结果
|
||||
const onEditSave = async (item) =>{
|
||||
const { res } = await editTempResult({id: item.resultId, content: item.oldAnswer})
|
||||
|
@ -311,18 +297,30 @@ const onEditSave = async (item) =>{
|
|||
getChildTemplate()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 保存模板
|
||||
const onSaveTemp = (item) => {
|
||||
if(item.oldAnswer == '') return
|
||||
const data = {
|
||||
mainModelId: curTemplate.id,
|
||||
modelId: item.id,
|
||||
examDocld: '',
|
||||
content: item.oldAnswer
|
||||
}
|
||||
tempSave(data).then(res => {})
|
||||
tempSave(data).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 替换分析结果
|
||||
emitter.on('saveAdjust', (item) => {
|
||||
childTempList.value[curIndex.value].oldAnswer = item
|
||||
let answer = getResult(item);
|
||||
childTempList.value[curIndex.value].answer = answer
|
||||
})
|
||||
|
||||
// 分析获取课标对话结果
|
||||
let getResult = (text) => {
|
||||
text = text.replace(/^\n\n(.*?)\n\n$/s, '<div>$1</div>');
|
||||
|
@ -353,9 +351,8 @@ onMounted(() => {
|
|||
|
||||
// 解绑
|
||||
onUnmounted(() => {
|
||||
emitter.off('onGetMain');
|
||||
emitter.off('onGetChild');
|
||||
emitter.off('onSaveAdjust');
|
||||
emitter.off('saveAdjust');
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -425,7 +422,6 @@ onUnmounted(() => {
|
|||
.item-answer {
|
||||
flex-direction: column;
|
||||
padding-top: 5px;
|
||||
width: 100%;
|
||||
|
||||
:deep(.text-tit) {
|
||||
font-weight: bold;
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
<template>
|
||||
<div class="typing-effect">
|
||||
<!-- <span v-html="displayedText"></span> -->
|
||||
<el-input
|
||||
v-model="displayedText"
|
||||
:autosize="{ minRows: 2 }"
|
||||
type="textarea"
|
||||
readonly
|
||||
resize="none"
|
||||
style="width: 100%;"
|
||||
input-style="border:none;outline: none;box-shadow:none;color:000;fontSize:15px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
text: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
delay: {
|
||||
type: Number,
|
||||
default: 100 // 默认每个字符出现的延迟时间,单位是毫秒
|
||||
},
|
||||
aiShow: {
|
||||
type: [Boolean]
|
||||
}
|
||||
});
|
||||
const emit = defineEmits(['complete']);
|
||||
const displayedText = ref('');
|
||||
const index = ref(0);
|
||||
|
||||
const type = () => {
|
||||
if(!props.aiShow) return
|
||||
if (index.value <= props.text.length) {
|
||||
displayedText.value += props.text.charAt(index.value);
|
||||
index.value++;
|
||||
setTimeout(() => type(), props.delay);
|
||||
} else {
|
||||
// 当所有字符都显示完毕时,触发 complete 事件
|
||||
emit('complete');
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
type();
|
||||
});
|
||||
|
||||
// 监听 props 的变化,以便当传入的 text 或 delay 发生改变时重新开始打字机效果
|
||||
watch([() => props.text, () => props.delay], () => {
|
||||
displayedText.value = '';
|
||||
index.value = 0;
|
||||
type();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.typing-effect {
|
||||
font-family: monospace;
|
||||
}
|
||||
:deep(.el-textarea__inner:hover){
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
|
@ -8,10 +8,9 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const Remote = require('@electron/remote')
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
@ -48,11 +47,6 @@ const closeWindow = () => {
|
|||
})
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
||||
onMounted(() =>{
|
||||
isMaxSize.value = Remote.getCurrentWindow().isMaximized()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<el-breadcrumb :separator-icon="ArrowRight">
|
||||
<el-breadcrumb-item v-for="item in breadList"> {{ item.title }} </el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<span class="ml-5">《{{ curNode.itemtitle }}》</span>
|
||||
</div>
|
||||
<div class="header-center" v-else>
|
||||
AI文枢{{ version }}
|
||||
|
@ -21,13 +20,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ArrowRight } from '@element-plus/icons-vue'
|
||||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import pkc from "../../../../../package.json"
|
||||
import { sessionStore } from '@/utils/store'
|
||||
|
||||
const version = ref(pkc.version)
|
||||
|
||||
// 返回
|
||||
|
@ -36,8 +33,6 @@ const onBack = () => {
|
|||
router.go(-1)
|
||||
}
|
||||
|
||||
const curNode = reactive({itemtitle: ''})
|
||||
|
||||
// 监听当前路由
|
||||
const isShowBack = ref(false)
|
||||
const breadList = ref([])
|
||||
|
@ -49,8 +44,7 @@ watch(
|
|||
if (path.includes('/model') && path !== ('/model/index')) {
|
||||
isShowBack.value = true
|
||||
breadList.value = newValue.matched.map(item => item.meta)
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data)
|
||||
|
||||
}
|
||||
else {
|
||||
isShowBack.value = false
|
||||
|
|
|
@ -113,7 +113,7 @@ const getConversation = (val) => {
|
|||
const getCompletion = async (val) => {
|
||||
try {
|
||||
|
||||
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}考试 对${curNode.itemtitle}进行教学分析`
|
||||
params.prompt = `根据${curNode.edustage}${curNode.edusubject},分析${props.item.name},${val}`
|
||||
const { data } = await completion(params)
|
||||
let answer = data.answer
|
||||
msgList.value.push({
|
||||
|
@ -133,6 +133,8 @@ const saveAdjust = (item) =>{
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const curFile = reactive({})
|
||||
const dataset_id = ref('')
|
||||
const fileList = ref([])
|
||||
|
@ -141,15 +143,15 @@ const getList = () =>{
|
|||
userId: userInfo.userId,
|
||||
dataset_id: dataset_id.value
|
||||
}).then( res =>{
|
||||
fileList.value = res.rows
|
||||
fileList.value = [{fileId: '',fileName: '选择文件', id:-1},...res.rows]
|
||||
Object.assign(curFile, fileList.value[0])
|
||||
params.document_ids = fileList.value[0].docId
|
||||
})
|
||||
}
|
||||
emitter.on('curFile', (item) =>{
|
||||
changeFile(item)
|
||||
})
|
||||
const changeFile = (val) =>{
|
||||
|
||||
Object.assign(curFile, val);
|
||||
params.document_ids = val.docId
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ watch(() => props.item.answer, (newVal) => {
|
|||
|
||||
const emit = defineEmits(['saveEdit'])
|
||||
const onSave = () =>{
|
||||
editTempResult({id: props.item.resultId, content: textarea.value}).then( res =>{
|
||||
editTempResult({id: props.item.reultId, content: textarea.value}).then( res =>{
|
||||
isDialog.value = false
|
||||
ElMessage.success('操作成功')
|
||||
emit('saveEdit', textarea.value)
|
||||
|
|
|
@ -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 { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
||||
import { tempSave, completion, modelList, removeChildTemp, tempResult } from '@/api/mode/index'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
|
@ -109,7 +109,7 @@ const getTempResult = () => {
|
|||
rows.forEach(el => {
|
||||
if (item.id == el.modelId) {
|
||||
item.answer = el.content
|
||||
item.resultId = el.id
|
||||
item.reultId = el.id
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -143,6 +143,7 @@ const getCompletion = async () => {
|
|||
for (let item of childTempList.value) {
|
||||
try {
|
||||
item.loading = true
|
||||
// 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
|
||||
|
@ -174,24 +175,16 @@ const onSaveTemp = (item) => {
|
|||
const againResult = async (index, item) => {
|
||||
try {
|
||||
childTempList.value[index].loading = true
|
||||
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}考试 对${curNode.itemtitle}进行教学分析`
|
||||
params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标,提炼出${item.name}`
|
||||
const { data } = await completion(params)
|
||||
let answer = data.answer
|
||||
childTempList.value[index].oldAnswer = answer
|
||||
childTempList.value[index].answer = getResult(answer);
|
||||
onEditSave(childTempList.value[index])
|
||||
} finally {
|
||||
childTempList.value[index].loading = false
|
||||
}
|
||||
}
|
||||
|
||||
// 保存 重新研读后的结果
|
||||
const onEditSave = async (item) =>{
|
||||
const { res } = await editTempResult({id: item.resultId, content: item.oldAnswer})
|
||||
ElMessage.success(res)
|
||||
getChildTemplate()
|
||||
}
|
||||
|
||||
|
||||
// 分析获取课标对话结果
|
||||
let getResult = (text) => {
|
||||
|
|
Loading…
Reference in New Issue