Compare commits
12 Commits
90ac7a49c7
...
cebf864b82
Author | SHA1 | Date |
---|---|---|
lyc | cebf864b82 | |
lyc | 0ed69394ef | |
lyc | 0b6039f9d8 | |
lyc | 627c70d0e1 | |
zhengdegang | 792ab3284f | |
zdg | 38a50d18bf | |
zdg | 6fa0aa6e5f | |
zdg | b0fca4ad9b | |
lyc | 9381785991 | |
lyc | 28561b5016 | |
lyc | 2e2ebbd47f | |
baigl | 2b5b365e2f |
|
@ -41,21 +41,12 @@ export class Classcourse {
|
||||||
this.classcourse = classcourse // 课堂信息
|
this.classcourse = classcourse // 课堂信息
|
||||||
this.id = classcourse.id // 课堂id
|
this.id = classcourse.id // 课堂id
|
||||||
// 如果课堂信息有paging,则更新当前页码
|
// 如果课堂信息有paging,则更新当前页码
|
||||||
const { paging } = classcourse
|
const { paging, cartoonTimes } = classcourse
|
||||||
const isPaging = !!paging || paging === 0
|
const isPaging = !!paging || paging === 0
|
||||||
if (isPaging) {
|
|
||||||
await this.sleep(200)
|
|
||||||
emitter.emit('useExecPlay', {key:'turnSlideToIndex', paging})
|
|
||||||
await this.sleep(1000)
|
|
||||||
// 如果课堂信息有paging,则更新动画播放状态
|
// 如果课堂信息有paging,则更新动画播放状态
|
||||||
const isAnim = !!classcourse.cartoonTimes
|
const isAnim = !!cartoonTimes || cartoonTimes === 0
|
||||||
if (isAnim) { // 动画播放
|
if (isPaging) slidesStore.updateSlideIndex(paging)
|
||||||
for (let i = 0; i < classcourse.cartoonTimes; i++) {
|
if (isAnim) slidesStore.updateAnimationIndex(cartoonTimes+1)
|
||||||
// 异步执行动画
|
|
||||||
emitter.emit('useExecPlay', {key:'execNext', isAsync:true})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 课堂信息-状态管理
|
// 课堂信息-状态管理
|
||||||
classcourseStore.setClasscourse(classcourse)
|
classcourseStore.setClasscourse(classcourse)
|
||||||
// 待上课提示
|
// 待上课提示
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* 点赞组件-相关
|
||||||
|
*/
|
||||||
|
export default class Upvote {
|
||||||
|
instance: any = null // 自身实例
|
||||||
|
upvoteRef: any = null // 点赞组件
|
||||||
|
constructor(elRef?: any) {
|
||||||
|
if(!!elRef) this.upvoteRef = elRef // 点赞组件
|
||||||
|
if (!Upvote.Instance) {
|
||||||
|
Upvote.Instance = this
|
||||||
|
}
|
||||||
|
return Upvote.Instance
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
init(elRef) {
|
||||||
|
if(!!elRef) this.upvoteRef = elRef // 点赞组件
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
// 打开点赞或者疑问 1点赞 2疑问
|
||||||
|
trigger(type) {
|
||||||
|
this.upvoteRef?.value?.trigger?.(type)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
// 静态方法-初始化
|
||||||
|
static init(elRef) {
|
||||||
|
return new Upvote(elRef)
|
||||||
|
}
|
||||||
|
// 静态方法-打开点赞或者疑问 1点赞 2疑问
|
||||||
|
static trigger(type) {
|
||||||
|
return new Upvote().trigger(type)
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,8 +11,9 @@ import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
import Classcourse from './classcourse' // 课程相关
|
import Classcourse from './classcourse' // 课程相关
|
||||||
import msgUtils from '@/plugins/modal' // 消息工具
|
import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
import { Homework } from './index' // api-作业相关
|
import { Homework } from './index' // api-作业相关
|
||||||
import emitter from '@/utils/mitt' //mitt 事件总线
|
// import emitter from '@/utils/mitt' //mitt 事件总线
|
||||||
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
||||||
|
import hooksUpvote from './upvote' // 点赞-工具
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 监听器
|
* @description 监听器
|
||||||
|
@ -22,7 +23,7 @@ export default () => {
|
||||||
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
||||||
const resource = sessionStore.get('curr.resource') // apt 资源
|
const resource = sessionStore.get('curr.resource') // apt 资源
|
||||||
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
||||||
const execPlay = useExecPlay() // 播放控制
|
const { execNext, turnPrevSlide } = useExecPlay()
|
||||||
// 监听幻灯片内容变化
|
// 监听幻灯片内容变化
|
||||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||||
|
@ -98,9 +99,8 @@ export default () => {
|
||||||
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
||||||
const slideIndex = content?.current || 0
|
const slideIndex = content?.current || 0
|
||||||
const type = content?.animation
|
const type = content?.animation
|
||||||
// if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
|
if (type === 'Nextsteps') execNext(true) // 下一步-异步动画
|
||||||
if (type === 'Nextsteps') emitter.emit('useExecPlay', {key:'execNext', isAsync:true}) // 下一步
|
else if (type === 'Previoustep') turnPrevSlide() // 上一步清空-动画
|
||||||
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
|
|
||||||
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
||||||
|
@ -111,10 +111,10 @@ export default () => {
|
||||||
close()
|
close()
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_dz: // 点赞
|
case MsgEnum.HEADS.MSG_dz: // 点赞
|
||||||
emitter.emit('upvoteTrigger', 1)
|
hooksUpvote.trigger(1)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
||||||
emitter.emit('upvoteTrigger', 2)
|
hooksUpvote.trigger(2)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_0010: // 备用
|
case MsgEnum.HEADS.MSG_0010: // 备用
|
||||||
break
|
break
|
||||||
|
|
|
@ -3,16 +3,21 @@ import type { Classcourse } from '../api/types'
|
||||||
|
|
||||||
export interface ClasscourseState {
|
export interface ClasscourseState {
|
||||||
classcourse: Classcourse | any, // 课堂信息
|
classcourse: Classcourse | any, // 课堂信息
|
||||||
|
isEmit: boolean, // 是否加载监听事件(动画播放)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useClasscourseStore = defineStore('classcourse', {
|
export const useClasscourseStore = defineStore('classcourse', {
|
||||||
state: (): ClasscourseState => ({
|
state: (): ClasscourseState => ({
|
||||||
classcourse: null, // 课堂信息
|
classcourse: null, // 课堂信息
|
||||||
|
isEmit: false, // 是否加载监听事件(动画播放)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
setClasscourse(classcourse: Classcourse) {
|
setClasscourse(classcourse: Classcourse) {
|
||||||
this.classcourse = classcourse
|
this.classcourse = classcourse
|
||||||
},
|
},
|
||||||
|
setIsEmit(isEmit: boolean) {
|
||||||
|
this.isEmit = isEmit
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
|
@ -33,7 +33,8 @@ export interface SlidesState {
|
||||||
slides: Slide[]
|
slides: Slide[]
|
||||||
slideIndex: number
|
slideIndex: number
|
||||||
viewportSize: number
|
viewportSize: number
|
||||||
viewportRatio: number
|
viewportRatio: number,
|
||||||
|
animationIndex: number, // 不是从0开始
|
||||||
workList:Object[],
|
workList:Object[],
|
||||||
workItem:Object[],
|
workItem:Object[],
|
||||||
}
|
}
|
||||||
|
@ -46,6 +47,7 @@ export const useSlidesStore = defineStore('slides', {
|
||||||
slideIndex: 0, // 当前页面索引
|
slideIndex: 0, // 当前页面索引
|
||||||
viewportSize: 1000, // 可视区域宽度基数
|
viewportSize: 1000, // 可视区域宽度基数
|
||||||
viewportRatio: 0.5625, // 可视区域比例,默认16:9
|
viewportRatio: 0.5625, // 可视区域比例,默认16:9
|
||||||
|
animationIndex: 0, // 不是从0开始
|
||||||
workList:[],// 活动的列表
|
workList:[],// 活动的列表
|
||||||
workItem:[],// 获取到的所有pptlist
|
workItem:[],// 获取到的所有pptlist
|
||||||
}),
|
}),
|
||||||
|
@ -206,6 +208,9 @@ export const useSlidesStore = defineStore('slides', {
|
||||||
updateSlideIndex(index: number) {
|
updateSlideIndex(index: number) {
|
||||||
this.slideIndex = index
|
this.slideIndex = index
|
||||||
},
|
},
|
||||||
|
updateAnimationIndex(index: number) {
|
||||||
|
this.animationIndex = index
|
||||||
|
},
|
||||||
|
|
||||||
addElement(element: PPTElement | PPTElement[]) {
|
addElement(element: PPTElement | PPTElement[]) {
|
||||||
const elements = Array.isArray(element) ? element : [element]
|
const elements = Array.isArray(element) ? element : [element]
|
||||||
|
|
|
@ -30,14 +30,10 @@
|
||||||
@close="timerlVisible = false"
|
@close="timerlVisible = false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="tools-left">
|
<div class="tools-left" v-if="!classcourse">
|
||||||
<IconLeftTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execPrev()" />
|
<IconLeftTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execPrev()" />
|
||||||
<IconRightTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execNext()" />
|
<IconRightTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execNext()" />
|
||||||
</div>
|
</div>
|
||||||
<!-- 点赞组件 -->
|
|
||||||
<div style="z-index: 999;position: absolute;top:10px">
|
|
||||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
||||||
@mouseleave="rightToolsVisible = false"
|
@mouseleave="rightToolsVisible = false"
|
||||||
|
@ -59,7 +55,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref , watchEffect} from 'vue'
|
import { ref , watchEffect, onMounted, onUnmounted} from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore ,useScreenStore, useClasscourseStore} from '../../store'
|
import { useSlidesStore ,useScreenStore, useClasscourseStore} from '../../store'
|
||||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||||
|
@ -73,18 +69,15 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
||||||
import SlideThumbnails from './SlideThumbnails.vue'
|
import SlideThumbnails from './SlideThumbnails.vue'
|
||||||
import WritingBoardTool from './WritingBoardTool.vue'
|
import WritingBoardTool from './WritingBoardTool.vue'
|
||||||
import CountdownTimer from './CountdownTimer.vue'
|
import CountdownTimer from './CountdownTimer.vue'
|
||||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
import Chat from '../../api/chat' // 聊天
|
import Chat from '../../api/chat' // 聊天
|
||||||
// import * as emits from './hooks/emitter'
|
|
||||||
// emits.init() // 初始化事件
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { slides, slideIndex } = storeToRefs(useSlidesStore())
|
const { slides, slideIndex } = storeToRefs(useSlidesStore())
|
||||||
const { classcourse } = storeToRefs(useClasscourseStore()) // 课堂信息
|
const { classcourse, isEmit } = storeToRefs(useClasscourseStore()) // 课堂信息
|
||||||
|
|
||||||
const {
|
const {
|
||||||
autoPlayTimer,
|
autoPlayTimer,
|
||||||
|
@ -105,26 +98,6 @@ const {
|
||||||
execNext,
|
execNext,
|
||||||
animationIndex,
|
animationIndex,
|
||||||
} = useExecPlay()
|
} = useExecPlay()
|
||||||
// zdg: 使用方法才生效
|
|
||||||
const execPlay = {
|
|
||||||
autoPlayTimer,
|
|
||||||
autoPlay,
|
|
||||||
closeAutoPlay,
|
|
||||||
autoPlayInterval,
|
|
||||||
setAutoPlayInterval,
|
|
||||||
loopPlay,
|
|
||||||
setLoopPlay,
|
|
||||||
mousewheelListener,
|
|
||||||
touchStartListener,
|
|
||||||
touchEndListener,
|
|
||||||
turnPrevSlide,
|
|
||||||
turnNextSlide,
|
|
||||||
turnSlideToIndex,
|
|
||||||
turnSlideToId,
|
|
||||||
execPrev,
|
|
||||||
execNext,
|
|
||||||
animationIndex,
|
|
||||||
}
|
|
||||||
const { slideWidth, slideHeight } = useSlideSize()
|
const { slideWidth, slideHeight } = useSlideSize()
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||||
|
@ -135,7 +108,6 @@ const writingBoardToolVisible = ref(false)
|
||||||
const timerlVisible = ref(false)
|
const timerlVisible = ref(false)
|
||||||
const slideThumbnailModelVisible = ref(false)
|
const slideThumbnailModelVisible = ref(false)
|
||||||
const laserPen = ref(false)
|
const laserPen = ref(false)
|
||||||
const upvoteRef = ref(null)
|
|
||||||
const screenStore =useScreenStore()
|
const screenStore =useScreenStore()
|
||||||
const contextmenus = (): ContextmenuItem[] => {
|
const contextmenus = (): ContextmenuItem[] => {
|
||||||
return [
|
return [
|
||||||
|
@ -226,25 +198,6 @@ const exitCourse = async () => {
|
||||||
exitScreening() // 结束放映
|
exitScreening() // 结束放映
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开点赞或者疑问 1点赞 2疑问
|
|
||||||
emitter.on('upvoteTrigger', (type) => {
|
|
||||||
upvoteRef.value?.trigger(type)
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听
|
|
||||||
emitter.on('useExecPlay', (data: string|any) => {
|
|
||||||
console.log('useExecPlay', data)
|
|
||||||
if (!data) throw new Error('参数错误')
|
|
||||||
if (typeof data === 'string') { // 字符串
|
|
||||||
if (execPlay[data]) execPlay[data]()
|
|
||||||
else throw new Error('方法不存在')
|
|
||||||
} else { // 对象
|
|
||||||
const { key, ...params } = data || {}
|
|
||||||
const paramsArray = Object.values(params)
|
|
||||||
if (execPlay[key]) execPlay[key](...paramsArray)
|
|
||||||
else throw new Error('方法不存在')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, nextTick, ref, watch } from 'vue'
|
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore, useClasscourseStore } from '../../store'
|
import { useSlidesStore, useClasscourseStore } from '../../store'
|
||||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||||
|
@ -95,6 +95,7 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
||||||
import WritingBoardTool from './WritingBoardTool.vue'
|
import WritingBoardTool from './WritingBoardTool.vue'
|
||||||
import CountdownTimer from './CountdownTimer.vue'
|
import CountdownTimer from './CountdownTimer.vue'
|
||||||
import Divider from '../../components/Divider.vue'
|
import Divider from '../../components/Divider.vue'
|
||||||
|
import emitter from '@/utils/mitt';
|
||||||
import Chat from '../../api/chat' // 聊天
|
import Chat from '../../api/chat' // 聊天
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -102,7 +103,7 @@ const props = defineProps<{
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { slides, slideIndex, viewportRatio, currentSlide } = storeToRefs(useSlidesStore())
|
const { slides, slideIndex, viewportRatio, currentSlide } = storeToRefs(useSlidesStore())
|
||||||
const { classcourse } = storeToRefs(useClasscourseStore()) // 课堂信息
|
const { classcourse, isEmit } = storeToRefs(useClasscourseStore()) // 课堂信息
|
||||||
|
|
||||||
const slideListWrapRef = ref<HTMLElement>()
|
const slideListWrapRef = ref<HTMLElement>()
|
||||||
const thumbnailsRef = ref<HTMLElement>()
|
const thumbnailsRef = ref<HTMLElement>()
|
||||||
|
@ -120,7 +121,6 @@ const {
|
||||||
turnSlideToId,
|
turnSlideToId,
|
||||||
animationIndex,
|
animationIndex,
|
||||||
} = useExecPlay()
|
} = useExecPlay()
|
||||||
|
|
||||||
const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const { slidesLoadLimit } = useLoadSlides()
|
const { slidesLoadLimit } = useLoadSlides()
|
||||||
|
@ -210,6 +210,7 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -5,14 +5,15 @@ import { useSlidesStore, useClasscourseStore } from '../../../store'
|
||||||
import { KEYS } from '../../../configs/hotkey'
|
import { KEYS } from '../../../configs/hotkey'
|
||||||
import { ANIMATION_CLASS_PREFIX } from '../../../configs/animation'
|
import { ANIMATION_CLASS_PREFIX } from '../../../configs/animation'
|
||||||
import message from '../../../utils/message'
|
import message from '../../../utils/message'
|
||||||
|
import emitter from '@/utils/mitt';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const slidesStore = useSlidesStore()
|
const slidesStore = useSlidesStore()
|
||||||
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
|
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
|
||||||
const { slides, slideIndex, formatedAnimations } = storeToRefs(slidesStore)
|
const { slides, slideIndex, formatedAnimations, animationIndex } = storeToRefs(slidesStore)
|
||||||
|
|
||||||
// 当前页的元素动画执行到的位置
|
// 当前页的元素动画执行到的位置
|
||||||
const animationIndex = ref(0)
|
// const animationIndex = ref(0)
|
||||||
|
|
||||||
// 动画执行状态
|
// 动画执行状态
|
||||||
const inAnimation = ref(false)
|
const inAnimation = ref(false)
|
||||||
|
@ -230,8 +231,8 @@ export default () => {
|
||||||
) turning(e, 'next')
|
) turning(e, 'next')
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => document.addEventListener('keydown', keydownListener))
|
onMounted(() => {document.addEventListener('keydown', keydownListener)})
|
||||||
onUnmounted(() => document.removeEventListener('keydown', keydownListener))
|
onUnmounted(() => {document.removeEventListener('keydown', keydownListener)})
|
||||||
|
|
||||||
// 切换到上一张/上一张幻灯片(无视元素的入场动画)
|
// 切换到上一张/上一张幻灯片(无视元素的入场动画)
|
||||||
const turnPrevSlide = () => {
|
const turnPrevSlide = () => {
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
<div class="pptist-screen">
|
<div class="pptist-screen">
|
||||||
<BaseView :changeViewMode="changeViewMode" v-if="viewMode === 'base'" />
|
<BaseView :changeViewMode="changeViewMode" v-if="viewMode === 'base'" />
|
||||||
<PresenterView :changeViewMode="changeViewMode" v-else-if="viewMode === 'presenter'" />
|
<PresenterView :changeViewMode="changeViewMode" v-else-if="viewMode === 'presenter'" />
|
||||||
|
<!-- 点赞组件 -->
|
||||||
|
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||||
|
<!-- <div style="z-index: 999;position: absolute;top:10px">
|
||||||
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -9,9 +13,11 @@
|
||||||
import { onMounted, onUnmounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { KEYS } from '../../configs/hotkey'
|
import { KEYS } from '../../configs/hotkey'
|
||||||
import useScreening from '../../hooks/useScreening'
|
import useScreening from '../../hooks/useScreening'
|
||||||
|
import hooksUpvote from '../../api/upvote' // 点赞-工具
|
||||||
|
|
||||||
import BaseView from './BaseView.vue'
|
import BaseView from './BaseView.vue'
|
||||||
import PresenterView from './PresenterView.vue'
|
import PresenterView from './PresenterView.vue'
|
||||||
|
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||||
|
|
||||||
const viewMode = ref<'base' | 'presenter'>('base')
|
const viewMode = ref<'base' | 'presenter'>('base')
|
||||||
|
|
||||||
|
@ -20,6 +26,8 @@ const changeViewMode = (mode: 'base' | 'presenter') => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
|
const upvoteRef = ref(null)
|
||||||
|
hooksUpvote.init(upvoteRef) // 初始化点赞
|
||||||
|
|
||||||
// 快捷键退出放映
|
// 快捷键退出放映
|
||||||
const keydownListener = (e: KeyboardEvent) => {
|
const keydownListener = (e: KeyboardEvent) => {
|
||||||
|
|
|
@ -10,11 +10,10 @@ export const createChart = ({ headers, data }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 大模型对话
|
// 大模型对话
|
||||||
export const sendChart = ({ headers, data }) => {
|
export const sendChart = (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/qf/sendTalk',
|
url: '/qf/sendTalk',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers,
|
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div class="file-list">
|
<div class="file-list">
|
||||||
<el-dropdown @command="changeFile">
|
<el-dropdown @command="changeFile" v-if="type == 3">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
{{ curFile.fileName }}
|
{{ curFile.fileName }}
|
||||||
<i class="iconfont icon-xiangxia"></i>
|
<i class="iconfont icon-xiangxia"></i>
|
||||||
|
@ -54,11 +54,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue'
|
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||||
import { completion, docList } from '@/api/mode/index'
|
import { completion, docList } from '@/api/mode/index'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { dataSetJson } from '@/utils/comm.js'
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import { sendChart } from '@/api/ai/index'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
|
|
||||||
const userInfo = useUserStore().user
|
const userInfo = useUserStore().user
|
||||||
|
@ -71,12 +72,20 @@ const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return { name: '11' }
|
return { name: '' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1
|
default: 1
|
||||||
|
},
|
||||||
|
curMode:{
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
conversation_id: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -100,7 +109,8 @@ const curNode = reactive({})
|
||||||
const params = reactive(
|
const params = reactive(
|
||||||
{
|
{
|
||||||
prompt: '',
|
prompt: '',
|
||||||
dataset_id: ''
|
dataset_id: '',
|
||||||
|
template: ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -108,7 +118,24 @@ const params = reactive(
|
||||||
const getCompletion = async (val) => {
|
const getCompletion = async (val) => {
|
||||||
try {
|
try {
|
||||||
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
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
|
let answer = data.answer
|
||||||
msgList.value.push({
|
msgList.value.push({
|
||||||
type: 'robot',
|
type: 'robot',
|
||||||
|
@ -125,19 +152,6 @@ const saveAdjust = (item) =>{
|
||||||
emitter.emit('onSaveAdjust', item.msg)
|
emitter.emit('onSaveAdjust', item.msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
const modeType = ref('课标')
|
|
||||||
watch(() => props.type, (newVal) => {
|
|
||||||
if (newVal == 1){
|
|
||||||
modeType.value = '课标'
|
|
||||||
}
|
|
||||||
if (newVal == 2){
|
|
||||||
modeType.value = '教材'
|
|
||||||
}
|
|
||||||
if (newVal == 2){
|
|
||||||
modeType.value = '考试'
|
|
||||||
}
|
|
||||||
|
|
||||||
}, { immediate: false })
|
|
||||||
|
|
||||||
const curFile = reactive({})
|
const curFile = reactive({})
|
||||||
const dataset_id = ref('')
|
const dataset_id = ref('')
|
||||||
|
@ -160,11 +174,12 @@ const changeFile = (val) =>{
|
||||||
params.document_ids = val.docId
|
params.document_ids = val.docId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const modeType = ref('')
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
|
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
|
|
||||||
|
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
|
||||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||||
params.dataset_id = dataSetJson[jsonKey]
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
if(props.type == 3){
|
if(props.type == 3){
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<div>
|
<div class="flex">
|
||||||
|
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
||||||
|
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
<el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
<el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -52,7 +55,8 @@
|
||||||
<i class="iconfont icon-ai"></i>
|
<i class="iconfont icon-ai"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-answer">
|
<div class="item-answer">
|
||||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
||||||
|
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ai-btn" v-if="item.answer">
|
<div class="ai-btn" v-if="item.answer">
|
||||||
|
@ -77,7 +81,7 @@
|
||||||
<!--编辑结果-->
|
<!--编辑结果-->
|
||||||
<EditDialog v-model="isEdit" :item="editItem" />
|
<EditDialog v-model="isEdit" :item="editItem" />
|
||||||
<!--AI 对话调整-->
|
<!--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" />
|
<keywordDialog v-model="isWordDialog" :item="editItem" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -86,6 +90,7 @@
|
||||||
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
|
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
||||||
|
import { createChart, sendChart } from '@/api/ai/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'
|
||||||
|
@ -94,10 +99,23 @@ import TypingEffect from '@/components/typing-effect/index.vue'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
import { dataSetJson } from '@/utils/comm.js'
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
const props = defineProps(['type'])
|
const props = defineProps(['type'])
|
||||||
const { user } = useUserStore()
|
const { user } = useUserStore()
|
||||||
|
|
||||||
|
const curMode = ref(1)
|
||||||
|
const modeOptions = ref([
|
||||||
|
{
|
||||||
|
label: '教学大模型',
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '知识库模型',
|
||||||
|
value: 2
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
/*****************提示词相关****************/
|
/*****************提示词相关****************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +159,7 @@ const childTempList = ref([])
|
||||||
const getTemplateList = () => {
|
const getTemplateList = () => {
|
||||||
modelList({ createUser: user.userId, model: props.type, type: 1, pageNum: 1, pageSize: 10000, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
modelList({ createUser: user.userId, model: props.type, type: 1, pageNum: 1, pageSize: 10000, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
||||||
templateList.value = res.rows
|
templateList.value = res.rows
|
||||||
if(res.rows.length > 0){
|
if (res.rows.length > 0) {
|
||||||
Object.assign(curTemplate, res.rows[0]);
|
Object.assign(curTemplate, res.rows[0]);
|
||||||
getChildTemplate()
|
getChildTemplate()
|
||||||
}
|
}
|
||||||
|
@ -151,7 +169,7 @@ const getChildTemplate = () => {
|
||||||
tempLoading.value = true
|
tempLoading.value = true
|
||||||
modelList({ model: props.type, type: 2, parentId: curTemplate.id, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
modelList({ model: props.type, type: 2, parentId: curTemplate.id, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
||||||
childTempList.value = res.rows
|
childTempList.value = res.rows
|
||||||
if(childTempList.value.length){
|
if (childTempList.value.length) {
|
||||||
childTempList.value.forEach(item => item.answer = '')
|
childTempList.value.forEach(item => item.answer = '')
|
||||||
}
|
}
|
||||||
getTempResult()
|
getTempResult()
|
||||||
|
@ -173,28 +191,28 @@ const getTempResult = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
if(rows.length > 0){
|
if (rows.length > 0) {
|
||||||
isStarted.value = new Array(rows.length).fill(true)
|
isStarted.value = new Array(rows.length).fill(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToBottom = (height,index) =>{
|
const scrollToBottom = (height, index) => {
|
||||||
|
|
||||||
if (listRef.value) {
|
if (listRef.value) {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
let listDom = listRef.value.children
|
let listDom = listRef.value.children
|
||||||
|
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
// 220 去掉头部
|
// 220 去掉头部
|
||||||
let screenHeight = window.innerHeight - 220
|
let screenHeight = window.innerHeight - 220
|
||||||
if(height > screenHeight){
|
if (height > screenHeight) {
|
||||||
listRef.value.scrollTop = (height - screenHeight + 50)
|
listRef.value.scrollTop = (height - screenHeight + 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
for(let i = 0; i < index; i++){
|
for (let i = 0; i < index; i++) {
|
||||||
sum += listDom[i].clientHeight
|
sum += listDom[i].clientHeight
|
||||||
}
|
}
|
||||||
listRef.value.scrollTop = sum + height
|
listRef.value.scrollTop = sum + height
|
||||||
|
@ -252,7 +270,6 @@ const removeItem = async (item, isChild) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ai对话调整
|
// Ai对话调整
|
||||||
const curIndex = ref(-1)
|
const curIndex = ref(-1)
|
||||||
const isAdjust = ref(false)
|
const isAdjust = ref(false)
|
||||||
|
@ -277,6 +294,7 @@ const params = reactive(
|
||||||
dataset_id: ''
|
dataset_id: ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const prompt = ref('')
|
||||||
|
|
||||||
// 重新研读
|
// 重新研读
|
||||||
const isAgain = ref(false)
|
const isAgain = ref(false)
|
||||||
|
@ -285,10 +303,10 @@ const againResult = async (index, item) => {
|
||||||
isStarted.value[index] = false
|
isStarted.value[index] = false
|
||||||
childTempList.value[index].answer = ''
|
childTempList.value[index].answer = ''
|
||||||
|
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
listRef.value.scrollTop = 0
|
listRef.value.scrollTop = 0
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
scrollToBottom(50, index)
|
scrollToBottom(50, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,8 +314,28 @@ const againResult = async (index, item) => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
childTempList.value[index].loading = true
|
childTempList.value[index].loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
|
||||||
const { data } = await completion(params)
|
let str = cloneDeep(prompt.value)
|
||||||
|
str = str.replace('{模板标题}',item.name)
|
||||||
|
str = str.replace('{模板内容}',item.prompt)
|
||||||
|
params.prompt = str
|
||||||
|
params.template = item.prompt
|
||||||
|
|
||||||
|
let data = null;
|
||||||
|
// 教学大模型
|
||||||
|
if (curMode.value == 1) {
|
||||||
|
const res = await sendChart({
|
||||||
|
content: params.prompt,
|
||||||
|
conversationId: conversation_id.value,
|
||||||
|
stream: false
|
||||||
|
})
|
||||||
|
data = res.data
|
||||||
|
} else {
|
||||||
|
// 知识库模型
|
||||||
|
const res = await completion(params)
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
|
||||||
childTempList.value[index].answer = getResult(data.answer);
|
childTempList.value[index].answer = getResult(data.answer);
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
|
|
||||||
|
@ -305,13 +343,14 @@ const againResult = async (index, item) => {
|
||||||
childTempList.value[index].loading = false
|
childTempList.value[index].loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一键研读
|
// 一键研读
|
||||||
const getCompletion = async () => {
|
const getCompletion = async () => {
|
||||||
isStarted.value = new Array(childTempList.length).fill(false)
|
isStarted.value = new Array(childTempList.length).fill(false)
|
||||||
isStarted.value[0] = true
|
isStarted.value[0] = true
|
||||||
|
|
||||||
childTempList.value.forEach(item =>{
|
childTempList.value.forEach(item => {
|
||||||
if(item.answer){
|
if (item.answer) {
|
||||||
item.answer = ''
|
item.answer = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -320,8 +359,27 @@ const getCompletion = async () => {
|
||||||
try {
|
try {
|
||||||
item.loading = true
|
item.loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
let str = cloneDeep(prompt.value)
|
||||||
const { data } = await completion(params)
|
str = str.replace('{模板标题}',item.name)
|
||||||
|
str = str.replace('{模板内容}',item.prompt)
|
||||||
|
params.prompt = str
|
||||||
|
params.template = item.prompt
|
||||||
|
// 教学大模型
|
||||||
|
let data = null
|
||||||
|
if (curMode.value == 1) {
|
||||||
|
const res = await sendChart({
|
||||||
|
content: params.prompt,
|
||||||
|
conversationId: conversation_id.value,
|
||||||
|
stream: false
|
||||||
|
})
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
// 知识库模型
|
||||||
|
else {
|
||||||
|
const res = await completion(params)
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
|
||||||
item.answer = getResult(data.answer)
|
item.answer = getResult(data.answer)
|
||||||
onSaveTemp(item)
|
onSaveTemp(item)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -330,14 +388,14 @@ const getCompletion = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCompleteText = async (answer, index) =>{
|
const handleCompleteText = async (answer, index) => {
|
||||||
if (index < childTempList.value.length - 1) {
|
if (index < childTempList.value.length - 1) {
|
||||||
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||||
}
|
}
|
||||||
if(isAgain.value){
|
if (isAgain.value) {
|
||||||
try{
|
try {
|
||||||
await editTempResult({ id: childTempList.value[index].resultId, content: answer })
|
await editTempResult({ id: childTempList.value[index].resultId, content: answer })
|
||||||
}finally{
|
} finally {
|
||||||
isAgain.value = false
|
isAgain.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,6 +444,30 @@ emitter.on('onGetMain', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 创建对话
|
||||||
|
const conversation_id = ref('')
|
||||||
|
const getChartId = () => {
|
||||||
|
createChart({ app_id: '712ff0df-ed6b-470f-bf87-8cfbaf757be5' }).then(res => {
|
||||||
|
localStorage.setItem("conversation_id", res.data.conversation_id);
|
||||||
|
conversation_id.value = res.data.conversation_id;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询prompt 替换
|
||||||
|
const getPrompt = async () => {
|
||||||
|
const { rows } = await modelList({ model: 5 })
|
||||||
|
let str = rows.find(item => item.name.indexOf(modeType.value) != -1).prompt
|
||||||
|
str = str.replace('{学段}', curNode.edustage)
|
||||||
|
str = str.replace('{学科}', curNode.edusubject)
|
||||||
|
let bookV = curNode.roottitle.split('-')[1] + '版本'
|
||||||
|
str = str.replace('{教材版本}', bookV)
|
||||||
|
str = str.replace('{课程名称}', `《${curNode.itemtitle}》`)
|
||||||
|
if(modeType.value == '课标'){
|
||||||
|
str = str.replace('{课标名称}', `${curNode.edustage}${curNode.edusubject}课标`)
|
||||||
|
}
|
||||||
|
prompt.value = str
|
||||||
|
}
|
||||||
|
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
const modeType = ref('')
|
const modeType = ref('')
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -396,6 +478,15 @@ onMounted(() => {
|
||||||
getTemplateList()
|
getTemplateList()
|
||||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||||
params.dataset_id = dataSetJson[jsonKey]
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
|
// 获取百度千帆会话ID
|
||||||
|
conversation_id.value = localStorage.getItem('conversation_id')
|
||||||
|
if (!conversation_id.value) {
|
||||||
|
getChartId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取prompt
|
||||||
|
getPrompt()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 解绑
|
// 解绑
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="blockBox">
|
<div class="blockBox">
|
||||||
<el-button @click="currentType = 'selection'"><el-image src="../../../src/assets/images/mouse-pointer.png"
|
<el-button @click="currentType = 'selection'"><el-image :src="pointerImg"
|
||||||
style="width: 14px; height: 14px; color: silver" /></el-button>
|
style="width: 14px; height: 14px; color: silver" /></el-button>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="type == 'design'">
|
<template v-if="type == 'design'">
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
<!-- 边框粗细 -->
|
<!-- 边框粗细 -->
|
||||||
<div class="blockBox">
|
<div class="blockBox">
|
||||||
<el-dropdown @command="updateStyle('lineWidth', $event)" placement="top">
|
<el-dropdown @command="updateStyle('lineWidth', $event)" placement="top">
|
||||||
<el-button><el-image src="../../../src/assets/images/borderwidth.png"
|
<el-button><el-image :src="borderImg"
|
||||||
style="width: 14px; height: 14px"></el-image></el-button>
|
style="width: 14px; height: 14px"></el-image></el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
|
@ -303,6 +303,9 @@ import {
|
||||||
import Contextmenu from './components/Contextmenu.vue'
|
import Contextmenu from './components/Contextmenu.vue'
|
||||||
import { fontFamilyList, fontSizeList } from './constants'
|
import { fontFamilyList, fontSizeList } from './constants'
|
||||||
|
|
||||||
|
const borderImg = new URL('../../../src/assets/images/borderwidth.png', import.meta.url).href
|
||||||
|
const pointerImg = new URL('../../../src/assets/images/mouse-pointer.png', import.meta.url).href
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
@ -42,9 +42,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { completion } from '@/api/mode/index'
|
import { completion } from '@/api/mode/index'
|
||||||
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { ElMessage } from 'element-plus'
|
import { sendChart } from '@/api/ai/index'
|
||||||
|
|
||||||
const textarea = ref('')
|
const textarea = ref('')
|
||||||
|
|
||||||
|
@ -56,6 +57,14 @@ const props = defineProps({
|
||||||
default: () => {
|
default: () => {
|
||||||
return { name: '11' }
|
return { name: '11' }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
curMode:{
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
conversation_id: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -77,13 +86,36 @@ const send = () => {
|
||||||
}
|
}
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
|
|
||||||
// 获取会话ID
|
const params = reactive(
|
||||||
|
{
|
||||||
|
prompt: '',
|
||||||
|
dataset_id: '',
|
||||||
|
template: ''
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 大模型对话
|
||||||
const getConversation = async (val) => {
|
const getConversation = async (val) => {
|
||||||
try {
|
try {
|
||||||
const { data } = await completion({
|
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}课标,对${curNode.itemtitle}进行教学分析`
|
||||||
dataset_id: 'cee3062a9fcf11efa6910242ac140006',
|
params.template = props.item.prompt
|
||||||
prompt: val
|
|
||||||
|
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({
|
msgList.value.push({
|
||||||
type: 'robot',
|
type: 'robot',
|
||||||
msg: data.answer,
|
msg: data.answer,
|
||||||
|
@ -94,15 +126,16 @@ const getConversation = async (val) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveAdjust = (item) => {
|
const saveAdjust = (item) => {
|
||||||
// emit('saveAdjust', item.msg)
|
|
||||||
emitter.emit('changeAdjust', item.msg)
|
|
||||||
isDialog.value = false
|
isDialog.value = false
|
||||||
ElMessage.success('操作成功')
|
emitter.emit('onSaveAdjust', item.msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
|
// 框架设计 用课标的dataset_id
|
||||||
|
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||||
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
<div class="container-right flex">
|
<div class="container-right flex">
|
||||||
<div class="right-header flex">
|
<div class="right-header flex">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<el-button type="primary" link>
|
<!-- <el-button type="primary" link>
|
||||||
<i class="iconfont icon-jiahao"></i>新活动
|
<i class="iconfont icon-jiahao"></i>新活动
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" link>
|
<el-button type="primary" link>
|
||||||
<i class="iconfont icon-baocun"></i>保存为教学模式
|
<i class="iconfont icon-baocun"></i>保存为教学模式
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
|
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
||||||
|
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
|
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
|
||||||
<el-button type="primary">生成大纲</el-button>
|
<el-button type="primary">生成大纲</el-button>
|
||||||
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
||||||
|
@ -35,7 +38,8 @@
|
||||||
<div class="item-prompt">{{ item.prompt }}</div>
|
<div class="item-prompt">{{ item.prompt }}</div>
|
||||||
<div class="item-answer" v-if="item.answer">
|
<div class="item-answer" v-if="item.answer">
|
||||||
<div class="answer-text">
|
<div class="answer-text">
|
||||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
||||||
|
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="item-btn flex">
|
<div class="item-btn flex">
|
||||||
<el-button type="primary" link @click="againResult(index, item)">
|
<el-button type="primary" link @click="againResult(index, item)">
|
||||||
|
@ -58,8 +62,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<EditDialog v-model="isEdit" :item="curItem" />
|
<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"/>
|
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog" />
|
||||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||||
<!--添加、编辑提示词-->
|
<!--添加、编辑提示词-->
|
||||||
<keywordDialog v-model="isWordDialog" :item="curItem" />
|
<keywordDialog v-model="isWordDialog" :item="curItem" />
|
||||||
|
@ -73,15 +77,17 @@ import emitter from '@/utils/mitt'
|
||||||
import EditDialog from './edit-dialog.vue'
|
import EditDialog from './edit-dialog.vue'
|
||||||
import AdjustDialog from './adjust-dialog.vue'
|
import AdjustDialog from './adjust-dialog.vue'
|
||||||
import progressDialog from './progress-dialog.vue'
|
import progressDialog from './progress-dialog.vue'
|
||||||
import { completion, tempResult, tempSave, removeChildTemp, editTempResult } from '@/api/mode/index.js'
|
import { completion, tempResult, tempSave, removeChildTemp, editTempResult, modelList } from '@/api/mode/index.js'
|
||||||
|
import { createChart, sendChart } from '@/api/ai/index'
|
||||||
// import { dataSetJson } from '@/utils/comm.js'
|
// import { dataSetJson } from '@/utils/comm.js'
|
||||||
import * as commUtils from '@/utils/comm.js'
|
import * as commUtils from '@/utils/comm.js'
|
||||||
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
||||||
import keywordDialog from './keyword-dialog.vue'
|
import keywordDialog from './keyword-dialog.vue'
|
||||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
import { PPTXFileToJson } from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
||||||
import * as API_entpcourse from '@/api/education/entpcourse' // 相关api
|
import * as API_entpcourse from '@/api/education/entpcourse' // 相关api
|
||||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||||
import * as Api_server from '@/api/apiService' // 相关api
|
import * as Api_server from '@/api/apiService' // 相关api
|
||||||
|
@ -100,7 +106,7 @@ const pgDialog = reactive({ // 弹窗-进度条
|
||||||
width: 300,
|
width: 300,
|
||||||
showClose: false,
|
showClose: false,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
beforeClose: done => {}, // 阻止-弹窗事件
|
beforeClose: done => { }, // 阻止-弹窗事件
|
||||||
pg: { // 进度条-参数
|
pg: { // 进度条-参数
|
||||||
percentage: 0, // 百分比
|
percentage: 0, // 百分比
|
||||||
color: [
|
color: [
|
||||||
|
@ -110,6 +116,19 @@ const pgDialog = reactive({ // 弹窗-进度条
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const curMode = ref(1)
|
||||||
|
const modeOptions = ref([
|
||||||
|
{
|
||||||
|
label: '教学大模型',
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '知识库模型',
|
||||||
|
value: 2
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
emitter.on('changeMode', (item) => {
|
emitter.on('changeMode', (item) => {
|
||||||
resultList.value = item.child
|
resultList.value = item.child
|
||||||
getTempResult(item.id)
|
getTempResult(item.id)
|
||||||
|
@ -121,8 +140,8 @@ const getCompletion = async () => {
|
||||||
isStarted.value = new Array(resultList.length).fill(false)
|
isStarted.value = new Array(resultList.length).fill(false)
|
||||||
isStarted.value[0] = true
|
isStarted.value[0] = true
|
||||||
|
|
||||||
resultList.value.forEach(item =>{
|
resultList.value.forEach(item => {
|
||||||
if(item.answer){
|
if (item.answer) {
|
||||||
item.answer = ''
|
item.answer = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -131,8 +150,28 @@ const getCompletion = async () => {
|
||||||
try {
|
try {
|
||||||
item.loading = true
|
item.loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject} 对${curNode.itemtitle}进行教学分析`
|
|
||||||
const { data } = await completion(params)
|
let str = cloneDeep(prompt.value)
|
||||||
|
str = str.replace(/{模板名称}/g, item.name)
|
||||||
|
params.prompt = str
|
||||||
|
params.template = item.prompt
|
||||||
|
|
||||||
|
// 教学大模型
|
||||||
|
let data = null
|
||||||
|
if (curMode.value == 1) {
|
||||||
|
const res = await sendChart({
|
||||||
|
content: params.prompt,
|
||||||
|
conversationId: conversation_id.value,
|
||||||
|
stream: false
|
||||||
|
})
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
// 知识库模型
|
||||||
|
else {
|
||||||
|
const res = await completion(params)
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
|
||||||
item.answer = getResult(data.answer)
|
item.answer = getResult(data.answer)
|
||||||
onSaveTemp(item)
|
onSaveTemp(item)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -141,14 +180,14 @@ const getCompletion = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCompleteText = async (answer, index) =>{
|
const handleCompleteText = async (answer, index) => {
|
||||||
if (index < resultList.value.length - 1) {
|
if (index < resultList.value.length - 1) {
|
||||||
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||||
}
|
}
|
||||||
if(isAgain.value){
|
if (isAgain.value) {
|
||||||
try{
|
try {
|
||||||
await editTempResult({ id: resultList.value[index].resultId, content: answer })
|
await editTempResult({ id: resultList.value[index].resultId, content: answer })
|
||||||
}finally{
|
} finally {
|
||||||
isAgain.value = false
|
isAgain.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,26 +273,26 @@ const getTempResult = (id) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToBottom = (height,index) =>{
|
const scrollToBottom = (height, index) => {
|
||||||
|
|
||||||
if (listRef.value) {
|
if (listRef.value) {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
let listDom = listRef.value.children
|
let listDom = listRef.value.children
|
||||||
|
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
// 220 去掉头部
|
// 220 去掉头部
|
||||||
let screenHeight = window.innerHeight - 220
|
let screenHeight = window.innerHeight - 220
|
||||||
if(height > screenHeight){
|
if (height > screenHeight) {
|
||||||
listRef.value.scrollTop = (height - screenHeight + 50)
|
listRef.value.scrollTop = (height - screenHeight + 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
for(let i = 0; i < index; i++){
|
for (let i = 0; i < index; i++) {
|
||||||
sum += listDom[i].clientHeight
|
sum += listDom[i].clientHeight
|
||||||
}
|
}
|
||||||
listRef.value.scrollTop = sum + height
|
listRef.value.scrollTop = sum + height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去掉字符串中的 ### **
|
// 去掉字符串中的 ### **
|
||||||
|
@ -265,11 +304,14 @@ let getResult = (str) => {
|
||||||
const params = reactive(
|
const params = reactive(
|
||||||
{
|
{
|
||||||
prompt: '',
|
prompt: '',
|
||||||
dataset_id: ''
|
dataset_id: '',
|
||||||
|
template: ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const prompt = ref('')
|
||||||
|
|
||||||
const addAiPPT = async(res) => {
|
|
||||||
|
const addAiPPT = async (res) => {
|
||||||
let node = courseObj.node
|
let node = courseObj.node
|
||||||
pptDialog.value = false;
|
pptDialog.value = false;
|
||||||
if (!node) return msgUtils.msgWarning('请选择章节?')
|
if (!node) return msgUtils.msgWarning('请选择章节?')
|
||||||
|
@ -291,7 +333,7 @@ const addAiPPT = async(res) => {
|
||||||
// 转换图片|音频|视频 为线上地址
|
// 转换图片|音频|视频 为线上地址
|
||||||
let completed = 0
|
let completed = 0
|
||||||
const total = slides.length
|
const total = slides.length
|
||||||
for( let o of slides ) {
|
for (let o of slides) {
|
||||||
completed++
|
completed++
|
||||||
await toRousrceUrl(o)
|
await toRousrceUrl(o)
|
||||||
// 设置进度条
|
// 设置进度条
|
||||||
|
@ -300,14 +342,14 @@ const addAiPPT = async(res) => {
|
||||||
pgDialog.pg.percentage = 0
|
pgDialog.pg.percentage = 0
|
||||||
pgDialog.visible = false
|
pgDialog.visible = false
|
||||||
// 生成ppt课件-父级
|
// 生成ppt课件-父级
|
||||||
const p_params = {parentContent: JSON.stringify(content)}
|
const p_params = { parentContent: JSON.stringify(content) }
|
||||||
const parentid = await HTTP_SERVER_API('addEntpcoursefile', p_params)
|
const parentid = await HTTP_SERVER_API('addEntpcoursefile', p_params)
|
||||||
if (!!parentid??null) { // 生成内容幻灯片
|
if (!!parentid ?? null) { // 生成内容幻灯片
|
||||||
// 生成备课资源-Smarttalk
|
// 生成备课资源-Smarttalk
|
||||||
HTTP_SERVER_API('addSmarttalk',{fileId: parentid})
|
HTTP_SERVER_API('addSmarttalk', { fileId: parentid })
|
||||||
if (slides.length > 0) {
|
if (slides.length > 0) {
|
||||||
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
const resSlides = slides.map(({ id, ...slide }) => JSON.stringify(slide))
|
||||||
const params = {parentid, filetype: 'slide', title: '', slides: resSlides }
|
const params = { parentid, filetype: 'slide', title: '', slides: resSlides }
|
||||||
const res_3 = await HTTP_SERVER_API('batchAddNew', params)
|
const res_3 = await HTTP_SERVER_API('batchAddNew', params)
|
||||||
if (res_3 && res_3.code == 200) {
|
if (res_3 && res_3.code == 200) {
|
||||||
msgUtils.msgSuccess('生成PPT课件成功')
|
msgUtils.msgSuccess('生成PPT课件成功')
|
||||||
|
@ -332,10 +374,10 @@ const againResult = async (index, item) => {
|
||||||
isAgain.value = true
|
isAgain.value = true
|
||||||
isStarted.value[index] = false
|
isStarted.value[index] = false
|
||||||
resultList.value[index].answer = ''
|
resultList.value[index].answer = ''
|
||||||
if(index == 0){
|
if (index == 0) {
|
||||||
listRef.value.scrollTop = 0
|
listRef.value.scrollTop = 0
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
scrollToBottom(50, index)
|
scrollToBottom(50, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,8 +385,27 @@ const againResult = async (index, item) => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
resultList.value[index].loading = true
|
resultList.value[index].loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
|
|
||||||
const { data } = await completion(params)
|
let str = cloneDeep(prompt.value)
|
||||||
|
str = str.replace(/{模板名称}/g, item.name)
|
||||||
|
params.prompt = str
|
||||||
|
params.template = item.prompt
|
||||||
|
|
||||||
|
let data = null;
|
||||||
|
// 教学大模型
|
||||||
|
if (curMode.value == 1) {
|
||||||
|
const res = await sendChart({
|
||||||
|
content: params.prompt,
|
||||||
|
conversationId: conversation_id.value,
|
||||||
|
stream: false
|
||||||
|
})
|
||||||
|
data = res.data
|
||||||
|
} else {
|
||||||
|
// 知识库模型
|
||||||
|
const res = await completion(params)
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
|
||||||
resultList.value[index].answer = getResult(data.answer)
|
resultList.value[index].answer = getResult(data.answer)
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -360,11 +421,21 @@ const onAdjust = (index, item) => {
|
||||||
Object.assign(curItem, item)
|
Object.assign(curItem, item)
|
||||||
isAdjust.value = true
|
isAdjust.value = true
|
||||||
}
|
}
|
||||||
emitter.on('changeAdjust', (item) => {
|
|
||||||
|
// 替换分析结果
|
||||||
|
emitter.on('onSaveAdjust', (item) => {
|
||||||
resultList.value[curIndex.value].answer = 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) => {
|
const onEdit = (index, item) => {
|
||||||
curIndex.value = index
|
curIndex.value = index
|
||||||
|
@ -386,12 +457,12 @@ const HTTP_SERVER_API = (type, params = {}) => {
|
||||||
fileFlag: 'aippt',
|
fileFlag: 'aippt',
|
||||||
fileShowName: node.itemtitle + '.aippt',
|
fileShowName: node.itemtitle + '.aippt',
|
||||||
textbookId: node.rootid,
|
textbookId: node.rootid,
|
||||||
levelFirstId: node.parentid||node.id,
|
levelFirstId: node.parentid || node.id,
|
||||||
levelSecondId: node.parentid && node.id,
|
levelSecondId: node.parentid && node.id,
|
||||||
fileSource: '个人',
|
fileSource: '个人',
|
||||||
fileRoot: '备课'
|
fileRoot: '备课'
|
||||||
}
|
}
|
||||||
return API_smarttalk.creatAPT({...def, ...params})
|
return API_smarttalk.creatAPT({ ...def, ...params })
|
||||||
}
|
}
|
||||||
case 'addEntpcourse': { // 添加课程
|
case 'addEntpcourse': { // 添加课程
|
||||||
const node = courseObj.node || {}
|
const node = courseObj.node || {}
|
||||||
|
@ -428,7 +499,7 @@ const HTTP_SERVER_API = (type, params = {}) => {
|
||||||
case 'getCourseList': { // 获取课程列表
|
case 'getCourseList': { // 获取课程列表
|
||||||
return API_entpcourse.listEntpcourse(params)
|
return API_entpcourse.listEntpcourse(params)
|
||||||
}
|
}
|
||||||
case 'getCourseFileList':{ // 获取课程文件列表
|
case 'getCourseFileList': { // 获取课程文件列表
|
||||||
return API_entpcoursefile.listEntpcoursefileNew(params)
|
return API_entpcoursefile.listEntpcoursefileNew(params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,7 +526,7 @@ const getDefParams = (params) => {
|
||||||
return Object.assign(def, params)
|
return Object.assign(def, params)
|
||||||
}
|
}
|
||||||
// 图片|音频|视频 转换为在线地址
|
// 图片|音频|视频 转换为在线地址
|
||||||
const toRousrceUrl = async(o) => {
|
const toRousrceUrl = async (o) => {
|
||||||
if (!!o.src) { // 如果有src就转换
|
if (!!o.src) { // 如果有src就转换
|
||||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||||
const isBlobUrl = /^blob:/.test(o.src)
|
const isBlobUrl = /^blob:/.test(o.src)
|
||||||
|
@ -469,28 +540,28 @@ const toRousrceUrl = async(o) => {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const res = await Api_server.Other.uploadFile(formData)
|
const res = await Api_server.Other.uploadFile(formData)
|
||||||
if (res && res.code == 200){
|
if (res && res.code == 200) {
|
||||||
const url = res?.url
|
const url = res?.url
|
||||||
url &&(o.src = url)
|
url && (o.src = url)
|
||||||
}
|
}
|
||||||
} else if (isBlobUrl) { // 视频和音频
|
} else if (isBlobUrl) { // 视频和音频
|
||||||
const res = await fetch(o.src)
|
const res = await fetch(o.src)
|
||||||
const blob = await res.blob()
|
const blob = await res.blob()
|
||||||
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
|
const fileName = o.type == 'video' ? Date.now() + '.mp4' : Date.now() + '.mp3'
|
||||||
const file = commUtils.blobToFile(blob, fileName)
|
const file = commUtils.blobToFile(blob, fileName)
|
||||||
// o.src = fileName
|
// o.src = fileName
|
||||||
// console.log('file', file)
|
// console.log('file', file)
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const ress = await Api_server.Other.uploadFile(formData)
|
const ress = await Api_server.Other.uploadFile(formData)
|
||||||
if (ress && ress.code == 200){
|
if (ress && ress.code == 200) {
|
||||||
const url = ress?.url
|
const url = ress?.url
|
||||||
url &&(o.src = url)
|
url && (o.src = url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||||
if(o?.elements){
|
if (o?.elements) {
|
||||||
for (let element of o.elements) {
|
for (let element of o.elements) {
|
||||||
await toRousrceUrl(element);
|
await toRousrceUrl(element);
|
||||||
}
|
}
|
||||||
|
@ -498,14 +569,44 @@ const toRousrceUrl = async(o) => {
|
||||||
}
|
}
|
||||||
// ======== zdg end ============
|
// ======== zdg end ============
|
||||||
|
|
||||||
|
// 创建对话
|
||||||
|
const conversation_id = ref('')
|
||||||
|
const getChartId = () => {
|
||||||
|
createChart({ app_id: '712ff0df-ed6b-470f-bf87-8cfbaf757be5' }).then(res => {
|
||||||
|
localStorage.setItem("conversation_id", res.data.conversation_id);
|
||||||
|
conversation_id.value = res.data.conversation_id;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询prompt 替换
|
||||||
|
const getPrompt = async () => {
|
||||||
|
const { rows } = await modelList({ model: 5 })
|
||||||
|
let str = rows.find(item => item.name.indexOf('框架设计') != -1).prompt
|
||||||
|
str = str.replace('{学段}', curNode.edustage)
|
||||||
|
str = str.replace('{学科}', curNode.edusubject)
|
||||||
|
let bookV = curNode.roottitle.split('-')[1] + '版本'
|
||||||
|
str = str.replace('{教材版本}', bookV)
|
||||||
|
str = str.replace('{课程名称}', `《${curNode.itemtitle}》`)
|
||||||
|
prompt.value = str
|
||||||
|
}
|
||||||
|
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
courseObj.node = data
|
courseObj.node = data
|
||||||
|
// 框架设计 用课标的dataset_id
|
||||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||||
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
||||||
|
|
||||||
|
// 获取百度千帆会话ID
|
||||||
|
conversation_id.value = localStorage.getItem('conversation_id')
|
||||||
|
if (!conversation_id.value) {
|
||||||
|
getChartId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取prompt
|
||||||
|
getPrompt()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,7 +615,7 @@ onUnmounted(() => {
|
||||||
emitter.off('changeMode')
|
emitter.off('changeMode')
|
||||||
emitter.off('changeResult')
|
emitter.off('changeResult')
|
||||||
emitter.off('changeAdjust')
|
emitter.off('changeAdjust')
|
||||||
|
emitter.off('onSaveAdjust');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,7 +640,7 @@ onUnmounted(() => {
|
||||||
background: #F6F6F6;
|
background: #F6F6F6;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-y: scroll;
|
overflow-y: auto;
|
||||||
|
|
||||||
.con-item {
|
.con-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -548,7 +649,8 @@ onUnmounted(() => {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
&::after{
|
|
||||||
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
|
@ -558,7 +660,8 @@ onUnmounted(() => {
|
||||||
left: -8px;
|
left: -8px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
&::before{
|
|
||||||
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 2px;
|
width: 2px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -567,17 +670,20 @@ onUnmounted(() => {
|
||||||
left: -1px;
|
left: -1px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
&:last-child{
|
|
||||||
&::before{
|
&:last-child {
|
||||||
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 0
|
width: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-top {
|
.item-top {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
.icon-shenglvehao{
|
|
||||||
|
.icon-shenglvehao {
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,6 +248,8 @@ defineExpose({ trigger })
|
||||||
position: fixed;
|
position: fixed;
|
||||||
// height: 90vh;
|
// height: 90vh;
|
||||||
// border: 1px solid;
|
// border: 1px solid;
|
||||||
|
z-index: 99;
|
||||||
|
pointer-events: none;
|
||||||
inset: auto auto 3em 1em;
|
inset: auto auto 3em 1em;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
Loading…
Reference in New Issue