feat: migrate from react-markdown to streamdown (#394)

| Before (react-markdown) | After (streamdown) |
| --- | --- |
| <img width="300" height="863" alt="Before: react-markdown rendering" src="https://github.com/user-attachments/assets/807d0d3c-8634-45f3-a34f-79dd8139bef2" /> | <img width="300" height="814" alt="After: streamdown rendering" src="https://github.com/user-attachments/assets/8a718a9c-d842-424b-8679-15036076b142" /> |

## Changes Made

- **Dependencies**: Removed `react-markdown` and `remark-gfm`, added `streamdown@^1.1.6`
- **Component Updates**:
    - Updated chat message rendering to use `<Streamdown>` component
    - Maintained all existing functionality for tool state rendering
    - Preserved prose styling classes for consistent appearance
- **Code Quality Improvements**:
    - Fixed TypeScript type issues with message parts
    - Improved switch case structure with proper default cases
    - Replaced array index-based keys with stable message-based keys
    - Added `useCallback` for performance optimization
    - Fixed biome linting issues and switch case fallthrough warnings
This commit is contained in:
MaheshtheDev 2025-08-29 19:45:47 +00:00
parent 815ed22051
commit 5b7f9ceb44
6 changed files with 344 additions and 61 deletions

View file

@ -71,13 +71,12 @@
"react-dom": "^19.1.0",
"react-dropzone": "^14.3.8",
"react-error-boundary": "^6.0.0",
"react-markdown": "^10.1.0",
"recharts": "2",
"remark-gfm": "^4.0.1",
"shadcn-dropzone": "^0.2.1",
"slate": "^0.118.0",
"slate-react": "^0.117.4",
"sonner": "^2.0.5",
"streamdown": "^1.1.6",
"tailwind-merge": "^3.3.1",
"tw-animate-css": "^1.3.4",
"valibot": "^1.1.0",