File size: 9,736 Bytes
ac9de5d
33ebc65
 
5e8f957
33ebc65
 
700b192
33ebc65
 
 
 
 
 
 
 
 
247df42
e52e99f
33ebc65
5e8f957
e52e99f
 
8f856eb
247df42
5e8f957
 
33ebc65
247df42
 
928d114
 
5e8f957
bd96783
 
247df42
 
bd96783
77a8561
 
 
 
 
8113b31
413a1af
 
247df42
 
 
5e8f957
c6da0ce
 
 
 
5ba43ca
 
33ebc65
247df42
e52e99f
247df42
5e8f957
 
33ebc65
5e8f957
 
 
 
33ebc65
247df42
1e5e242
 
 
5e8f957
 
 
 
9e660ce
 
 
 
 
 
5e8f957
 
9c7e2d6
 
 
 
 
 
 
5e8f957
 
 
 
 
 
 
 
 
f9f39d1
9e660ce
33ebc65
 
 
247df42
33ebc65
247df42
5e8f957
 
33ebc65
5e8f957
 
 
 
 
33ebc65
 
0b92b50
 
33ebc65
247df42
33ebc65
247df42
33ebc65
 
 
 
5e8f957
 
e52e99f
 
33ebc65
 
5e8f957
247df42
5e8f957
 
 
 
 
 
 
 
 
 
5964851
247df42
e52e99f
247df42
5e8f957
247df42
42332c7
 
d1599a1
247df42
d1599a1
247df42
e52e99f
247df42
 
e52e99f
 
5e8f957
d1599a1
 
5e8f957
247df42
5e8f957
 
 
 
 
 
129fac6
247df42
5e8f957
247df42
129fac6
 
 
 
 
 
36325f8
 
 
2bf9484
36325f8
 
 
e8bfcb9
6b3c2a4
 
 
e8bfcb9
 
5e8f957
 
 
 
 
 
 
 
 
 
 
 
e1c03e9
b785427
 
 
 
e1c03e9
b785427
e8bfcb9
36325f8
5e8f957
 
 
 
 
 
 
 
 
 
 
e52e99f
5e8f957
 
 
 
 
 
 
 
 
e52e99f
 
 
5964851
5e8f957
247df42
5e8f957
247df42
 
 
5e8f957
 
 
 
 
e52e99f
 
 
 
 
5e8f957
 
e52e99f
5e8f957
e52e99f
 
cb7f087
 
e52e99f
 
5e8f957
 
e52e99f
5e8f957
e52e99f
5e8f957
e52e99f
5e8f957
e52e99f
247df42
e52e99f
 
247df42
5964851
 
5e8f957
 
247df42
8113b31
7aec442
247df42
b167385
 
 
5e8f957
 
 
 
 
 
b167385
 
55081a6
 
 
5e8f957
 
55081a6
5e8f957
 
55081a6
 
 
 
5e8f957
 
55081a6
5e8f957
77a8561
55081a6
 
 
 
 
 
 
5e8f957
55081a6
 
 
 
 
 
 
 
 
101d298
 
 
247df42
101d298
247df42
5e8f957
 
101d298
1751a72
101d298
 
 
 
247df42
7aec442
 
 
 
 
5e8f957
 
247df42
ac9de5d
 
247df42
ac9de5d
 
247df42
 
 
 
 
 
 
5964851
58b7bd4
247df42
5e8f957
247df42
 
5e8f957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
019d28a
5e8f957
1d4fe4a
5e8f957
1d4fe4a
8d16fdf
5e8f957
8d16fdf
c6da0ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446

export enum UserRole {
  ADMIN = 'ADMIN',
  PRINCIPAL = 'PRINCIPAL',
  TEACHER = 'TEACHER',
  STUDENT = 'STUDENT',
  USER = 'USER'
}

export enum UserStatus {
  ACTIVE = 'active',
  PENDING = 'pending',
  BANNED = 'banned'
}

export interface User {
  id?: number;
  _id?: string;
  username: string;
  password?: string;
  trueName?: string;
  phone?: string;
  email?: string;
  schoolId?: string;
  role: UserRole | string;
  status: UserStatus | string;
  avatar?: string;
  createTime?: string;
  teachingSubject?: string; 
  homeroomClass?: string; 
  aiAccess?: boolean;
  menuOrder?: string[];
  classApplication?: {
    type: 'CLAIM' | 'RESIGN';
    targetClass?: string;
    status: 'PENDING' | 'REJECTED';
  };
  // For Principal creating a new school
  pendingSchoolData?: {
      name: string;
      code: string;
  };
  studentNo?: string;
  parentName?: string;
  parentPhone?: string;
  address?: string;
  gender?: 'Male' | 'Female';
  seatNo?: string; 
  idCard?: string; 
  doubaoState?: {
      responseId?: string;
      thinkingState?: boolean;
  };
}

