Conversation
Review Summary by QodoRefactor conversation tags UI and enhance label component
WalkthroughsDescription• Refactor conversation tags UI from checkboxes to custom labels • Add color and ellipsis support to Label component • Improve markdown rendering with list style and separator formatting • Simplify tag management with add/remove functionality Diagramflowchart LR
A["Label Component"] -->|"Add color & ellipsis props"| B["Enhanced Label"]
C["Tag Modal UI"] -->|"Replace checkboxes with labels"| D["Custom Tag Display"]
E["Tag Management"] -->|"Add/Remove tags dynamically"| F["Improved UX"]
G["Markdown Styles"] -->|"Fix list & separator rendering"| H["Better Formatting"]
File Changes1. src/lib/common/shared/Label.svelte
|
Code Review by Qodo
1. Dash line content corrupted
|
| */ | ||
| export function replaceMarkdown(text) { | ||
| let res = text.replace(/#([\s]+)/g, '\\# ').replace(/[-|=]{3,}/g, '@@@'); | ||
| let res = text.replace(/#([\s]+)/g, '\\# ').replace(/^-\s*/gm, '• ').replace(/[-|=]{3,}/g, '•••'); |
There was a problem hiding this comment.
1. Dash line content corrupted 🐞 Bug ✓ Correctness
replaceMarkdown now replaces any start-of-line '-' with a bullet, so content like "-1" or "--flag" is rewritten (e.g., "-1" → "• 1") before Markdown rendering. This changes the meaning of user/assistant messages and logs rendered through Markdown.svelte.
Agent Prompt
### Issue description
`replaceMarkdown()` rewrites any line beginning with `-` into a bullet because it uses `/^\-\s*/gm` (`\s*` matches zero chars). This corrupts non-list text like negative numbers (`-1` -> `• 1`) and CLI flags (`--help` -> `• -help`) before `marked()` renders it.
### Issue Context
`Markdown.svelte` applies `replaceMarkdown()` for all non-raw markdown rendering.
### Fix Focus Areas
- src/lib/helpers/http.js[346-362]
- src/lib/common/markdown/Markdown.svelte[51-62]
### Suggested change
Update the regex to only match markdown list items (dash followed by whitespace), e.g.:
- `res = res.replace(/^-\s+/gm, '• ');`
Optionally require content after whitespace: `res.replace(/^-\s+(?=\S)/gm, '• ')`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| if (toAddTags.length === 0 && toDeleteTags.length === 0) { | ||
| isOpenTagModal = false; | ||
| return; | ||
| } | ||
|
|
||
| isLoading = true; | ||
| updateConversationTags( | ||
| params.conversationId, | ||
| { | ||
| toAddTags: selectedTags, | ||
| toDeleteTags: tagOptions.filter(x => !selectedTags.includes(x.value)).map(x => x.value) | ||
| }) | ||
| { toAddTags, toDeleteTags }) | ||
| .then(res => { | ||
| if (res) { | ||
| conversation.tags = [...convTags]; | ||
| isComplete = true; | ||
| successText = "Tags has been updated!"; | ||
| successText = "Tags have been updated!"; | ||
| setTimeout(() => { | ||
| isComplete = false; | ||
| successText = ""; | ||
| }, duration); | ||
| } else { | ||
| throw "Failed to update chat tags."; | ||
| throw "Failed to update tags."; | ||
| } | ||
| }).catch(() => { | ||
| selectedTags = conversation?.tags || []; | ||
| convTags = conversation?.tags || []; | ||
| isError = true; | ||
| errorText = "Failed to update tags!"; | ||
| setTimeout(() => { |
There was a problem hiding this comment.
2. Tag modal stale state 🐞 Bug ✓ Correctness
updateChatTags() closes the Tags modal by setting isOpenTagModal=false directly, bypassing toggleTagModal()’s close-time reset of newTagText and convTags. As a result, typed-but-not-added tag text (and other transient state) can persist into subsequent modal openings and lead to unintended edits.
Agent Prompt
### Issue description
The Tags modal reset logic lives inside `toggleTagModal()` and only runs when closing via that function. `updateChatTags()` closes the modal by directly setting `isOpenTagModal = false` (including the no-op early return and in `.finally()`), so `newTagText`/`convTags` are not reset for those close paths.
### Issue Context
DialogModal unmounts on close, but component state variables persist; reopening the modal reuses `newTagText` because the reset was skipped.
### Fix Focus Areas
- src/routes/chat/[agentId]/[conversationId]/chat-box.svelte[1407-1468]
### Suggested change
Introduce a dedicated close helper that always resets, and use it everywhere you close the modal:
```js
function closeTagModal() {
isOpenTagModal = false;
newTagText = '';
convTags = conversation?.tags || [];
}
```
Then replace `isOpenTagModal = false` in `updateChatTags()` (early return + finally) with `closeTagModal()`.
Optionally also initialize state on open (inside `toggleTagModal()` when opening) to guarantee a clean modal each time.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.