mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:59:36 +08:00
Remove course pages, APIs and the course_study capability. Add anchored note threads and reviewed learning-block generation, queued and withdrawable chat messages, quote attachments, side chats, and the calendar/favorites/navigation updates. Keep preview's existing backend architecture. Wire the new features through its Python application and existing chat engine, retain legacy selected-text requests, persist mid-turn messages in replay, and restore note context when regenerating. Leave stored user data intact. Validate frontend contracts, dependency boundaries, types, 1290 node tests, 840 rendered tests, lint, localization and the production build. Exercise session/notes/API regressions, 53 chat-engine tests and 20 Python/native integration tests with isolated runtime data.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
export interface NoteAIRequest {
|
|
id: number
|
|
prompt: string
|
|
knowledgeRef?: string
|
|
mode?: string
|
|
blockId?: string
|
|
instructions?: string
|
|
autoSend?: boolean
|
|
config?: Record<string, unknown>
|
|
}
|
|
|
|
/** Context is sent to the model, but stays out of restored chat bubbles. */
|
|
export function visibleNotePrompt(content: string): string {
|
|
return content
|
|
.split(
|
|
/\n(?:\n)?(?:<note-generation-context>|<notebook-source>|Learning block kind:|Use note_read then note_suggest|Target block:)/
|
|
)[0]
|
|
.trim()
|
|
}
|
|
export function learningMode(kind: string): string {
|
|
return (
|
|
(
|
|
{
|
|
research: 'deep_research',
|
|
quiz: 'deep_question',
|
|
animation: 'visualize',
|
|
audio: 'audio_overview',
|
|
} as Record<string, string>
|
|
)[kind] || 'chat'
|
|
)
|
|
}
|
|
|
|
/** Keep animation blocks explicit even when their prompt only names a topic. */
|
|
export function learningConfig(
|
|
kind: string,
|
|
config?: Record<string, unknown>
|
|
): Record<string, unknown> | undefined {
|
|
if (kind !== 'animation') return config
|
|
const { output_mode, ...rest } = config || {}
|
|
return {
|
|
...rest,
|
|
render_mode: rest.render_mode || (output_mode === 'image' ? 'manim_image' : 'manim_video'),
|
|
}
|
|
}
|