export interface Student {
  id?: number;
  _id?: string;
  schoolId?: string;
  studentNo: string;
  seatNo?: string;
  name: string;
  gender: 'Male' | 'Female';
  birthday?: string;
  idCard?: string;
  phone?: string;
  className: string;
  status: 'Enrolled' | 'Graduated' | 'Suspended';
  parentName?: string;
  parentPhone?: string;
  address?: string;
  teamId?: string;
  drawAttempts?: number;
  dailyDrawLog?: { date: string, count: number };
  flowerBalance?: number;
  // New Seating Fields
  height?: number; // cm
  vision?: 'Normal' | 'Near-Mild' | 'Near-Severe' | 'Far' | 'Unknown';
  character?: 'Active' | 'Quiet' | 'Naughty' | 'Steady' | 'Unknown';
  seatRow?: number;
  seatCol?: number;
}

export interface PeriodConfig {
  period: number; 
  name: string;   
  startTime?: string;
  endTime?: string;
}

export interface ClassInfo {
  id?: number;
  _id?: string;
  schoolId?: string;
  grade: string;
  className: string;
  teacherName?: string;
  homeroomTeacherIds?: string[];
  studentCount?: number;
  periodConfig?: PeriodConfig[]; 
  seatingConfig?: { rows: number; cols: number; }; // New layout config
}

export interface Course {
  id?: number;
  _id?: string;
  schoolId?: string;
  courseCode?: string;
  courseName: string;
  teacherName: string;
  teacherId?: string;
  className: string;
  credits?: number;
  capacity?: number;
  enrolled?: number;
}

export type ExamStatus = 'Normal' | 'Absent' | 'Leave' | 'Cheat';

export interface Score {
  id?: number;
  _id?: string;
  schoolId?: string;
  studentName: string;
  studentNo: string;
  courseName: string;
  score: number;
  semester?: string;
  type: string;
  examName?: string;
  status?: ExamStatus;
}

export interface Subject {
  id?: number;
  _id?: string;
  schoolId?: string;
  name: string;
  code?: string;
  color?: string;
  excellenceThreshold?: number;
  thresholds?: Record<string, number>;
}

export interface Exam {
  _id?: string;
  schoolId?: string;
  name: string;
  date: string;
  type: string; // 'Midterm', 'Final', 'Quiz'
  semester?: string;
}

export interface Schedule {
  id?: number;
  _id?: string;
  schoolId?: string;
  className: string;
  teacherName: string;
  subject: string;
  dayOfWeek: number;
  period: number;
  weekType?: 'ALL' | 'ODD' | 'EVEN';
}

export interface School {
  id?: number;
  _id?: string;
  name: string;
  code: string;
}

export interface Notification {
  _id?: string;
  schoolId?: string;
  targetRole?: string;
  targetUserId?: string;
  title: string;
  content: string;
  type: 'info' | 'success' | 'warning' | 'error';
  createTime: string;
}

export interface OpenRouterModelConfig {
  id: string; // The model name (e.g., qwen/qwen3-coder:free)
  name?: string; // Optional friendly name
  apiUrl?: string; // Optional custom API URL
  isCustom: boolean; // Built-in vs Custom
}

export interface DoubaoModelConfig {
  modelId: string; // The Model ID (e.g. doubao-pro-32k)
  endpointId: string; // The Endpoint ID (e.g. ep-2024xxxx) - Required for API
  name?: string; // Friendly Name
}

export interface SystemConfig {
  systemName: string;
  semester: string;
  semesters?: string[];
  allowRegister: boolean;
  allowAdminRegister: boolean;
  allowPrincipalRegister?: boolean; 
  allowStudentRegister?: boolean;
  maintenanceMode: boolean;
  emailNotify: boolean;
  enableAI?: boolean;
  aiTotalCalls?: number;
  aiProviderOrder?: string[]; // 'GEMINI', 'OPENROUTER', 'GEMMA', 'DOUBAO'
  periodConfig?: PeriodConfig[]; 
  apiKeys?: {
      gemini?: string[];
      openrouter?: string[];
      doubao?: string[]; // NEW: Doubao keys
  };
  doubaoModels?: DoubaoModelConfig[]; // NEW
  openRouterModels?: OpenRouterModelConfig[];
}

export interface SchoolCalendarEntry {
  _id?: string;
  schoolId: string;
  className?: string; 
  type: 'HOLIDAY' | 'BREAK' | 'OFF' | 'WORKDAY'; 
  startDate: string; 
  endDate: string; 
  name: string;
}

export interface Todo {
  _id?: string;
  userId: string;
  content: string;
  isCompleted: boolean;
  createTime: string;
}

// Game & Rewards
export interface GameTeam {
  id: string;
  name: string;
  score: number;
  avatar: string;
  color: string;
  members: string[];
}

export interface GameRewardConfig {
  scoreThreshold: number;
  rewardType: 'DRAW_COUNT' | 'ITEM' | 'ACHIEVEMENT';
  rewardName: string;
  rewardValue: number;
  achievementId?: string;
}

