Skip to content

feat(Grade By Step): Summarize student work using AI#2266

Merged
hirokiterashima merged 21 commits intodevelopfrom
cm-component-ai-summarizer
Mar 26, 2026
Merged

feat(Grade By Step): Summarize student work using AI#2266
hirokiterashima merged 21 commits intodevelopfrom
cm-component-ai-summarizer

Conversation

@hirokiterashima
Copy link
Copy Markdown
Member

@hirokiterashima hirokiterashima commented Feb 4, 2026

This is a new feature that uses OpenAI LLM to summarize Open Response and Discussion activities in the Teacher Tools.

Changes

For units with AI enabled (see "Test Prep" below), in the CM for any OpenResponse and Discussion items:

  • Show "Generate Student Summary" button if there is at least one response for the period selected (includes when "All Periods" is selected)
    • Clicking on the button generates summary and displays it.
      • Show spinner while waiting
      • Shows summary in the same language as the prompt
      • Show (# responses) after summary
    • Summary is saved in localStorage. Coming back to the component should re-display the summary
    • Clicking on the button again generates new summary and overwrites the existing one.
  • Show "No student responses" if there is no response for the period selected

Test Prep

  1. Test with feat(OpenAI integration): Specify chat api url WISE-API#317. Set values for openai.api.key and openai.chat.api.url.
  2. Add top-level json field in the unit to enable this feature:
{
  ...
  "ai": { "enabled": true }
  ...
}

Test

  • Changes work as described above
  • Units that don't have AI enabled do not show the summarizer

@hirokiterashima hirokiterashima self-assigned this Feb 4, 2026
@qltysh
Copy link
Copy Markdown

qltysh bot commented Feb 4, 2026

❌ 1 blocking issue (1 total)

Tool Category Rule Count
qlty Structure Function with many parameters (count = 7): constructor 1

@qltysh
Copy link
Copy Markdown

qltysh bot commented Feb 4, 2026

Qlty

Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (8)

RatingFile% DiffUncovered Line #s
New file Coverage rating: F
src/app/services/chat/chat.service.ts0.0%6-31
New file Coverage rating: F
src/app/services/localStorageService.ts30.0%10-40
New file Coverage rating: A
...open-response-ai-summary/open-response-ai-summary.component.ts100.0%
New file Coverage rating: B
src/app/chatbot/chatbot.component.ts77.8%170, 178
New file Coverage rating: C
src/app/services/chat/openAiChat.service.ts100.0%
New file Coverage rating: A
...ves/teacher-summary-display/ai-summary/ai-summary.component.ts92.5%45-48
New file Coverage rating: F
...splay/discussion-ai-summary/discussion-ai-summary.component.ts38.9%21-42
New file Coverage rating: F
...torComponents/component-summary/component-summary.component.ts25.0%52-104
Total64.4%
🤖 Increase coverage with AI coding...

In the `cm-component-ai-summarizer` branch, add test coverage for this new code:

- `src/app/chatbot/chatbot.component.ts` -- Lines 170 and 178
- `src/app/services/chat/chat.service.ts` -- Line 6-31
- `src/app/services/localStorageService.ts` -- Line 10-40
- `src/assets/wise5/classroomMonitor/classroomMonitorComponents/component-summary/component-summary.component.ts` -- Line 52-104
- `src/assets/wise5/directives/teacher-summary-display/ai-summary/ai-summary.component.ts` -- Line 45-48
- `src/assets/wise5/directives/teacher-summary-display/discussion-ai-summary/discussion-ai-summary.component.ts` -- Line 21-42

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

private dataService: TeacherDataService,
private dialog: MatDialog,
private projectService: ProjectService,
private summaryService: SummaryService
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 7): constructor [qlty:function-parameters]

@hirokiterashima hirokiterashima added the enhancement New feature of any size or improvement (UI, performance, security) label Mar 19, 2026
@hirokiterashima hirokiterashima marked this pull request as ready for review March 19, 2026 22:45
@hirokiterashima hirokiterashima requested a review from breity March 19, 2026 22:45
Copy link
Copy Markdown
Member

@breity breity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍

I updated styles and layout and only show AI summaries when AI is enabled. Also now overriding the Discussion AI summary caption to specify that summary was generated from total number of posts and comments.

We should refactor ComponentSummaryComponent in another PR and only show any component summary content if there is student work for the activty.

@hirokiterashima hirokiterashima merged commit 021bb91 into develop Mar 26, 2026
1 check passed
@hirokiterashima hirokiterashima deleted the cm-component-ai-summarizer branch March 26, 2026 01:34
@hirokiterashima
Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 5.221.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature of any size or improvement (UI, performance, security) released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants