diff --git a/Entities/Contracts/Assignment.cs b/Entities/Contracts/Assignment.cs index e4b4611..7e7d8a2 100644 --- a/Entities/Contracts/Assignment.cs +++ b/Entities/Contracts/Assignment.cs @@ -23,12 +23,15 @@ namespace Entities.Contracts [Column("description")] public string Description { get; set; } + [Column("subject_area")] + public string SubjectArea { get; set; } + [Required] [Column("due_date")] public DateTime DueDate { get; set; } [Column("total_points")] - public decimal? TotalPoints { get; set; } + public float? TotalPoints { get; set; } [Column("created_by")] [ForeignKey("Creator")] diff --git a/Entities/Contracts/AssignmentQuestion.cs b/Entities/Contracts/AssignmentQuestion.cs index adb19a5..2e0ca0e 100644 --- a/Entities/Contracts/AssignmentQuestion.cs +++ b/Entities/Contracts/AssignmentQuestion.cs @@ -23,11 +23,14 @@ namespace Entities.Contracts [Required] [Column("question_number")] - public uint QuestionNumber { get; set; } + public byte QuestionNumber { get; set; } [Column("created_at")] public DateTime CreatedAt { get; set; } + [Column("score")] + public float? Score { get; set; } + [Required] [Column("detail_id")] [ForeignKey("AssignmentGroup")] diff --git a/Entities/Contracts/Submission.cs b/Entities/Contracts/Submission.cs index 2009f91..30affba 100644 --- a/Entities/Contracts/Submission.cs +++ b/Entities/Contracts/Submission.cs @@ -34,8 +34,7 @@ namespace Entities.Contracts public DateTime SubmissionTime { get; set; } [Column("overall_grade")] - [Precision(5, 2)] - public decimal? OverallGrade { get; set; } + public float? OverallGrade { get; set; } [Column("overall_feedback")] public string OverallFeedback { get; set; } diff --git a/Entities/Contracts/SubmissionDetail.cs b/Entities/Contracts/SubmissionDetail.cs index 45670b7..a68d5eb 100644 --- a/Entities/Contracts/SubmissionDetail.cs +++ b/Entities/Contracts/SubmissionDetail.cs @@ -38,8 +38,7 @@ namespace Entities.Contracts public bool? IsCorrect { get; set; } [Column("points_awarded")] - [Precision(5, 2)] - public decimal? PointsAwarded { get; set; } + public float? PointsAwarded { get; set; } [Column("teacher_feedback")] public string TeacherFeedback { get; set; } diff --git a/Entities/DTO/ApiResponse.cs b/Entities/DTO/ApiResponse.cs index f8d9748..cb05d8b 100644 --- a/Entities/DTO/ApiResponse.cs +++ b/Entities/DTO/ApiResponse.cs @@ -14,6 +14,10 @@ this.Result = result; } + public ApiResponse() + { + } + public string Message { get; set; } public bool Status { get; set; } diff --git a/Entities/DTO/ExamDto.cs b/Entities/DTO/ExamDto.cs new file mode 100644 index 0000000..0a95e1a --- /dev/null +++ b/Entities/DTO/ExamDto.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entities.DTO +{ + public class ExamDto + { + public Guid? AssignmentId { get; set; } + public string AssignmentTitle { get; set; } = string.Empty; + public string Description { get; set; } + public string SubjectArea { get; set; } + public List QuestionGroups { get; set; } = new List(); + } + + public class QuestionGroupDto + { + public int Index { get; set; } + + public string Title { get; set; } + + public int Score { get; set; } + + public string QuestionReference { get; set; } + + public List SubQuestions { get; set; } = new List(); + + public List SubQuestionGroups { get; set; } = new List(); + } + + public class SubQuestionDto + { + + public byte Index { get; set; } + + public string Stem { get; set; } + + public float Score { get; set; } + + public List Options { get; set; } = new List(); + + public string SampleAnswer { get; set; } + + public string QuestionType { get; set; } + public string DifficultyLevel { get; set; } + + } + + public class OptionDto + { + public string Value { get; set; } + } +} diff --git a/TechHelper.Client/AI/AIConfiguration.cs b/TechHelper.Client/AI/AIConfiguration.cs index 7714e86..39bc771 100644 --- a/TechHelper.Client/AI/AIConfiguration.cs +++ b/TechHelper.Client/AI/AIConfiguration.cs @@ -166,8 +166,6 @@ "; - - - + public static string Format { get; internal set; } } } diff --git a/TechHelper.Client/AI/AiService.cs b/TechHelper.Client/AI/AiService.cs index e8ed922..ce22ad3 100644 --- a/TechHelper.Client/AI/AiService.cs +++ b/TechHelper.Client/AI/AiService.cs @@ -33,7 +33,6 @@ namespace TechHelper.Client.AI string content = response.Choices[0].Message?.Content; if (!string.IsNullOrEmpty(content)) { - // 移除 ... 标签及其内容 int startIndex = content.IndexOf(""); int endIndex = content.IndexOf(""); if (startIndex != -1 && endIndex != -1 && endIndex > startIndex) @@ -46,11 +45,11 @@ namespace TechHelper.Client.AI } catch (HttpRequestException ex) { - Console.WriteLine($"API 请求错误:{ex.Message}"); + throw; } catch (Exception ex) { - Console.WriteLine($"发生未知错误:{ex.Message}"); + throw; } return null; } diff --git a/TechHelper.Client/Exam/Exam.cs b/TechHelper.Client/Exam/Exam.cs index 015c4b1..0737646 100644 --- a/TechHelper.Client/Exam/Exam.cs +++ b/TechHelper.Client/Exam/Exam.cs @@ -32,7 +32,7 @@ namespace TechHelper.Client.Exam [JsonProperty("题号")] // XML 特性:作为 属性 [XmlAttribute("Id")] - public string Id { get; set; } + public byte Id { get; set; } [JsonProperty("标题")] [XmlElement("T")] // T for Title @@ -60,9 +60,10 @@ namespace TechHelper.Client.Exam // 子题目类 public class SubQuestion { + [JsonProperty("子题号")] [XmlAttribute("Id")] // Id for SubId - public string SubId { get; set; } + public byte SubId { get; set; } [JsonProperty("题干")] [XmlElement("T")] // T for Text (Stem) diff --git a/TechHelper.Client/Exam/ExamParse.cs b/TechHelper.Client/Exam/ExamParse.cs new file mode 100644 index 0000000..6b1e012 --- /dev/null +++ b/TechHelper.Client/Exam/ExamParse.cs @@ -0,0 +1,429 @@ +using System.Text.RegularExpressions; + +namespace TechHelper.Client.Exam.Parse +{ + public class ExamPaper + { + public string Title { get; set; } = "未识别试卷标题"; + public string Descript { get; set; } = "未识别试卷描述"; + public string SubjectArea { get; set; } = "试卷类别"; + public List MajorQuestionGroups { get; set; } = new List(); + public List TopLevelQuestions { get; set; } = new List(); + } + + public class MajorQuestionGroup + { + public string Title { get; set; } = string.Empty; + public string Descript { get; set; } = string.Empty; + public float Score { get; set; } + public List SubMajorQuestionGroups { get; set; } = new List(); + public List Questions { get; set; } = new List(); + public int Priority { get; set; } + } + + public class Question + { + public string Number { get; set; } = string.Empty; + public string Text { get; set; } = string.Empty; + public float Score { get; set; } + public List