Skip to content

feat: add Recent Predictions history with LocalStorage and UI component#1773

Merged
omroy07 merged 1 commit into
omroy07:mainfrom
Muskankr:feature/recent-predictions-history
May 21, 2026
Merged

feat: add Recent Predictions history with LocalStorage and UI component#1773
omroy07 merged 1 commit into
omroy07:mainfrom
Muskankr:feature/recent-predictions-history

Conversation

@Muskankr
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

This change introduces a Recent Predictions History feature so users can view their last 5 predictions directly in the UI. It improves usability by allowing farmers and contributors to revisit past results without re‑running the model, and aligns with the project’s goal of providing a more interactive and supportive AgriTech assistant.

What changes are included in this PR?

  • Added predictionStorage.js utility for LocalStorage operations (save, get, clear).
  • Updated chat.js to call savePrediction() after each successful prediction.
  • Created RecentPredictions.js component to render stored predictions with timestamp, input, and output.
  • Added a “Clear History” button to reset predictions.
  • Updated chat.html to include a <div id="recent-predictions"></div> placeholder for rendering.

Are these changes tested?

Yes:

  • ✅ Verified predictions are saved in LocalStorage after each chatbot reply.
  • ✅ Confirmed only the last 5 predictions are kept.
  • ✅ Checked that “Clear History” wipes LocalStorage and updates the UI.
  • ✅ Reloaded the page to confirm predictions persist across sessions.

Are there any user-facing changes?

Yes:

  • Users now see a Recent Predictions section below the chat window.
  • Each entry shows timestamp, input, and output.
  • A “Clear History” button is available to reset stored predictions.

Thank you for reviewing my PR!

@github-actions
Copy link
Copy Markdown

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@omroy07 omroy07 merged commit a3334fc into omroy07:main May 21, 2026
1 check passed
@github-actions
Copy link
Copy Markdown

🎉 Congrats @Muskankr on getting your PR merged! 🙌
Thanks for the contribution — looking forward to more from you 🚀

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.

Add “Recent Predictions History” using LocalStorage

2 participants