feat(shared-proto): ai/core_edu/iam proto v2 扩展

ai.proto: 新增 GenerateReport RPC + GenerateReportRequest/GeneratedReport message

core_edu.proto: 新增 ExtendExam/ForceSubmitExam/ReorderExamQuestions 3 RPC + message

iam.proto: 新增 CreateUser/UpdateUser/DeleteUser 3 RPC + 4 message
This commit is contained in:
SpecialX
2026-07-14 22:57:18 +08:00
parent 7545956202
commit 843b370b3d
3 changed files with 120 additions and 16 deletions

View File

@@ -23,6 +23,8 @@ service AiService {
rpc GetLessonPlanStatus(GetLessonPlanStatusRequest) returns (LessonPlanStatus); rpc GetLessonPlanStatus(GetLessonPlanStatusRequest) returns (LessonPlanStatus);
// 教师确认备课结果入库(调 content.CreateQuestions // 教师确认备课结果入库(调 content.CreateQuestions
rpc ConfirmLessonPlan(ConfirmLessonPlanRequest) returns (ConfirmResult); rpc ConfirmLessonPlan(ConfirmLessonPlanRequest) returns (ConfirmResult);
// 生成学情报告(班级总结 / 学生详情 / 考试分析)
rpc GenerateReport(GenerateReportRequest) returns (GeneratedReport);
} }
// === 聊天 === // === 聊天 ===
@@ -33,11 +35,11 @@ message ChatRequest {
// 可选上下文ai12 增补BFF 透传用户身份与数据范围) // 可选上下文ai12 增补BFF 透传用户身份与数据范围)
optional string user_id = 4; optional string user_id = 4;
optional string session_id = 5; optional string session_id = 5;
optional string data_scope = 6; // JSON 序列化的 DataScope optional string data_scope = 6; // JSON 序列化的 DataScope
} }
message ChatMessage { message ChatMessage {
string role = 1; // system / user / assistant string role = 1; // system / user / assistant
string content = 2; string content = 2;
} }
@@ -45,8 +47,8 @@ message ChatResponse {
string content = 1; string content = 1;
string model = 2; string model = 2;
Usage usage = 3; Usage usage = 3;
bool degraded = 4; // 降级标记(方案 Bsuccess=true + data 内 degraded bool degraded = 4; // 降级标记(方案 Bsuccess=true + data 内 degraded
string degraded_reason = 5; // 降级原因(如 llm_unavailable / redis_unavailable string degraded_reason = 5; // 降级原因(如 llm_unavailable / redis_unavailable
} }
message Usage { message Usage {
@@ -65,12 +67,12 @@ message ChatChunk {
message GenerateQuestionRequest { message GenerateQuestionRequest {
string prompt = 1; string prompt = 1;
string subject = 2; string subject = 2;
string difficulty = 3; // easy / medium / hard string difficulty = 3; // easy / medium / hard
// 扩展字段ai12 增补) // 扩展字段ai12 增补)
optional string grade = 4; optional string grade = 4;
repeated string knowledge_point_ids = 5; repeated string knowledge_point_ids = 5;
optional string question_type = 6; // single_choice / multi_choice / fill_blank / short_answer / essay optional string question_type = 6; // single_choice / multi_choice / fill_blank / short_answer / essay
optional int32 count = 7; // 生成数量,默认 1 optional int32 count = 7; // 生成数量,默认 1
} }
message GeneratedQuestion { message GeneratedQuestion {
@@ -80,15 +82,15 @@ message GeneratedQuestion {
string question_type = 4; string question_type = 4;
string difficulty = 5; string difficulty = 5;
repeated string knowledge_point_ids = 6; repeated string knowledge_point_ids = 6;
optional double evaluation_score = 7; // 质量评分0.0-1.0,评估三道防线输出) optional double evaluation_score = 7; // 质量评分0.0-1.0,评估三道防线输出)
bool degraded = 8; bool degraded = 8;
string degraded_reason = 9; string degraded_reason = 9;
} }
message GeneratedQuestionChunk { message GeneratedQuestionChunk {
string content = 1; // 逐字内容 string content = 1; // 逐字内容
bool done = 2; bool done = 2;
optional GeneratedQuestion complete_question = 3; // done=true 时携带完整题目 optional GeneratedQuestion complete_question = 3; // done=true 时携带完整题目
} }
// === 表达优化 === // === 表达优化 ===
@@ -109,15 +111,15 @@ message GenerateLessonPlanRequest {
string class_id = 1; string class_id = 1;
string subject_id = 2; string subject_id = 2;
string topic = 3; string topic = 3;
string target_difficulty = 4; // easy / medium / hard string target_difficulty = 4; // easy / medium / hard
int32 question_count = 5; int32 question_count = 5;
string user_id = 6; string user_id = 6;
string data_scope = 7; // JSON 序列化的 DataScope string data_scope = 7; // JSON 序列化的 DataScope
} }
message LessonPlanResponse { message LessonPlanResponse {
string workflow_id = 1; string workflow_id = 1;
string status = 2; // pending / analyzing / generating / pending_review / persisted / failed string status = 2; // pending / analyzing / generating / pending_review / persisted / failed
int32 estimated_completion_seconds = 3; int32 estimated_completion_seconds = 3;
bool degraded = 4; bool degraded = 4;
string degraded_reason = 5; string degraded_reason = 5;
@@ -138,7 +140,7 @@ message LessonPlanStatus {
message ConfirmLessonPlanRequest { message ConfirmLessonPlanRequest {
string workflow_id = 1; string workflow_id = 1;
map<string, string> modifications = 2; // question_id → 修改后内容(可选,教师审核修改) map<string, string> modifications = 2; // question_id → 修改后内容(可选,教师审核修改)
} }
message ConfirmResult { message ConfirmResult {
@@ -146,3 +148,21 @@ message ConfirmResult {
repeated string persisted_question_ids = 2; repeated string persisted_question_ids = 2;
optional string error = 3; optional string error = 3;
} }
// === 学情报告 ===
message GenerateReportRequest {
string class_id = 1;
string report_type = 2; // class_summary / student_detail / exam_analysis
optional string student_id = 3;
string user_id = 4;
string data_scope = 5; // JSON 序列化的 DataScope
}
message GeneratedReport {
string id = 1;
string content = 2; // 报告正文Markdown
string summary = 3; // 摘要
repeated string recommendations = 4; // 教学建议
bool degraded = 5;
string degraded_reason = 6;
}

View File

@@ -6,8 +6,8 @@ package next_edu_cloud.core_edu.v1;
// Covers exam management, homework assignment, grade recording, // Covers exam management, homework assignment, grade recording,
// attendance tracking, and class queries. // attendance tracking, and class queries.
// //
// Total: 9 Service / 40 RPC (P3.13 expanded state per downstream 9-module analysis). // Total: 9 Service / 43 RPC (P3.13 expanded + P3.14 exam realtime events).
// - ExamService: 10 RPC (8 original + SaveExamDraft + RecordExamViolation) // - ExamService: 13 RPC (8 original + SaveExamDraft + RecordExamViolation + ExtendExam + ForceSubmitExam + ReorderExamQuestions)
// - HomeworkService: 5 RPC // - HomeworkService: 5 RPC
// - GradeService: 7 RPC (6 original + GetReportCard) // - GradeService: 7 RPC (6 original + GetReportCard)
// - ClassService: 4 RPC // - ClassService: 4 RPC
@@ -36,6 +36,9 @@ service ExamService {
rpc GradeExam(GradeExamRequest) returns (GradeExamResponse); rpc GradeExam(GradeExamRequest) returns (GradeExamResponse);
rpc SaveExamDraft(SaveExamDraftRequest) returns (SaveExamDraftResponse); rpc SaveExamDraft(SaveExamDraftRequest) returns (SaveExamDraftResponse);
rpc RecordExamViolation(RecordExamViolationRequest) returns (RecordExamViolationResponse); rpc RecordExamViolation(RecordExamViolationRequest) returns (RecordExamViolationResponse);
rpc ExtendExam(ExtendExamRequest) returns (ExtendExamResponse);
rpc ForceSubmitExam(ForceSubmitExamRequest) returns (ForceSubmitExamResponse);
rpc ReorderExamQuestions(ReorderExamQuestionsRequest) returns (ReorderExamQuestionsResponse);
} }
service HomeworkService { service HomeworkService {
@@ -493,6 +496,46 @@ message RecordExamViolationResponse {
string violation_id = 1; string violation_id = 1;
} }
// ----------------------------------------------------------------------------
// Exam realtime events (P3.14: 考试实时事件,供 push-gateway → student-portal WebSocket 推送)
// ----------------------------------------------------------------------------
message ExtendExamRequest {
string exam_id = 1;
int32 extension_seconds = 2; // 延长秒数
string extended_by = 3; // 操作教师 ID
}
message ExtendExamResponse {
bool success = 1;
int32 new_duration = 2; // 延长后的总时长(秒)
}
message ForceSubmitExamRequest {
string exam_id = 1;
repeated string student_ids = 2; // 强制收卷的学生 ID 列表(空=全部未提交学生)
string forced_by = 3; // 操作教师 ID
}
message ForceSubmitExamResponse {
int32 affected_count = 1; // 强制收卷的学生数
}
message QuestionOrderInput {
string question_id = 1;
int32 order = 2;
}
message ReorderExamQuestionsRequest {
string exam_id = 1;
repeated QuestionOrderInput orders = 2; // 新的题目顺序
string reordered_by = 3;
}
message ReorderExamQuestionsResponse {
bool success = 1;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Grade domain extensions (P3.13) // Grade domain extensions (P3.13)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -15,9 +15,24 @@ service IamService {
// 用户信息类 // 用户信息类
rpc GetUserInfo(GetUserInfoRequest) returns (UserInfo); rpc GetUserInfo(GetUserInfoRequest) returns (UserInfo);
rpc BatchGetUsers(BatchGetUsersRequest) returns (BatchGetUsersResponse);
// GetEffectiveDataScope 解析用户可见数据范围DataScope 6 级). // GetEffectiveDataScope 解析用户可见数据范围DataScope 6 级).
// data-ana gRPC 调用此 RPC 解析查询过滤范围coord-cross-review §2 #3 裁决 P4 补全). // data-ana gRPC 调用此 RPC 解析查询过滤范围coord-cross-review §2 #3 裁决 P4 补全).
rpc GetEffectiveDataScope(GetEffectiveDataScopeRequest) returns (EffectiveDataScope); rpc GetEffectiveDataScope(GetEffectiveDataScopeRequest) returns (EffectiveDataScope);
// 权限与视口类
rpc GetEffectivePermissions(GetEffectivePermissionsRequest) returns (EffectivePermissionsResponse);
rpc GetEffectiveAccess(GetEffectiveAccessRequest) returns (EffectiveAccessResponse);
rpc GetViewports(GetViewportsRequest) returns (ViewportsResponse);
// 密钥与关系类
rpc GetPublicKey(GetPublicKeyRequest) returns (PublicKeyResponse);
rpc GetChildrenByParent(GetChildrenByParentRequest) returns (ChildrenResponse);
// 管理员用户管理类admin-portal §2.3 P1 阻塞项补齐)
rpc CreateUser(CreateUserRequest) returns (UserInfo);
rpc UpdateUser(UpdateUserRequest) returns (UserInfo);
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);
} }
// ========== 认证类 ========== // ========== 认证类 ==========
@@ -159,3 +174,29 @@ message EffectiveDataScope {
repeated string scope_ids = 3; // class_id 列表CLASS 级)/ grade_id 列表GRADE 级) repeated string scope_ids = 3; // class_id 列表CLASS 级)/ grade_id 列表GRADE 级)
string school_id = 4; // SCHOOL 级时的学校 ID string school_id = 4; // SCHOOL 级时的学校 ID
} }
// ========== 管理员用户管理类 ==========
message CreateUserRequest {
string email = 1;
string password = 2;
string name = 3;
string role_id = 4; // 可选:指定角色 ID不传则使用默认 teacher 角色)
string data_scope = 5; // 可选self / subject / class / grade / school / all
}
message UpdateUserRequest {
string user_id = 1;
string name = 2; // 可选
string email = 3; // 可选
string status = 4; // 可选active / inactive / locked
string data_scope = 5; // 可选self / subject / class / grade / school / all
}
message DeleteUserRequest {
string user_id = 1;
}
message DeleteUserResponse {
bool success = 1;
}