Remove all references to chatHistory, add a prompt property instead#86
Merged
Remove all references to chatHistory, add a prompt property instead#86
chatHistory, add a prompt property instead#86Conversation
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
There was a problem hiding this comment.
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
IChatMessageinterface,chatMessageSchema, andchatHistoryproperty from the prototype schema - Added a new optional
promptstring 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.
swest7
previously approved these changes
Nov 27, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This removes the unused and inefficient
chatHistoryproperty from prototypes in the database, and adds apromptstring 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:
Check the contributing guidelines for more details.
Screenshots (if appropriate)