open-notebook/frontend
Luis Novo 1a67f1f912
fix: enhance chat reference links and prevent text overflow (#173)
This commit addresses two related issues in the chat interface:

1. **Fix broken reference links (OSS-310)**
   - Completely rewrote convertReferencesToMarkdownLinks() with greedy pattern matching
   - Now handles all edge cases: references after commas, nested brackets, bold markdown
   - Added visual icon indicators (FileText, Lightbulb, FileEdit) for reference types
   - Implemented proper error handling with toast notifications
   - Added validation for reference types and ID lengths

2. **Fix long URL/text overflow (#172)**
   - Added break-words and overflow-wrap classes to chat messages
   - Long URLs and text now wrap properly within chat bubbles
   - Applied fix consistently across source chat, notebook chat, and search results

**Technical Details:**
- Enhanced reference detection algorithm processes from end to start to preserve indices
- Context analysis (50 chars before/after) determines original formatting
- Icons are 12px, accessible, and themed appropriately
- All changes pass linting and build successfully

**Files Modified:**
- frontend/src/lib/utils/source-references.tsx (core algorithm rewrite)
- frontend/src/components/source/ChatPanel.tsx (error handling + text wrapping)
- frontend/src/components/search/StreamingResponse.tsx (error handling + text wrapping)
- open_notebook/utils/token_utils.py (ruff formatting fix)

fixes #172
2025-10-19 15:38:59 -03:00
..
public Version 1 (#160) 2025-10-18 12:46:22 -03:00
src fix: enhance chat reference links and prevent text overflow (#173) 2025-10-19 15:38:59 -03:00
.gitignore chore: export docs for custom gpt 2025-10-18 20:26:11 -03:00
components.json Version 1 (#160) 2025-10-18 12:46:22 -03:00
eslint.config.mjs Version 1 (#160) 2025-10-18 12:46:22 -03:00
next.config.ts Version 1 (#160) 2025-10-18 12:46:22 -03:00
package-lock.json chore(deps): bump next from 15.4.2 to 15.4.7 in /frontend (#162) 2025-10-18 12:52:05 -03:00
package.json chore(deps): bump next from 15.4.2 to 15.4.7 in /frontend (#162) 2025-10-18 12:52:05 -03:00
postcss.config.mjs Version 1 (#160) 2025-10-18 12:46:22 -03:00
tailwind.config.ts Version 1 (#160) 2025-10-18 12:46:22 -03:00
tsconfig.json Version 1 (#160) 2025-10-18 12:46:22 -03:00