feat: 完善 AI 对话、每日作息与课件目录体验

新增持久化对话、追问卡片和轮次导航;支持每日子时间表、切换保留课程与自动课间;完善课件逐层目录、学期周次同步及两端自适应。同步迁移、文档和回归截图。

验证:后端 262/262、AI 55 项、Web 81/81、桌面 71/71、授权 23 项;构建、类型、Lint 与文档检查通过。
This commit is contained in:
LoveChengke committed 2026-11-08 09:07:10 +08:00
1 parent cdb64c5499
commit 9351203deb
59 files changed
+1277 -149

No files matched your search

@@ -1,3 +1,4 @@
import { fillLayoutBreaks } from './auto-breaks.js';
import { createHash } from 'node:crypto';
import { z } from 'zod';
import { isDayKey, dayKeyLocal } from '@classhelper/shared';
@@ -102,6 +103,17 @@ export async function importProfile(user: TokenPayload, classId: string, payload
await tx.scheduledClassPlan.deleteMany({ where: { classId } });
await tx.classPlan.deleteMany({ where: { classId } });
}
for (const [id, value] of Object.entries(layouts)) {
const parent = object(value).ParentTimeLayoutId;
if (
parent != null &&
(typeof parent !== 'string' ||
!layouts[parent] ||
parent === id ||
object(layouts[parent]).ParentTimeLayoutId)
)
throw ApiError.badRequest('父时间表不存在或存在循环、嵌套关系');
}
const layoutIds = new Map<string, { id: string; lessons: string[] }>();
for (const [id, value] of Object.entries(layouts)) {
const l = object(value),
@@ -129,6 +141,8 @@ export async function importProfile(user: TokenPayload, classId: string, payload
if (timeType !== 'DIVIDER' && startTime >= endTime)
throw ApiError.badRequest('时间点结束必须晚于开始');
const pointData = {
slotKey: typeof p.SlotKey === 'string' ? p.SlotKey.slice(0, 100) : '',
isAutoBreak: p.IsAutoBreak === true,
timeLayoutId: created.id,
position,
name: String(p.Name || '').slice(0, 64),
@@ -151,6 +165,14 @@ export async function importProfile(user: TokenPayload, classId: string, payload
await tx.timeLayoutItem.deleteMany({ where: { timeLayoutId: created.id, id: { notIn: pointIds } } });
layoutIds.set(id, { id: created.id, lessons });
}
for (const [id, value] of Object.entries(layouts)) {
const target = layoutIds.get(id),
parent = layoutIds.get(String(object(value).ParentTimeLayoutId));
if (target) {
await tx.timeLayout.update({ where: { id: target.id }, data: { parentId: parent?.id ?? null } });
await fillLayoutBreaks(tx, target.id);
}
}
for (const [id, value] of Object.entries(layouts)) {
const source = layoutIds.get(String(object(value).OverlaySourceId)),
target = layoutIds.get(id);