feat: configure canvas pages sent for note analysis
Canvas analysis previously sent every page. Add a Magic Notes setting for 1-8 canvas pages, defaulting to 1 for new and historical settings. Select the first N pages in current canvas order before capture and use the same text/image range for saved entries, drafts and canvas-source todos. Keep full 50-page saving/export, expose the same setting through config tools, and use the shared settings select with an inline help icon. Include pagination, persistence, production IPC and isolated Electron regressions, including text-only input and scaled page boundaries. Validation: focused feature tests and isolated Electron regressions passed; the final compact UI passed 14 tests. Typecheck and lint were reported passing by the coordinating agent. No full-suite pass is claimed because the completed full test command exposed no summary. No live model calls were made for this commit preparation. Release note: 魔法笔记新增“发送画布页数”设置,可选 1~8 页,默认 1 页,按当前画布顺序发送前 N 页的文字和图片;标题旁问号可查看说明,保存和导出完整画布不受影响。
This commit is contained in:
@@ -360,6 +360,7 @@ export const magicNoteAnalysisOptionsSchema = z
|
||||
requestId: z.string().uuid(),
|
||||
direction: magicNoteCommentDirectionSchema,
|
||||
format: magicNoteCommentFormatSchema,
|
||||
canvasPageText: z.array(z.object({ pageId: z.string().min(1), text: z.string().max(20_001) }).strict()).max(8).optional(),
|
||||
canvasImages: z.array(z.object({ pageId: z.string().min(1), dataUrl: z.string().regex(/^data:image\/(?:jpeg|png);base64,[A-Za-z0-9+/]+={0,2}$/) }).strict()).max(50).optional()
|
||||
})
|
||||
.strict()
|
||||
@@ -374,8 +375,8 @@ export const magicNoteAnalyzeSchema = z
|
||||
...magicNoteAnalysisOptionsSchema.shape
|
||||
})
|
||||
.strict()
|
||||
.refine((input) => !input.canvasImages?.length || input.expectedRevision !== undefined, {
|
||||
message: '画布截图必须提供记录版本', path: ['expectedRevision']
|
||||
.refine((input) => !(input.canvasImages?.length || input.canvasPageText?.length) || input.expectedRevision !== undefined, {
|
||||
message: '画布截图或分页文字必须提供记录版本', path: ['expectedRevision']
|
||||
})
|
||||
|
||||
export type MagicNoteEntryAnalysisOptions = MagicNoteAnalysisOptions & { expectedRevision?: number }
|
||||
@@ -394,8 +395,8 @@ export const magicTodoIdSchema = z
|
||||
...magicNoteAnalysisOptionsSchema.shape
|
||||
})
|
||||
.strict()
|
||||
.refine((input) => !input.canvasImages?.length || input.sourceEntryRevision !== undefined, {
|
||||
message: '画布截图必须提供来源记录版本', path: ['sourceEntryRevision']
|
||||
.refine((input) => !(input.canvasImages?.length || input.canvasPageText?.length) || input.sourceEntryRevision !== undefined, {
|
||||
message: '画布截图或分页文字必须提供来源记录版本', path: ['sourceEntryRevision']
|
||||
})
|
||||
|
||||
export type MagicTodoAnalysisOptions = MagicNoteAnalysisOptions & { sourceEntryRevision?: number }
|
||||
|
||||
Reference in New Issue
Block a user