feat: Refactor result preparation and add contradiction checks
This commit is contained in:
@@ -16,9 +16,9 @@ The implementation will be done in phases, focusing on refactoring the backend l
|
||||
|
||||
These tasks focus on updating the backend to handle the new desire categorization logic.
|
||||
|
||||
- **T001**: [Test] Create a new test file `backend/tests/LLMService.refactor.test.ts` to test the new desire categorization functionality.
|
||||
- **T002**: [Backend] Refactor `backend/src/services/LLMService.ts` to replace the existing `analyzeDesires` method with one that uses the new prompt from `research.md` to categorize desires into `Go-to`, `Also good`, `Considerable`, `No-goes`, and `Needs discussion`.
|
||||
- **T003**: [Backend] Update the WebSocket handler in `backend/src/ws/index.ts` to call the refactored `LLMService.analyzeDesires` method and broadcast the new `Decision` object to clients.
|
||||
- [x] **T001**: [Test] Create a new test file `backend/tests/LLMService.refactor.test.ts` to test the new desire categorization functionality.
|
||||
- [x] **T002**: [Backend] Refactor `backend/src/services/LLMService.ts` to replace the existing `analyzeDesires` method with one that uses the new prompt from `research.md` to categorize desires into `Go-to`, `Also good`, `Considerable`, `No-goes`, and `Needs discussion`.
|
||||
- [x] **T003**: [Backend] Update the WebSocket handler in `backend/src/ws/index.ts` to call the refactored `LLMService.analyzeDesires` method and broadcast the new `Decision` object to clients.
|
||||
|
||||
---
|
||||
|
||||
@@ -27,11 +27,11 @@ These tasks focus on updating the backend to handle the new desire categorizatio
|
||||
**Goal**: A user can submit their desires, and the system checks for inner contradictions.
|
||||
**Independent Test**: Submit a desire set with an inner contradiction (e.g., "I want a dog" and "I don't want any pets" in the same category) and verify that the system returns an error.
|
||||
|
||||
- **T004**: [Test] Add a test case to `backend/tests/LLMService.refactor.test.ts` for the inner contradiction check.
|
||||
- **T005**: [Backend] Implement a new method `checkForInnerContradictions` in `backend/src/services/LLMService.ts` that uses an LLM to detect contradictions within a single desire set.
|
||||
- **T006**: [Backend] Update the `SUBMIT_RESPONSE` message handler in `backend/src/ws/index.ts` to call `checkForInnerContradictions` before accepting a user's submission. If contradictions are found, send an error message back to the user.
|
||||
- **T006a**: [Backend] In the `SUBMIT_RESPONSE` message handler in `backend/src/ws/index.ts`, add validation to ensure each desire field does not exceed 500 characters.
|
||||
- **T006b**: [Frontend] [P] Update the `frontend/src/components/DesireForm.tsx` component to display a character counter under each input field.
|
||||
- [x] **T004**: [Test] Add a test case to `backend/tests/LLMService.refactor.test.ts` for the inner contradiction check.
|
||||
- [x] **T005**: [Backend] Implement a new method `checkForInnerContradictions` in `backend/src/services/LLMService.ts` that uses an LLM to detect contradictions within a single desire set.
|
||||
- [x] **T006**: [Backend] Update the `SUBMIT_RESPONSE` message handler in `backend/src/ws/index.ts` to call `checkForInnerContradictions` before accepting a user's submission. If contradictions are found, send an error message back to the user.
|
||||
- [x] **T006a**: [Backend] In the `SUBMIT_RESPONSE` message handler in `backend/src/ws/index.ts`, add validation to ensure each desire field does not exceed 500 characters.
|
||||
- [x] **T006b**: [Frontend] [P] Update the `frontend/src/components/DesireForm.tsx` component to display a character counter under each input field.
|
||||
|
||||
---
|
||||
|
||||
@@ -40,18 +40,18 @@ These tasks focus on updating the backend to handle the new desire categorizatio
|
||||
**Goal**: The frontend can correctly display the categorized results from the refactored backend.
|
||||
**Independent Test**: Given a set of desires from multiple users, the frontend correctly renders the `Go-to`, `Also good`, `Considerable`, `No-goes`, and `Needs discussion` categories.
|
||||
|
||||
- **T007**: [Frontend] [P] Update the `Decision` and related types in `frontend/src/hooks/useSession.ts` to match the new backend structure defined in `data-model.md`.
|
||||
- **T008**: [Test] [P] Create a test file `frontend/src/components/ResultsDisplay.refactor.test.tsx` to test the updated `ResultsDisplay` component.
|
||||
- **T009**: [Frontend] Refactor the `frontend/src/components/ResultsDisplay.tsx` component to display the new categories (`goTos`, `alsoGoods`, `considerables`, `noGoes`, `needsDiscussion`).
|
||||
- [x] **T007**: [Frontend] [P] Update the `Decision` and related types in `frontend/src/hooks/useSession.ts` to match the new backend structure defined in `data-model.md`.
|
||||
- [x] **T008**: [Test] [P] Create a test file `frontend/src/components/ResultsDisplay.refactor.test.tsx` to test the updated `ResultsDisplay` component.
|
||||
- [x] **T009**: [Frontend] Refactor the `frontend/src/components/ResultsDisplay.tsx` component to display the new categories (`goTos`, `alsoGoods`, `considerables`, `noGoes`, `needsDiscussion`).
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Polish & Integration
|
||||
|
||||
- **T010**: Perform end-to-end testing of the entire workflow.
|
||||
- **T011**: Clean up any old code related to the previous desire grouping logic.
|
||||
- **T012**: Remove the old test files `backend/tests/llmService.test.ts` and `frontend/src/components/ResultsDisplay.test.tsx` after verifying the new tests provide adequate coverage.
|
||||
- **T013**: [Test] Conduct performance testing to ensure that the desire submission process completes in under 1 minute as per SC-004.
|
||||
- [x] **T010**: Perform end-to-end testing of the entire workflow.
|
||||
- [x] **T011**: Clean up any old code related to the previous desire grouping logic.
|
||||
- [x] **T012**: Remove the old test files `backend/tests/llmService.test.ts` and `frontend/src/components/ResultsDisplay.test.tsx` after verifying the new tests provide adequate coverage.
|
||||
- [x] **T013**: [Test] Conduct performance testing to ensure that the desire submission process completes in under 1 minute as per SC-004.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user