Merge pull request '模板修改' (#151) from lyc-dev into main
This commit is contained in:
commit
cebf864b82
|
@ -59,6 +59,7 @@ import { completion, docList } from '@/api/mode/index'
|
|||
import { sessionStore } from '@/utils/store'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { sendChart } from '@/api/ai/index'
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
const userInfo = useUserStore().user
|
||||
|
@ -77,6 +78,14 @@ const props = defineProps({
|
|||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
curMode:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
conversation_id: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -100,7 +109,8 @@ const curNode = reactive({})
|
|||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: ''
|
||||
dataset_id: '',
|
||||
template: ''
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -108,7 +118,24 @@ const params = reactive(
|
|||
const getCompletion = async (val) => {
|
||||
try {
|
||||
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
params.template = props.item.prompt
|
||||
|
||||
let data = null;
|
||||
// 教学大模型
|
||||
if(props.curMode == 1){
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: props.conversation_id,
|
||||
stream: false
|
||||
})
|
||||
data = res.data
|
||||
}
|
||||
else{
|
||||
// 知识库模型
|
||||
const res = await completion(params)
|
||||
data = res.data
|
||||
}
|
||||
|
||||
let answer = data.answer
|
||||
msgList.value.push({
|
||||
type: 'robot',
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<!--编辑结果-->
|
||||
<EditDialog v-model="isEdit" :item="editItem" />
|
||||
<!--AI 对话调整-->
|
||||
<AdjustDialog v-model="isAdjust" :type="type" :item="editItem" />
|
||||
<AdjustDialog v-model="isAdjust" :type="type" :item="editItem" :curMode="curMode" :conversation_id="conversation_id"/>
|
||||
<!--添加、编辑提示词-->
|
||||
<keywordDialog v-model="isWordDialog" :item="editItem" />
|
||||
</template>
|
||||
|
@ -323,7 +323,7 @@ const againResult = async (index, item) => {
|
|||
|
||||
let data = null;
|
||||
// 教学大模型
|
||||
if (mode.value == 1) {
|
||||
if (curMode.value == 1) {
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: conversation_id.value,
|
||||
|
|
|
@ -42,9 +42,10 @@
|
|||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { completion } from '@/api/mode/index'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import emitter from '@/utils/mitt';
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { sendChart } from '@/api/ai/index'
|
||||
|
||||
const textarea = ref('')
|
||||
|
||||
|
@ -56,6 +57,14 @@ const props = defineProps({
|
|||
default: () => {
|
||||
return { name: '11' }
|
||||
}
|
||||
},
|
||||
curMode:{
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
conversation_id: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -77,13 +86,36 @@ const send = () => {
|
|||
}
|
||||
const curNode = reactive({})
|
||||
|
||||
// 获取会话ID
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: '',
|
||||
template: ''
|
||||
}
|
||||
)
|
||||
|
||||
// 大模型对话
|
||||
const getConversation = async (val) => {
|
||||
try {
|
||||
const { data } = await completion({
|
||||
dataset_id: 'cee3062a9fcf11efa6910242ac140006',
|
||||
prompt: val
|
||||
})
|
||||
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}课标,对${curNode.itemtitle}进行教学分析`
|
||||
params.template = props.item.prompt
|
||||
|
||||
let data = null;
|
||||
// 教学大模型
|
||||
if(props.curMode == 1){
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: props.conversation_id,
|
||||
stream: false
|
||||
})
|
||||
data = res.data
|
||||
}
|
||||
else{
|
||||
// 知识库模型
|
||||
const res = await completion(params)
|
||||
data = res.data
|
||||
}
|
||||
|
||||
msgList.value.push({
|
||||
type: 'robot',
|
||||
msg: data.answer,
|
||||
|
@ -94,15 +126,16 @@ const getConversation = async (val) => {
|
|||
}
|
||||
|
||||
const saveAdjust = (item) => {
|
||||
// emit('saveAdjust', item.msg)
|
||||
emitter.emit('changeAdjust', item.msg)
|
||||
isDialog.value = false
|
||||
ElMessage.success('操作成功')
|
||||
emitter.emit('onSaveAdjust', item.msg)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
// 框架设计 用课标的dataset_id
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
|
||||
})
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<div class="container-right flex">
|
||||
<div class="right-header flex">
|
||||
<div class="header-left">
|
||||
<el-button type="primary" link>
|
||||
<!-- <el-button type="primary" link>
|
||||
<i class="iconfont icon-jiahao"></i>新活动
|
||||
</el-button>
|
||||
<el-button type="primary" link>
|
||||
<i class="iconfont icon-baocun"></i>保存为教学模式
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
||||
|
@ -62,7 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<EditDialog v-model="isEdit" :item="curItem" />
|
||||
<AdjustDialog v-model="isAdjust" :item="curItem" />
|
||||
<AdjustDialog v-model="isAdjust" :item="curItem" :curMode="curMode" :conversation_id="conversation_id" />
|
||||
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog" />
|
||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||
<!--添加、编辑提示词-->
|
||||
|
@ -393,7 +393,7 @@ const againResult = async (index, item) => {
|
|||
|
||||
let data = null;
|
||||
// 教学大模型
|
||||
if (mode.value == 1) {
|
||||
if (curMode.value == 1) {
|
||||
const res = await sendChart({
|
||||
content: params.prompt,
|
||||
conversationId: conversation_id.value,
|
||||
|
@ -421,11 +421,21 @@ const onAdjust = (index, item) => {
|
|||
Object.assign(curItem, item)
|
||||
isAdjust.value = true
|
||||
}
|
||||
emitter.on('changeAdjust', (item) => {
|
||||
|
||||
// 替换分析结果
|
||||
emitter.on('onSaveAdjust', (item) => {
|
||||
resultList.value[curIndex.value].answer = item
|
||||
onEditSave(resultList.value[curIndex.value])
|
||||
})
|
||||
|
||||
|
||||
// 保存 重新研读后的结果
|
||||
const onEditSave = async (item) => {
|
||||
const { msg } = await editTempResult({ id: item.resultId, content: item.answer })
|
||||
ElMessage.success(msg)
|
||||
getChildTemplate()
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const onEdit = (index, item) => {
|
||||
curIndex.value = index
|
||||
|
@ -585,7 +595,7 @@ onMounted(() => {
|
|||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
courseObj.node = data
|
||||
|
||||
// 框架设计 用课标的dataset_id
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
||||
|
||||
|
@ -605,7 +615,7 @@ onUnmounted(() => {
|
|||
emitter.off('changeMode')
|
||||
emitter.off('changeResult')
|
||||
emitter.off('changeAdjust')
|
||||
|
||||
emitter.off('onSaveAdjust');
|
||||
})
|
||||
|
||||
|
||||
|
@ -630,7 +640,7 @@ onUnmounted(() => {
|
|||
background: #F6F6F6;
|
||||
padding: 15px;
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
overflow-y: auto;
|
||||
|
||||
.con-item {
|
||||
width: 100%;
|
||||
|
|
Loading…
Reference in New Issue