How zichen0116/aisystem works
1. System shape
- This repository contains two runtime applications: a Python backend in backend/ and a Vue 3 + Vite frontend in teacher-platform/.
- The frontend is the user-facing workbench for lesson prep, courseware, knowledge base, PPT generation, and admin screens.
- The backend is the API/orchestration layer that owns authentication, persistence, file processing, AI workflows, and async jobs.
2. Frontend boundary
- teacher-platform/src/main.js bootstraps a Vue SPA with Vue Router and Pinia.
- src/views/ holds feature pages such as LessonPrep, CoursewareManage, KnowledgeBase, PersonalCenter, and the ppt/ flow.
- src/components/ is organized by domain: lesson-plan chat/editor UI, knowledge-graph widgets, big-screen/admin widgets, digital human assistant, and shared layout/navigation.
- src/api/ is the only direct network boundary; UI state is mostly kept in stores like user, courseware, knowledge, and ppt.
3. Backend API boundary
- backend/app/main.py is the service entrypoint, and backend/app/api/ is split by business area: auth, lesson_plan, knowledge, courseware, ppt-related endpoints, data_analysis, chat, resource_search, question_generate, question_paper, digital_human, and HTML import/export/upload flows.
- Request/response contracts are separated into backend/app/schemas/, while persistence models live in backend/app/models/.
- backend/app/core/ contains shared platform concerns: config, database wiring, JWT/security, and auth helpers.
4. Primary persisted domain data
- The backend stores structured application state for users, chat history, lesson plans, lesson plan references, courseware, knowledge libraries/assets, question papers, and token blacklists.
- Alembic migrations show the domain evolving around these core entities, including lesson plans, knowledge library, question papers, user profile fields, and PPT schema/intents.
- This is the main transactional boundary: the UI drives workflows, but durable state is owned by the backend database.
5. Knowledge ingestion and RAG layer
- backend/app/services/parsers/ handles uploaded source material from multiple formats: DOCX, PDF, image, and video.
- Parsed content is fed into the RAG stack under backend/app/services/rag/, which includes text splitting, vector storage, reranking, hybrid retrieval, and a graph store.
- The repository includes backend/chroma_data/, indicating a local Chroma vector database used for semantic retrieval.
- This layer backs the knowledge base, reference search, and content-grounded generation features.
6. Lesson plan generation workflow
- Lesson planning is a dedicated AI workflow spanning backend/app/api/lesson_plan.py, backend/app/services/lesson_plan_service.py, and backend/app/services/ai/lesson_generator.py.
- Conversation state is persisted so the frontend can show history, resume prior sessions, and continue editing.
- The endpoint set in the README (generate, modify, list, detail, messages, upload, export) reflects a workflow that combines chat, document references, and document output.
7. AI orchestration layer
- backend/app/services/ai/ contains the main model-facing integration points: dashscope_service, vision_service, asr_service, and supporting tools.
- The graph/ subfolder suggests a stateful orchestration pipeline for multi-step AI reasoning or agent flows.
- This layer is where user prompts, uploaded content, and retrieval results are combined before generating lesson text, analysis, or multimodal outputs.
8. PPT generation as a separate subplatform
- PPT work is unusually deep and deserves its own subsystem: backend/app/generators/ppt/ contains schemas, routes, intent parsing, template settings, file handling, export, parsing, and Celery tasks.
- The frontend mirrors this with a dedicated src/views/ppt/ flow and src/components/lesson-plan-v2/-style rich editors/dialogs for generation, outline, preview, and history.
- There is also a banana_* integration path, indicating a specialized provider or model pipeline for PPT generation.
- This is likely one of the most important architecture boundaries in the repo: it is a multi-step document-generation pipeline rather than a simple CRUD feature.
9. Courseware, resource search, and knowledge management
- backend/app/api/courseware.py, knowledge.py, libraries.py, and resource_search.py support repository and discovery features around teaching assets.
- The frontend’s CoursewareManage, KnowledgeBase, and KnowledgeDetail pages are the corresponding user surfaces.
- These features bridge structured metadata in the database with unstructured content in RAG/vector storage.
10. Data analysis and auxiliary generation tools
- backend/app/services/data_analysis/ is a self-contained pipeline for analyzer logic, chart suggestion/rendering, and LLM-assisted planning/chat.
- On the frontend, LessonPrepData and related views likely consume this subsystem for analytics-oriented teaching prep.
- question_generate and question_paper extend the platform into assessment creation rather than only lesson planning.
11. Async jobs and infrastructure
- backend/app/celery.py and backend/app/tasks.py indicate background processing for long-running jobs such as export, parsing, or AI generation.
- backend/app/services/redis_service.py suggests Redis is part of the async/cache/message infrastructure.
- File and media handling is externalized through oss_service, while email and SMS helpers indicate notification-capable workflows.
- backend/media/ and backend/chroma_data/ are runtime storage areas for assets and embeddings.
12. External integrations and operational boundaries
- The backend integrates with multiple external AI/communications services: DashScope, iflytek VMS, OSS, email, SMS, and a Dify-based resource recommendation service.
- The frontend also bundles an avatar SDK demo/library under public/libs/ and src/libs/, supporting digital human or voice/avatar features.
- These integrations are not core UI concerns; they are backend-mediated services or embedded client-side SDKs that sit at the edge of the platform.
13. Supporting assets, docs, and tests
- docs/ contains design/spec artifacts for the major subsystems, especially knowledge library, RAG reranking, lesson plan generation, 3D knowledge graph, and PPT redesign.
- backend/tests/ is extensive and maps closely to the main architecture: parsers, vector DB, hybrid retrieval, lesson-plan APIs, and PPT helpers.
- These directories are important for understanding system intent, but they are not part of the runtime path.
Main entry points: api API routes · views Workbenches · rag RAG stack · main.js App bootstrap
Components 23
Frontend SPA
Vue 3 + Vite teaching workbench and user/admin surfaces.
- App bootstrap · Bootstraps the frontend with router, Pinia, and global app shell.
teacher-platform/src/main.js - Router · Defines SPA navigation across workbench, admin, PPT, and support screens.
teacher-platform/src/router/index.js - State stores · Central client state for user, courseware, knowledge, PPT, and admin digital human flows.
teacher-platform/src/stores - API client · Typed frontend HTTP boundary for backend-driven workflows.
teacher-platform/src/api - Workbenches · Primary user-facing pages for lesson prep, courseware, knowledge, resource search, personal center, and PPT.
teacher-platform/src/views - UI components · Reusable lesson-plan, knowledge-graph, layout, admin dashboard, and digital human components.
teacher-platform/src/components - PPT flow · Dedicated PPT generation screens for description, outline, preview, history, and orchestration.
teacher-platform/src/views/ppt - PPT intent util · Frontend helper for PPT intent parsing and UI coordination.
teacher-platform/src/utils/pptIntent.js - Avatar SDK · Embedded avatar/voice SDK bundle supporting digital human experiences.
teacher-platform/src/libs/avatar-sdk-web_3.1.2.1002
Backend API
FastAPI-style Python service with orchestration, persistence, AI, and async jobs.
- Service entry · Backend application entrypoint and service bootstrap.
backend/app/main.py - API routes · Business APIs for auth, lesson plans, knowledge, courseware, chat, data analysis, PPT, search, and digital human.
backend/app/api - Core platform · Shared platform wiring for configuration, database, JWT, and security helpers.
backend/app/core - Domain models · Transactional entities for users, chat history, lesson plans, courseware, knowledge assets, question papers, and token blacklist.
backend/app/models - Contracts · API payload contracts and validation models.
backend/app/schemas - Lesson planning · Lesson plan generation, edit, persistence, and export workflow.
backend/app/services/lesson_plan_service.py - AI orchestration · Model-facing services, multimodal tooling, and graph-based orchestration.
backend/app/services/ai - RAG stack · Text splitting, vector storage, reranking, hybrid retrieval, and graph store for grounded generation.
backend/app/services/rag - Ingestion parsers · Format parsers for DOCX, PDF, image, and video sources.
backend/app/services/parsers - PPT platform · Deep PPT generation subsystem with schema, intent parsing, templates, export, parse, and Celery tasks.
backend/app/generators/ppt - Async jobs · Background task execution and Redis-backed infrastructure for long-running jobs.
backend/app/celery.py - External services · DashScope, vision, ASR, OSS, email, SMS, Dify resource recommendation, and other edge integrations.
backend/app/services
Runtime Storage
Local persisted vectors and media used by the backend.
- Chroma store · Local Chroma persistence for semantic retrieval.
backend/chroma_data - Media assets · Runtime media and font assets used by backend exports and processing.
backend/media
Connections 27
- App bootstrap → Router: registers routes · The SPA bootstraps navigation.
- App bootstrap → State stores: installs state · Pinia stores are attached at startup.
- App bootstrap → Workbenches: renders pages · App shell hosts routed workbench views.
- Router → Workbenches: maps to · Routes resolve to lesson prep, courseware, knowledge, PPT, and admin pages.
- Workbenches → UI components: composes · Feature pages are built from shared and domain widgets.
- Workbenches → API client: calls · Pages fetch and mutate backend state through API clients.
- State stores → API client: syncs via · Client state is hydrated and persisted through network calls.
- Workbenches → PPT flow: specializes · PPT generation has its own dedicated UI flow.
- PPT flow → PPT intent util: uses · PPT screens share intent parsing helpers.
- UI components → Avatar SDK: integrates · Digital human components depend on the embedded avatar SDK.
- Service entry → API routes: mounts · Service entrypoint wires all HTTP routes.
- API routes → Core platform: uses · Routes rely on common auth, config, and database services.
- API routes → Contracts: validates · Endpoints exchange structured contracts.
- API routes → Domain models: persists · Business APIs read and write domain entities.
- API routes → Lesson planning: orchestrates · Lesson plan endpoints delegate to the lesson workflow.
- API routes → AI orchestration: invokes · Chat, generation, vision, and analysis endpoints call AI services.
- API routes → RAG stack: retrieves from · Knowledge and search endpoints use the retrieval stack.
- API routes → Ingestion parsers: ingests · Upload and import endpoints route content into parsers.
- API routes → PPT platform: drives · PPT endpoints enter the document-generation pipeline.
- Lesson planning → RAG stack: grounds on · Lesson generation uses retrieved references and knowledge context.
- Lesson planning → AI orchestration: generates with · Lesson workflow calls model-facing services and graph orchestration.
- RAG stack → Chroma store: stores embeddings · Semantic retrieval persists vectors locally.
- PPT platform → Async jobs: queues jobs · PPT generation and export use background processing.
- AI orchestration → Async jobs: offloads · Long-running AI tasks can be executed asynchronously.
- External services → Media assets: reads/writes · Externalized file and media handling uses runtime asset storage.
- PPT platform → External services: uses providers · PPT generation depends on specialized model/provider integrations.
- RAG stack → External services: recommends via · Retrieval and recommendation flows can call external services.