-
Notifications
You must be signed in to change notification settings - Fork 27
feat: add student tiles to dashboard #1833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Japrolol
merged 8 commits into
pz_feat_1717_add_dashboard_admin_tiles
from
pz_feat_1718_add_dashboard_student_tiles
Aug 7, 2026
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fa8d88e
feat: add student tiles to dashboard
Pieselak 75fb14c
feat: add student tiles to dashboard
Pieselak 7d206d0
fix: address student dashboard review feedback
Japrolol e2700d2
Merge admin dashboard tiles
Japrolol 192f1bc
feat: add dashboard tiles and AI mentor practice
Japrolol 3ba4270
fix: resolve dashboard web lint errors
Japrolol 50dd273
fix: align practice spec and dashboard expectations
Japrolol 8abb600
test: stabilize dashboard widget catalog
Japrolol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { Injectable } from "@nestjs/common"; | ||
|
|
||
| import { QUEUE_NAMES, QueueService } from "src/queue"; | ||
|
|
||
| import type { Job } from "bullmq"; | ||
| import type { AiMentorPracticeJobData } from "src/ai/ai-practice.types"; | ||
|
|
||
| export const AI_MENTOR_PRACTICE_JOB_NAME = "generate-ai-mentor-practice"; | ||
|
|
||
| @Injectable() | ||
| export class AiPracticeQueueService { | ||
| constructor(private readonly queueService: QueueService) {} | ||
|
|
||
| enqueue(data: AiMentorPracticeJobData): Promise<Job<AiMentorPracticeJobData>> { | ||
| return this.queueService.enqueue( | ||
| QUEUE_NAMES.AI_MENTOR_PRACTICE, | ||
| AI_MENTOR_PRACTICE_JOB_NAME, | ||
| data, | ||
| { | ||
| attempts: 3, | ||
| backoff: { type: "exponential", delay: 1000 }, | ||
| removeOnComplete: true, | ||
| removeOnFail: false, | ||
| }, | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { SUPPORTED_LANGUAGES } from "@repo/shared"; | ||
| import { Type, type Static } from "@sinclair/typebox"; | ||
|
|
||
| import { AI_MENTOR_PRACTICE_STATUSES } from "src/ai/ai-practice.types"; | ||
| import { responseAiJudgeJudgementSchema } from "src/ai/utils/ai.schema"; | ||
| import { THREAD_STATUS } from "src/ai/utils/ai.type"; | ||
| import { UUIDSchema } from "src/common"; | ||
|
|
||
| const practiceScenarioSchema = Type.String({ minLength: 1, maxLength: 3000 }); | ||
|
|
||
| export const createAiMentorPracticeSchema = Type.Object({ | ||
| language: Type.Enum(SUPPORTED_LANGUAGES), | ||
| scenario: practiceScenarioSchema, | ||
| }); | ||
|
|
||
| export const aiMentorPracticeSessionSchema = Type.Object({ | ||
| id: UUIDSchema, | ||
| practiceDate: Type.String(), | ||
| language: Type.Enum(SUPPORTED_LANGUAGES), | ||
| title: Type.Union([Type.String(), Type.Null()]), | ||
| aiMentorName: Type.Union([Type.String(), Type.Null()]), | ||
| threadId: Type.Union([UUIDSchema, Type.Null()]), | ||
| threadStatus: Type.Union([Type.Enum(THREAD_STATUS), Type.Null()]), | ||
| taskGoal: Type.Union([Type.String(), Type.Null()]), | ||
| evaluation: Type.Union([responseAiJudgeJudgementSchema, Type.Null()]), | ||
| status: Type.Enum(AI_MENTOR_PRACTICE_STATUSES), | ||
| errorCode: Type.Union([Type.String(), Type.Null()]), | ||
| }); | ||
|
|
||
| export const nullableAiMentorPracticeSessionSchema = Type.Union([ | ||
| aiMentorPracticeSessionSchema, | ||
| Type.Null(), | ||
| ]); | ||
|
|
||
| export type CreateAiMentorPracticeBody = Static<typeof createAiMentorPracticeSchema>; | ||
| export type AiMentorPracticeSessionResponse = Static<typeof aiMentorPracticeSessionSchema>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import type { LocalizedText, SupportedLanguages } from "@repo/shared"; | ||
| import type { SQL } from "drizzle-orm"; | ||
| import type { UUIDType } from "src/common"; | ||
| import type { | ||
| aiJudgeBlockingErrors, | ||
| aiJudgeConfigurations, | ||
| aiJudgeCriteria, | ||
| aiJudgeScoreGuidance, | ||
| } from "src/storage/schema"; | ||
|
|
||
| export { AI_MENTOR_PRACTICE_STATUSES } from "@repo/shared"; | ||
| export type { AiMentorPracticeStatus } from "@repo/shared"; | ||
|
|
||
| export type AiMentorPracticeJobData = { | ||
| tenantId: UUIDType; | ||
| sessionId: UUIDType; | ||
| }; | ||
|
|
||
| export type AiMentorPracticeGenerationInput = { | ||
| scenario: string; | ||
| language: SupportedLanguages; | ||
| }; | ||
|
|
||
| export type AiPracticeJudgeConfigurationGraph = { | ||
| configuration: Omit< | ||
| typeof aiJudgeConfigurations.$inferInsert, | ||
| "id" | "tenantId" | "practiceSessionId" | "taskGoal" | ||
| > & { | ||
| id: UUIDType; | ||
| practiceSessionId: UUIDType; | ||
| taskGoal: LocalizedText | SQL<unknown>; | ||
| }; | ||
| criteria: Array< | ||
| Omit<typeof aiJudgeCriteria.$inferInsert, "title" | "expectedBehavior"> & { | ||
| title?: LocalizedText | SQL<unknown>; | ||
| expectedBehavior?: LocalizedText | SQL<unknown>; | ||
| } | ||
| >; | ||
| scoreGuidance: Array< | ||
| Omit<typeof aiJudgeScoreGuidance.$inferInsert, "description" | "example"> & { | ||
| description?: LocalizedText | SQL<unknown>; | ||
| example?: LocalizedText | SQL<unknown> | null; | ||
| } | ||
| >; | ||
| blockingErrors: Array< | ||
| Omit<typeof aiJudgeBlockingErrors.$inferInsert, "description"> & { | ||
| description?: LocalizedText | SQL<unknown>; | ||
| } | ||
| >; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { | ||
| Injectable, | ||
| InternalServerErrorException, | ||
| Logger, | ||
| type OnModuleDestroy, | ||
| } from "@nestjs/common"; | ||
| import { Worker } from "bullmq"; | ||
|
|
||
| import { AI_MENTOR_PRACTICE_JOB_NAME } from "src/ai/ai-practice.queue.service"; | ||
| import { AiPracticeService } from "src/ai/services/ai-practice.service"; | ||
| import { QUEUE_NAMES, QueueService } from "src/queue"; | ||
| import { TenantDbRunnerService } from "src/storage/db/tenant-db-runner.service"; | ||
|
|
||
| import type { Job } from "bullmq"; | ||
| import type { AiMentorPracticeJobData } from "src/ai/ai-practice.types"; | ||
|
|
||
| @Injectable() | ||
| export class AiPracticeWorker implements OnModuleDestroy { | ||
| private readonly logger = new Logger(AiPracticeWorker.name); | ||
| private readonly worker: Worker<AiMentorPracticeJobData>; | ||
|
|
||
| constructor( | ||
| private readonly queueService: QueueService, | ||
| private readonly practiceService: AiPracticeService, | ||
| private readonly tenantRunner: TenantDbRunnerService, | ||
| ) { | ||
| this.worker = new Worker<AiMentorPracticeJobData>( | ||
| QUEUE_NAMES.AI_MENTOR_PRACTICE, | ||
| (job) => this.process(job), | ||
| { | ||
| connection: this.queueService.getConnection(), | ||
| concurrency: Number(process.env.AI_MENTOR_PRACTICE_WORKER_CONCURRENCY || 2), | ||
| }, | ||
| ); | ||
| this.worker.on("failed", (job, error) => { | ||
| this.logger.error(`AI Mentor practice job ${job?.id} failed: ${error.message}`); | ||
| }); | ||
| } | ||
|
|
||
| private async process(job: Job<AiMentorPracticeJobData>) { | ||
| if (job.name !== AI_MENTOR_PRACTICE_JOB_NAME) | ||
| throw new InternalServerErrorException(`Unexpected AI practice job name: ${job.name}`); | ||
|
|
||
| await this.tenantRunner.runWithTenant(job.data.tenantId, () => | ||
| this.practiceService.processGenerationJob(job.data), | ||
| ); | ||
| } | ||
|
|
||
| async onModuleDestroy() { | ||
| await this.worker.close(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why publish event to handler just to enqueue it later to bullmq. Can we either enqueue it directly or run the actions from worker directly in handler?