Skip to content

UX: Add spinner and prevent empty AIText submissions#26

Open
leverforce wants to merge 2 commits intomarcusgreen:mainfrom
leverforce:feature/spinner-validation
Open

UX: Add spinner and prevent empty AIText submissions#26
leverforce wants to merge 2 commits intomarcusgreen:mainfrom
leverforce:feature/spinner-validation

Conversation

@leverforce
Copy link
Copy Markdown

@leverforce leverforce commented Apr 22, 2025

Summary

This PR introduces the following improvements to the AIText Moodle question type:

Spinner UI + Feedback

  • Adds a spinner and visual feedback below the AIText input when the student clicks “Check”
  • Improves perceived performance and UX while waiting for the AI response

Client-Side Empty Submission Prevention

  • Prevents students from submitting an empty response
  • Avoids unnecessary API calls
  • Prevents empty submissions from bypassing the min/max requirement for question
  • Prevent empty submissions from returning responses from the LLM, which could be based on previous submission (So an empty response can get a passing grade in GPT 4)
  • Alert message prompts users to enter text

Language Support

  • Adds two new language strings to qtype_aitext.php:
    • aitextprocessing: "AI is evaluating your answer..."
    • emptyresponsealert: "Please enter a response before checking."

Files Affected

  • renderer.php
  • amd/src/spinner.js
  • amd/build/spinner.min.js, .map
  • lang/en/qtype_aitext.php

Tested in Moodle 4.5 with local_ai_manager backend.

Great Plugin. Happy to contribute, Thanks!

marcusgreen and others added 2 commits April 18, 2025 16:10
Clean up the test_build_full_ai_prompt unit test
- Added a spinner UI to provide feedback during AI evaluation
- Prevented empty submissions via JS validation
- Added language strings for alerts and messages
@marcusgreen
Copy link
Copy Markdown
Owner

This looks very interesting. Would you go to

http://mavg.vs.mythic-beasts.com/mdl50/course/view.php?id=28
Login as a teacher with the credentials
username:t1
password:Password1!

And edit a question (e.g. past tense). Scroll down to response tester and experiment.

This is based on this branch which I finished working on last night
https://github.com/marcusgreen/moodle-qtype_aitext/tree/response_test

Please email me at marcusavgreen at gmail.com, I would be very interested to find out more about you.

@marcusgreen
Copy link
Copy Markdown
Owner

Three days later and I have only just understood what this is about :(
Will look again

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants