[KM-497] [DED][FE] Fix chat response formatting and document hover tooltip
Browse files- Re-fetch room messages from API after stream completes to ensure
rendered content matches stored content (fixes formatting not matching
page-refresh behavior)
- Skip preprocessMarkdown during active streaming to prevent regex
processing incomplete markdown chunks
- Add title attribute to document filename for full name on hover
src/app/components/KnowledgeManagement.tsx
CHANGED
|
@@ -521,7 +521,7 @@ export default function KnowledgeManagement({
|
|
| 521 |
<FileText className="w-4 h-4 text-red-400" />
|
| 522 |
</div>
|
| 523 |
<div className="flex-1 min-w-0">
|
| 524 |
-
<p className="text-sm font-medium text-slate-800 truncate">
|
| 525 |
{doc.filename}
|
| 526 |
</p>
|
| 527 |
<p className="text-xs text-slate-400">
|
|
|
|
| 521 |
<FileText className="w-4 h-4 text-red-400" />
|
| 522 |
</div>
|
| 523 |
<div className="flex-1 min-w-0">
|
| 524 |
+
<p className="text-sm font-medium text-slate-800 truncate" title={doc.filename}>
|
| 525 |
{doc.filename}
|
| 526 |
</p>
|
| 527 |
<p className="text-xs text-slate-400">
|
src/app/components/Main.tsx
CHANGED
|
@@ -478,6 +478,9 @@ export default function Main() {
|
|
| 478 |
}
|
| 479 |
}
|
| 480 |
}
|
|
|
|
|
|
|
|
|
|
| 481 |
} catch (err: unknown) {
|
| 482 |
if ((err as Error).name !== "AbortError") {
|
| 483 |
setChats((prev) =>
|
|
@@ -751,7 +754,9 @@ export default function Main() {
|
|
| 751 |
rehypePlugins={[rehypeKatex]}
|
| 752 |
components={markdownComponents}
|
| 753 |
>
|
| 754 |
-
{
|
|
|
|
|
|
|
| 755 |
</ReactMarkdown>
|
| 756 |
</div>
|
| 757 |
)}
|
|
|
|
| 478 |
}
|
| 479 |
}
|
| 480 |
}
|
| 481 |
+
// Re-fetch from API after stream ends to get the authoritative
|
| 482 |
+
// stored content — guarantees formatting matches page-refresh behavior
|
| 483 |
+
await loadRoomMessages(roomId);
|
| 484 |
} catch (err: unknown) {
|
| 485 |
if ((err as Error).name !== "AbortError") {
|
| 486 |
setChats((prev) =>
|
|
|
|
| 754 |
rehypePlugins={[rehypeKatex]}
|
| 755 |
components={markdownComponents}
|
| 756 |
>
|
| 757 |
+
{streamingMsgId === message.id
|
| 758 |
+
? message.content
|
| 759 |
+
: preprocessMarkdown(message.content)}
|
| 760 |
</ReactMarkdown>
|
| 761 |
</div>
|
| 762 |
)}
|