feat: round out phase 5 of chat migration. - #151
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The streaming sanitizer can still surface partial tool-call payloads mid-stream and the new docs contain broken relative links within the docs/ folder.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Rounds out phase 5 of the chat migration by polishing the AI chat UX, tightening chat response handling, splitting Playwright coverage into a dedicated chat spec, and updating documentation to reflect the OpenRouter BYOK flow separate from GitHub PAT.
Changes:
- Improve AI chat “pending” status presentation (shimmer + reduced-motion support) and add pending-state accessibility metadata.
- Sanitize assistant streaming/fallback content and enforce non-empty assistant output or tool calls.
- Split AI chat Playwright coverage into
playwright/chat/ai-chat.spec.tsand update docs/README messaging for OpenRouter BYOK.
File summaries
| File | Description |
|---|---|
| src/styles/ai-controls.css | Adds a shimmer animation for pending chat status text with reduced-motion fallback. |
| src/modules/chat/request-runner.js | Sanitizes assistant content/tool syntax and hardens stream/fallback result validation. |
| src/modules/chat/model-picker.js | Refactors model catalog loading to async/await and centralizes cleanup of pending promise state. |
| src/modules/chat/drawer.js | Tracks pending state in DOM dataset and sets aria-busy while requests are in-flight. |
| src/index.html | Updates PAT guidance to clarify OpenRouter key is used for chat separately. |
| README.md | Adds OpenRouter BYOK doc link and clarifies PAT vs chat key responsibilities. |
| playwright/github-byot-ai.spec.ts | Removes chat-focused tests, keeping PR/BYOT coverage in this suite. |
| playwright/chat/ai-chat.spec.ts | New dedicated AI chat Playwright suite covering BYOK gating, streaming/fallback, and apply/undo flows. |
| docs/openrouter-migration-plan.md | Updates implementation status to reflect phase completion and new test/doc locations. |
| docs/openrouter-byok.md | Introduces OpenRouter BYOK setup guide for chat + model catalog loading. |
| docs/localstorage-state.md | Documents the new OpenRouter key localStorage entry. |
| docs/byot.md | Updates BYOT doc to reflect PAT no longer powers chat; links to OpenRouter BYOK guide. |
| docs/ai-chat-context-and-payload-strategy.md | Updates the referenced Playwright spec path for chat behavior coverage. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+11
to
+19
| const sanitizeAssistantContent = value => { | ||
| if (typeof value !== 'string' || !value) { | ||
| return '' | ||
| } | ||
|
|
||
| return value | ||
| .replace(/<\|tool_call_start\|>[\s\S]*?<\|tool_call_end\|>/g, '') | ||
| .replace(/<\|tool_call_start\|>|<\|tool_call_end\|>/g, '') | ||
| } |
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.
No description provided.