export interface GameSession {
  _id?: string;
  schoolId: string;
  className: string;
  subject: string;
  isEnabled: boolean;
  maxSteps: number;
  teams: GameTeam[];
  rewardsConfig: GameRewardConfig[];
}

export interface StudentReward {
  _id?: string;
  schoolId: string;
  studentId: string;
  studentName: string;
  rewardType: 'DRAW_COUNT' | 'ITEM' | 'CONSOLATION' | 'ACHIEVEMENT';
  name: string;
  count: number;
  status: 'PENDING' | 'REDEEMED';
  source: string;
  createTime: string;
  ownerId?: string;
}

export interface LuckyPrize {
  id: string;
  name: string;
  probability: number;
  count: number;
  icon?: string;
}

export interface LuckyDrawConfig {
  _id?: string;
  schoolId: string;
  className: string;
  ownerId?: string;
  prizes: LuckyPrize[];
  dailyLimit: number;
  cardCount: number;
  defaultPrize: string;
  consolationWeight: number;
}

export interface AchievementItem {
  id: string;
  name: string;
  icon: string;
  points: number;
  description?: string;
  addedBy?: string;
  addedByName?: string;
}

export interface ExchangeRule {
  id: string;
  cost: number;
  rewardType: 'DRAW_COUNT' | 'ITEM';
  rewardName: string;
  rewardValue: number;
  achievementId?: string;
}

export interface AchievementConfig {
  _id?: string;
  schoolId: string;
  className: string;
  achievements: AchievementItem[];
  exchangeRules: ExchangeRule[];
}

export interface TeacherExchangeConfig {
  _id?: string;
  schoolId: string;
  teacherId: string;
  teacherName: string;
  rules: ExchangeRule[];
}

export interface StudentAchievement {
  _id?: string;
  schoolId: string;
  studentId: string;
  studentName: string;
  achievementId: string;
  achievementName: string;
  achievementIcon: string;
  points?: number;
  semester: string;
  createTime: string;
}

export interface Attendance {
  _id?: string;
  schoolId: string;
  studentId: string;
  studentName: string;
  className: string;
  date: string;
  status: 'Present' | 'Absent' | 'Leave';
  checkInTime?: string;
}

export interface LeaveRequest {
  _id?: string;
  schoolId: string;
  studentId: string;
  studentName: string;
  className: string;
  reason: string;
  startDate: string;
  endDate: string;
  status: 'Pending' | 'Approved' | 'Rejected';
  createTime: string;
}

export interface Wish {
  _id?: string;
  schoolId: string;
  studentId: string;
  studentName: string;
  className?: string;
  teacherId: string;
  teacherName: string;
  content: string;
  status: 'PENDING' | 'FULFILLED';
  createTime: string;
  fulfillTime?: string;
}

export interface Feedback {
  _id?: string;
  schoolId: string;
  creatorId: string;
  creatorName: string;
  creatorRole: string;
  targetId?: string;
  targetName?: string;
  content: string;
  type: 'ACADEMIC' | 'SYSTEM';
  status: 'PENDING' | 'ACCEPTED' | 'PROCESSED' | 'IGNORED';
  reply?: string;
  createTime: string;
  updateTime?: string;
}

export interface AIChatMessage {
  id: string;
  role: 'user' | 'model';
  text?: string;
  thought?: string; // New: For Deep Thinking Chain of Thought
  audio?: string;
  images?: string[]; 
  isAudioMessage?: boolean;
  isGeneratingAudio?: boolean; // New status flag for UI
  isSearching?: boolean; // New status flag for search
  timestamp: number;
}

// --- Comment Generator Types ---
export type ClassRole = 'YES' | 'NO';
export type Discipline = 'YES' | 'AVERAGE' | 'NO';
export type AcademicQuality = 'EXCELLENT' | 'GOOD' | 'PASS' | 'FAIL';
export type Personality = '活泼' | '内敛' | '沉稳' | '细心' | '热心' | '恒心' | '爱心' | '勇敢' | '正义';
export type Hobby = '体育' | '音乐' | '舞蹈' | '绘画' | '书法' | '手工' | '其他';
export type Labor = '热爱' | '一般' | '较少参与';
export type Zodiac = '鼠' | '牛' | '虎' | '兔' | '龙' | '蛇' | '马' | '羊' | '猴' | '鸡' | '狗' | '猪';

// 学生画像接口
export interface StudentProfile {
    name: string;
    classRole: ClassRole; 
    discipline: Discipline; 
    academic: AcademicQuality; 
    personality: Personality; 
    hobby: Hobby;
    labor: Labor;
    zodiacYear: Zodiac;
    wordCount: number;
}

// 已保存记录接口
export interface SavedRecord {
    id: string;
    name: string;
    comment: string;
    zodiac: Zodiac;
    timestamp: number;
}