init: AI Grading Assistant MVP
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<template v-if="dialogType">
|
||||
<SettingDialog v-if="dialogType === 'settings'" />
|
||||
<HistoryDialog v-if="dialogType === 'history'" />
|
||||
<TemplateDialog v-if="dialogType === 'templates'" />
|
||||
<RubricEditor v-if="dialogType === 'rubric'" />
|
||||
<ResultDrawer v-if="dialogType === 'result'" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<router-view />
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { useAppStore } from '@/stores/app'
|
||||
import { useSettingsStore } from '@/stores/settings'
|
||||
import { useGradingStore } from '@/stores/grading'
|
||||
import ResultDrawer from '@/components/ResultDrawer.vue'
|
||||
import SettingDialog from '@/components/SettingDialog.vue'
|
||||
import HistoryDialog from '@/pages/HistoryDialog.vue'
|
||||
import TemplateDialog from '@/pages/TemplateDialog.vue'
|
||||
import RubricEditor from '@/components/RubricEditor.vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
const gradingStore = useGradingStore()
|
||||
|
||||
const dialogType = new URLSearchParams(window.location.search).get('dialog')
|
||||
|
||||
onMounted(async () => {
|
||||
if (dialogType === 'result') {
|
||||
const data = await window.electronAPI?.grading.getData()
|
||||
if (data) {
|
||||
if (data.image) gradingStore.setImage(data.image)
|
||||
if (data.rubric) gradingStore.setRubric(data.rubric)
|
||||
if (data.result) gradingStore.setResult(data.result)
|
||||
if (data.questionTitle) gradingStore.setQuestionTitle(data.questionTitle)
|
||||
if (data.maxScore) gradingStore.setMaxScore(data.maxScore)
|
||||
if (data.referenceAnswer) gradingStore.setReferenceAnswer(data.referenceAnswer)
|
||||
}
|
||||
appStore.openResultDrawer()
|
||||
} else if (dialogType) {
|
||||
if (dialogType === 'settings') await settingsStore.loadSettings()
|
||||
const actions: Record<string, () => void> = {
|
||||
settings: () => appStore.openSettingDialog(),
|
||||
history: () => appStore.openHistoryDialog(),
|
||||
templates: () => appStore.openTemplateDialog(),
|
||||
rubric: () => appStore.openRubricEditor()
|
||||
}
|
||||
actions[dialogType]?.()
|
||||
} else {
|
||||
settingsStore.loadSettings()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user