This commit is contained in:
2026-06-15 23:14:16 -06:00
parent 4660d10829
commit 6e1263feac
12 changed files with 719 additions and 25 deletions

View File

@@ -70,3 +70,7 @@ export function deleteBook(id: string): Promise<{ ok: true }> {
export function generateLesson(topic: string): Promise<GenerateResult> {
return request('/api/generate', { method: 'POST', body: JSON.stringify({ topic }) })
}
export function generateOutline(theme: string): Promise<{ titles: string[] }> {
return request('/api/generate/outline', { method: 'POST', body: JSON.stringify({ theme }) })
}

View File

@@ -247,7 +247,7 @@ export function parseTeachingDesign(filename: string, markdown: string): Teachin
if (!reflectionTable) {
warnings.push({ code: 'missing-reflection', message: '教学成效与反思表格格式不正确。' })
} else {
for (const row of reflectionTable.rows) {
for (const row of [reflectionTable.header, ...reflectionTable.rows]) {
const label = cleanLabel(row[0] ?? '')
const value = normalizeMultiline(row[1] ?? '')
if (label === '教学成效') design.effectiveness = value

View File

@@ -166,6 +166,24 @@ export function extractMarkdownTable(
const header = splitMarkdownRow(headerLine)
const divider = splitMarkdownRow(dividerLine)
// Handle separator-first tables (no header row: starts with |:---|:---|)
if (header.length > 0 && header.every((cell) => dividerCellPattern.test(cell))) {
const rows: string[][] = []
let end = start
while (end + 1 < lines.length && !insideFence[end + 1] && isTableRow(lines[end + 1]!)) {
end++
const row = splitMarkdownRow(lines[end]!)
if (!row.every((cell) => dividerCellPattern.test(cell))) {
rows.push(row)
}
}
if (rows.length > 0) {
return { start, end, header: [], rows }
}
}
if (
header.length === 0 ||
divider.length !== header.length ||