diff --git a/services/ai/src/graphql/generated/schema.graphql b/services/ai/src/graphql/generated/schema.graphql new file mode 100644 index 0000000..d9f3cd5 --- /dev/null +++ b/services/ai/src/graphql/generated/schema.graphql @@ -0,0 +1,141 @@ +# 自动生成的 GraphQL Federation 子图(v2.1 M0) +# 源文件:ai.proto +# 请勿手动修改;如需调整,改 proto 后重新运行 pnpm run proto:gen-graphql + +extend type Query + +type GeneratedReport @key(fields: "id") { + id: String + content: String + summary: String + recommendations: String + degraded: Boolean + degraded_reason: String +} + +input ChatRequestInput { + messages: ChatMessage + model: String + temperature: Float + user_id: String + session_id: String + data_scope: String +} + +type ChatMessage { + role: String + content: String +} + +input ChatResponseInput { + content: String + model: String + usage: Usage + degraded: Boolean + degraded_reason: String +} + +type Usage { + prompt_tokens: Int + completion_tokens: Int + total_tokens: Int + latency_ms: Int +} + +type ChatChunk { + content: String + done: Boolean +} + +input GenerateQuestionRequestInput { + prompt: String + subject: String + difficulty: String + grade: String + knowledge_point_ids: String + question_type: String + count: Int +} + +type GeneratedQuestion { + question: String + answer: String + explanation: String + question_type: String + difficulty: String + knowledge_point_ids: String + evaluation_score: Float + degraded: Boolean + degraded_reason: String +} + +type GeneratedQuestionChunk { + content: String + done: Boolean + complete_question: GeneratedQuestion +} + +input OptimizeExpressionRequestInput { + text: String + context: String +} + +type OptimizedExpression { + optimized: String + suggestions: String + degraded: Boolean + degraded_reason: String +} + +input GenerateLessonPlanRequestInput { + class_id: String + subject_id: String + topic: String + target_difficulty: String + question_count: Int + user_id: String + data_scope: String +} + +input LessonPlanResponseInput { + workflow_id: String + status: String + estimated_completion_seconds: Int + degraded: Boolean + degraded_reason: String +} + +input GetLessonPlanStatusRequestInput { + workflow_id: String +} + +type LessonPlanStatus { + workflow_id: String + status: String + questions: GeneratedQuestion + error: String + degraded: Boolean + degraded_reason: String +} + +input ConfirmLessonPlanRequestInput { + workflow_id: String +} + +type ConfirmResult { + success: Boolean + persisted_question_ids: String + error: String +} + +input GenerateReportRequestInput { + class_id: String + report_type: String + student_id: String + user_id: String + data_scope: String +} + +extend type Query { + lessonPlanStatus: LessonPlanStatus +} diff --git a/services/data-ana/src/graphql/generated/schema.graphql b/services/data-ana/src/graphql/generated/schema.graphql new file mode 100644 index 0000000..7dc09cc --- /dev/null +++ b/services/data-ana/src/graphql/generated/schema.graphql @@ -0,0 +1,428 @@ +# 自动生成的 GraphQL Federation 子图(v2.1 M0) +# 源文件:analytics.proto +# 请勿手动修改;如需调整,改 proto 后重新运行 pnpm run proto:gen-graphql + +extend type Query + +input GetClassPerformanceRequestInput { + class_id: String + subject_id: String + start_date: String + end_date: String +} + +input GetStudentWeaknessRequestInput { + student_id: String + subject_id: String +} + +input GetLearningTrendRequestInput { + student_id: String + start_date: String + end_date: String + subject_id: String +} + +input GetTeacherDashboardRequestInput { + user_id: String + class_id: String +} + +input GetStudentDashboardRequestInput { + user_id: String +} + +input GetParentDashboardRequestInput { + user_id: String + student_id: String +} + +input GetAdminDashboardRequestInput { + user_id: String + scope: String + scope_id: String +} + +input GetWarningsRequestInput { + class_id: String + severity: String + since: String +} + +input TriggerWarningRequestInput { + target_id: String + warning_type: String + severity: String +} + +input GetMasteryDistributionRequestInput { + class_id: String + subject_id: String + knowledge_point_id: String +} + +input GetStudentMasteryRequestInput { + student_id: String + subject_id: String +} + +input SubscribeMasteryUpdateRequestInput { + student_id: String + class_id: String +} + +input GetStudentGrowthRequestInput { + student_id: String + start_date: String + end_date: String + subject_id: String +} + +input GetAssignmentAnalysisRequestInput { + class_id: String + assignment_id: String + subject_id: String +} + +input GetMasterySummaryRequestInput { + student_id: String + subject_id: String +} + +input ListDiagnosticReportsRequestInput { + student_id: String + since: String + limit: Int +} + +input ListErrorBookItemsRequestInput { + student_id: String + subject_id: String + limit: Int + offset: Int +} + +input GetErrorBookStatsRequestInput { + student_id: String + subject_id: String +} + +type ClassPerformance { + class_id: String + average_score: Float + pass_rate: Float + total_students: Int + scores: StudentScore +} + +type StudentScore { + student_id: String + score: Float + grade: String +} + +type StudentWeakness { + student_id: String + weak_points: WeakPoint +} + +type WeakPoint { + knowledge_point_id: String + title: String + mastery: Float + error_count: Int +} + +type LearningTrend { + student_id: String + points: TrendPoint +} + +type TrendPoint { + date: String + score: Float +} + +type TeacherDashboard { + user_id: String + total_classes: Int + total_students: Int + class_avg_score: Float + pending_homework_count: Int + classes: ClassSummary + top_students: StudentSummary + recent_warnings: WarningInfo +} + +type ClassSummary { + class_id: String + class_name: String + student_count: Int + average_score: Float +} + +type StudentSummary { + student_id: String + student_name: String + score: Float + rank_in_class: Int +} + +type StudentDashboard { + user_id: String + avg_score: Float + class_rank: Int + total_students: Int + weak_points: WeakPoint + recent_trends: TrendPoint + pending_homework: Int +} + +type ParentDashboard { + user_id: String + student_id: String + child_avg_score: Float + child_class_rank: Int + total_class_students: Int + child_weak_points: WeakPoint + child_warnings: WarningInfo +} + +type AdminDashboard { + user_id: String + total_teachers: Int + total_students: Int + total_classes: Int + school_avg_score: Float + recent_warnings: WarningInfo + ai_usage: AIUsageSummary +} + +type AIUsageSummary { + total_requests: String + total_tokens: String + total_cost_cents: String + by_provider: AIUsageByProvider +} + +type AIUsageByProvider { + provider: String + request_count: String + total_tokens: String + cost_cents: String +} + +type WarningList { + warnings: WarningInfo + total: Int +} + +type WarningInfo { + warning_id: String + warning_type: String + target_id: String + target_name: String + threshold: Float + current_value: Float + severity: String + occurred_at: String +} + +input TriggerWarningResponseInput { + warning_id: String + triggered: Boolean +} + +type MasteryDistribution { + class_id: String + mastered_count: Int + progressing_count: Int + weak_count: Int + total_students: Int +} + +type StudentMastery { + student_id: String + knowledge_points: KnowledgePointMastery + overall_mastery: Float +} + +type KnowledgePointMastery { + knowledge_point_id: String + title: String + subject_id: String + mastery_level: Float + mastery_label: String + calculated_at: String +} + +type MasteryUpdateEvent { + event_id: String + student_id: String + knowledge_point_id: String + mastery_level: Float + previous_level: Float + calculated_at: String +} + +type StudentGrowth { + student_id: String + score_trend: TrendPoint + mastery_trend: MasteryTrendPoint + attendance: AttendanceSummary + growth_score: Float + growth_level: String +} + +type MasteryTrendPoint { + calculated_at: String + overall_mastery: Float +} + +type AttendanceSummary { + total_days: Int + present_days: Int + absent_days: Int + late_days: Int + attendance_rate: Float +} + +type AssignmentAnalysis { + assignment_id: String + class_id: String + subject_id: String + average_score: Float + highest_score: Float + lowest_score: Float + total_students: Int + submitted_count: Int + pass_rate: Float + ranges: ScoreRange +} + +type ScoreRange { + label: String + count: Int + percentage: Float +} + +type MasterySummary { + student_id: String + overall_mastery: Float + mastered_count: Int + progressing_count: Int + weak_count: Int + total_knowledge_points: Int + mastery_level: String +} + +type DiagnosticReportList { + student_id: String + reports: DiagnosticReport + total: Int +} + +type DiagnosticReport { + report_id: String + student_id: String + report_type: String + title: String + summary: String + generated_at: String + status: String +} + +type ErrorBookList { + student_id: String + items: ErrorBookItem + total: Int +} + +type ErrorBookItem { + question_id: String + knowledge_point_id: String + knowledge_point_title: String + error_count: Int + last_error_time: String + content: String +} + +type ErrorBookStats { + student_id: String + total_error_questions: Int + total_error_count: Int + by_knowledge_point: KnowledgePointErrorStats + recent_7d_errors: Int +} + +type KnowledgePointErrorStats { + knowledge_point_id: String + title: String + error_count: Int + question_count: Int + error_rate: Float +} + +extend type Query { + classPerformance: ClassPerformance +} + +extend type Query { + studentWeakness: StudentWeakness +} + +extend type Query { + learningTrend: LearningTrend +} + +extend type Query { + teacherDashboard: TeacherDashboard +} + +extend type Query { + studentDashboard: StudentDashboard +} + +extend type Query { + parentDashboard: ParentDashboard +} + +extend type Query { + adminDashboard: AdminDashboard +} + +extend type Query { + warnings: WarningList +} + +extend type Query { + masteryDistribution: MasteryDistribution +} + +extend type Query { + studentMastery: StudentMastery +} + +extend type Query { + studentGrowth: StudentGrowth +} + +extend type Query { + assignmentAnalysis: AssignmentAnalysis +} + +extend type Query { + masterySummary: MasterySummary +} + +extend type Query { + diagnosticReports: [DiagnosticReportList!]! +} + +extend type Query { + errorBookItems: [ErrorBookList!]! +} + +extend type Query { + errorBookStats: ErrorBookStats +}