feat: persist chats & stream everything#1
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements persistent chats with full-streaming support and modernizes UI components across the app.
- Adds Livewire components and tests for chat listing, viewing, and interactions with streaming messages
- Introduces a reusable JavaScript markdown processor for real-time rendering of streamed content
- Refactors Blade templates for consistent attribute formatting and removes the legacy welcome view
Reviewed Changes
Copilot reviewed 101 out of 106 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.js | Clean up imports and single-quote consistency |
| routes/web.php | Redirect home, define dashboard and chat routes |
| resources/js/components/markdownProcessor.js | New markdownProcessor module for streamed content |
| resources/views/livewire/chats/*.blade.php | Full chat UI and message streaming templates |
| tests/Feature/Livewire/Chats/{Index,Show}Test.php | Comprehensive Livewire chat tests |
Comments suppressed due to low confidence (1)
resources/js/components/markdownProcessor.js:1
- [nitpick] The
markdownProcessormodule contains non-trivial parsing, theming, and streaming logic but currently has no dedicated unit tests. Consider adding JS tests to cover JSON parsing, theme switching, and rendered output.
/**
| } | ||
|
|
||
| // Try to parse as JSON first (new format) | ||
| const jsonData = JSON.parse(content); |
There was a problem hiding this comment.
JSON.parse can throw a runtime exception if content is not valid JSON. Wrap this in a try/catch or validate the string before parsing to prevent the component from breaking.
| const jsonData = JSON.parse(content); | |
| let jsonData = null; | |
| try { | |
| jsonData = JSON.parse(content); | |
| } catch (error) { | |
| console.error("Failed to parse JSON content:", error); | |
| // Skip processing invalid JSON | |
| return; | |
| } |
There was a problem hiding this comment.
doesn't matter, each component needs to always successfully parse
| Route::get('settings/appearance', Appearance::class)->name('settings.appearance'); | ||
| }); | ||
|
|
||
| Route::get('chats/{chat}', ChatsShow::class)->middleware('can:view,chat')->name('chat.show'); |
There was a problem hiding this comment.
This route relies only on the can:view policy and is not wrapped in auth middleware. Consider adding ->middleware('auth') so unauthorized or unauthenticated users cannot trigger authorization logic inadvertently.
| Route::get('chats/{chat}', ChatsShow::class)->middleware('can:view,chat')->name('chat.show'); | |
| Route::get('chats/{chat}', ChatsShow::class)->middleware(['auth', 'can:view,chat'])->name('chat.show'); |
There was a problem hiding this comment.
no, we want guests to see public chats
No description provided.