Skip to content

Remove all references to chatHistory, add a prompt property instead#86

Merged
cmenon12 merged 6 commits intomainfrom
remove-chat-history
Nov 28, 2025
Merged

Remove all references to chatHistory, add a prompt property instead#86
cmenon12 merged 6 commits intomainfrom
remove-chat-history

Conversation

@cmenon12
Copy link
Member

@cmenon12 cmenon12 commented Nov 25, 2025

Description

This removes the unused and inefficient chatHistory property from prototypes in the database, and adds a prompt string property. This will contain the text prompt used, or undefined if the JSON was updated directly.

The assistant message and timestamp in the chat history are already stored elsewhere for each prototype, and prototypes are already linked through the previousId.

This is not a breaking change but work should be done later to migrate existing prototypes, see #85.

Related issues: closes #73

Checklist before marking as ready for review

Before marking as ready for review, please check that you have:

  • Added appropriate and passing tests for the changes I made.
  • Not broken any existing functionality or tests.
  • Not introduced any new linting or formatting errors.
  • Only added new dependencies that are necessary, do not introduce security vulnerabilities, and with tilde (~) version ranges.
  • Checked and resolved UI accessibility issues using Axe devtools. Unresolved issues are described above.
  • Updated the documentation if necessary.

Check the contributing guidelines for more details.

Screenshots (if appropriate)

body-parser  <2.2.1
Severity: moderate
body-parser is vulnerable to denial of service when url encoding is used - GHSA-wqch-xfxh-vrr4
fix available via `npm audit fix`
node_modules/body-parser
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR successfully removes the unused chatHistory property from the prototype schema and replaces it with a simpler prompt property. The change streamlines the data model by eliminating redundant storage of information that was already captured elsewhere (assistant message and timestamp are stored in the prototype's json.explanation and timestamp fields, and prototypes are linked via previousId).

Key Changes

  • Removed IChatMessage interface, chatMessageSchema, and chatHistory property from the prototype schema
  • Added a new optional prompt string property to store the text prompt used for each prototype version
  • Simplified prototype creation and update logic by removing chatHistory management code
  • Updated tests to reflect the new data structure

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
src/types/schemas/prototype-schema.ts Removed IChatMessage interface and chatHistory schema definition; added prompt as optional string property to IPrototypeData interface and schema
src/routes/prototype-routes.ts Removed chatHistory array building logic from handleUpdatePrototype and handleCreatePrototype; added prompt property with conditional logic (set to user prompt for text input, undefined for JSON input); changed prompt to const in handleCreatePrototype
src/routes/__test__/prototype-routes.test.ts Removed chatHistory expectations from main test case; deleted two chatHistory-specific test cases; added prompt field to test expectations
jest/mockTestData.ts Removed chatHistory array from prototypeData1; added prompt field with sample value

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@cmenon12 cmenon12 marked this pull request as ready for review November 25, 2025 18:20
swest7
swest7 previously approved these changes Nov 27, 2025
@cmenon12 cmenon12 merged commit 358f920 into main Nov 28, 2025
10 checks passed
@cmenon12 cmenon12 deleted the remove-chat-history branch November 28, 2025 14:19
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.

Remove the chat history property from prototypes

2 participants