feat: enhance class report workflows

This commit is contained in:
2026-07-06 17:20:04 +08:00
parent df3b623144
commit 0015063a03
23 changed files with 2500 additions and 478 deletions
+66 -7
View File
@@ -8,8 +8,11 @@ const api = {
ipcRenderer.invoke('student:delete-profile', profileId),
exportEmptyClassFolder: (payload: { className: string; classId: string; childNames: string[] }) =>
ipcRenderer.invoke('classes:export-empty-folder', payload),
loadStudentData: (payload?: { includeProfiles?: boolean; includeImages?: boolean }) =>
ipcRenderer.invoke('student:load', payload),
loadStudentData: (payload?: {
includeProfiles?: boolean
includeImages?: boolean
includeClassImages?: boolean
}) => ipcRenderer.invoke('student:load', payload),
listStudentProfiles: (payload: {
page: number
pageSize: number
@@ -43,6 +46,14 @@ const api = {
ipcRenderer.invoke('student:generate-comment', payload),
generateStudentComments: (payload: { classId?: string; profileIds?: string[] }) =>
ipcRenderer.invoke('student:generate-comments', payload),
addClassZodiacs: (payload: { classId: string }) =>
ipcRenderer.invoke('student:add-class-zodiacs', payload),
pauseCommentGeneration: (batchId: string) =>
ipcRenderer.invoke('comments:pause-generation', batchId),
resumeCommentGeneration: (batchId: string) =>
ipcRenderer.invoke('comments:resume-generation', batchId),
stopCommentGeneration: (batchId: string) =>
ipcRenderer.invoke('comments:stop-generation', batchId),
listModels: (payload: { baseUrl: string; apiKey: string }) =>
ipcRenderer.invoke('models:list', payload),
testModelConnection: (modelConfig: {
@@ -58,7 +69,7 @@ const api = {
classItem: {
id: string
name: string
type: 'cheap' | 'noble'
type: string
teacherNames: string[]
familyPhoto?: string
}
@@ -89,7 +100,7 @@ const api = {
classes: Array<{
id: string
name: string
type: 'cheap' | 'noble'
type: string
teacherNames: string[]
familyPhoto?: string
}>
@@ -120,7 +131,7 @@ const api = {
classes: Array<{
id: string
name: string
type: 'cheap' | 'noble'
type: string
teacherNames: string[]
familyPhoto?: string
}>
@@ -135,6 +146,13 @@ const api = {
maxTokens: string
systemPrompt: string
}) => ipcRenderer.invoke('settings:save', modelConfig),
saveClassTypeConfigs: (
classTypeConfigs: Array<{
id: string
label: string
courseContent: string
}>
) => ipcRenderer.invoke('settings:save-class-types', classTypeConfigs),
loadTemplates: () => ipcRenderer.invoke('templates:load'),
selectTemplateFile: () => ipcRenderer.invoke('templates:select-file'),
parseTemplatePlaceholders: (filePath: string) =>
@@ -153,14 +171,48 @@ const api = {
loadReports: () => ipcRenderer.invoke('reports:load'),
generateReports: (payload: { templateId: string; classId: string; studentIds?: string[] }) =>
ipcRenderer.invoke('reports:generate', payload),
pauseReportGeneration: (batchId: string) =>
ipcRenderer.invoke('reports:pause-generation', batchId),
resumeReportGeneration: (batchId: string) =>
ipcRenderer.invoke('reports:resume-generation', batchId),
stopReportGeneration: (batchId: string) => ipcRenderer.invoke('reports:stop-generation', batchId),
openReport: (filePath: string) => ipcRenderer.invoke('reports:open', filePath),
downloadReport: (id: string) => ipcRenderer.invoke('reports:download', id),
downloadClassReports: (payload: { classId: string }) =>
ipcRenderer.invoke('reports:download-class', payload),
onReportDownloadProgress: (
callback: (progress: {
batchId: string
status: 'started' | 'file-started' | 'file-finished' | 'writing' | 'finished' | 'failed'
classId: string
className: string
reportId?: string
reportTitle?: string
current: number
total: number
filePath?: string
error?: string
}) => void
): (() => void) => {
const listener = (
_: Electron.IpcRendererEvent,
progress: Parameters<typeof callback>[0]
): void => callback(progress)
ipcRenderer.on('reports:download-class-progress', listener)
return () => ipcRenderer.removeListener('reports:download-class-progress', listener)
},
onReportGenerationProgress: (
callback: (progress: {
batchId: string
status: 'started' | 'student-started' | 'student-finished' | 'student-failed' | 'finished'
status:
| 'started'
| 'student-started'
| 'student-finished'
| 'student-failed'
| 'paused'
| 'stopped'
| 'finished'
classId: string
className: string
studentId?: string
@@ -182,7 +234,14 @@ const api = {
onCommentGenerationProgress: (
callback: (progress: {
batchId: string
status: 'started' | 'student-started' | 'student-finished' | 'student-failed' | 'finished'
status:
| 'started'
| 'student-started'
| 'student-finished'
| 'student-failed'
| 'paused'
| 'stopped'
| 'finished'
classId?: string
className?: string
studentId?: string