@hivegpt/hiveai-angular 0.0.611 → 0.0.612
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/chat-drawer/chat-drawer.component.mjs +14 -12
- package/fesm2015/hivegpt-hiveai-angular.mjs +16 -14
- package/fesm2015/hivegpt-hiveai-angular.mjs.map +1 -1
- package/fesm2020/hivegpt-hiveai-angular.mjs +13 -11
- package/fesm2020/hivegpt-hiveai-angular.mjs.map +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3441,7 +3441,8 @@ class ChatDrawerComponent {
|
|
|
3441
3441
|
reader.read().then(({ done, value }) => {
|
|
3442
3442
|
const lastItem = this.chatLog[this.chatLog.length - 1];
|
|
3443
3443
|
if (done) {
|
|
3444
|
-
|
|
3444
|
+
// Final pass with the complete raw text (aiResponse) for a clean render
|
|
3445
|
+
lastItem.message = this.processMessageForDisplay(this.aiResponse);
|
|
3445
3446
|
this.chatLog.pop();
|
|
3446
3447
|
this.chatLog.push(lastItem);
|
|
3447
3448
|
if (allSuggestions?.length) {
|
|
@@ -3470,7 +3471,7 @@ class ChatDrawerComponent {
|
|
|
3470
3471
|
allSuggestions.push(match?.replace(/<\/?sug>/g, ''));
|
|
3471
3472
|
});
|
|
3472
3473
|
}
|
|
3473
|
-
lastItem.message = this.aiResponse;
|
|
3474
|
+
lastItem.message = this.processMessageForDisplay(this.aiResponse);
|
|
3474
3475
|
this.cdr.markForCheck();
|
|
3475
3476
|
}
|
|
3476
3477
|
else {
|
|
@@ -4675,7 +4676,9 @@ class ChatDrawerComponent {
|
|
|
4675
4676
|
return;
|
|
4676
4677
|
const isNewAiMessage = !this.chatLog.find((p) => p._id == messageId);
|
|
4677
4678
|
const currentChatMessage = this.upsertAiChatMessage(messageId);
|
|
4678
|
-
|
|
4679
|
+
// Accumulate raw text and render markdown in real-time
|
|
4680
|
+
currentChatMessage.rawMessage = `${currentChatMessage.rawMessage || ''}${payload?.text || ''}`;
|
|
4681
|
+
currentChatMessage.message = this.processMessageForDisplay(currentChatMessage.rawMessage);
|
|
4679
4682
|
if (isNewAiMessage) {
|
|
4680
4683
|
// First chunk: hide Thinking indicator and scroll to the message start
|
|
4681
4684
|
this.isChatingWithAi = false;
|
|
@@ -4695,12 +4698,14 @@ class ChatDrawerComponent {
|
|
|
4695
4698
|
break;
|
|
4696
4699
|
}
|
|
4697
4700
|
const currentChatMessage = this.upsertAiChatMessage(messageId);
|
|
4698
|
-
const finalAnswer = payload?.text ?? currentChatMessage.message ?? '';
|
|
4701
|
+
const finalAnswer = payload?.text ?? currentChatMessage.rawMessage ?? currentChatMessage.message ?? '';
|
|
4699
4702
|
const hasCardResponse = this.applyToolResultCardMessage(currentChatMessage, messageId, finalAnswer, payload?.tool_results);
|
|
4700
4703
|
if (!hasCardResponse) {
|
|
4701
4704
|
currentChatMessage.type = 'ai';
|
|
4702
4705
|
currentChatMessage.message = this.processMessageForDisplay(finalAnswer);
|
|
4703
4706
|
}
|
|
4707
|
+
// Clean up raw accumulator
|
|
4708
|
+
delete currentChatMessage.rawMessage;
|
|
4704
4709
|
if (Array.isArray(payload?.suggestions)) {
|
|
4705
4710
|
currentChatMessage.relatedListItems = payload.suggestions;
|
|
4706
4711
|
}
|
|
@@ -4715,13 +4720,10 @@ class ChatDrawerComponent {
|
|
|
4715
4720
|
this.showFeedBackIconsIndex = this.chatLog.length - 1;
|
|
4716
4721
|
this.activeAskMessageId = '';
|
|
4717
4722
|
this.isChatingWithAi = false;
|
|
4718
|
-
// For card responses (tool results), scroll
|
|
4719
|
-
//
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
setTimeout(() => this.scrollToAiMessage(messageId), 30);
|
|
4723
|
-
}
|
|
4724
|
-
else {
|
|
4723
|
+
// For card responses (tool results), don't scroll at all —
|
|
4724
|
+
// user is already viewing the AI text from the streaming phase,
|
|
4725
|
+
// cards render below and the user can scroll down to see them.
|
|
4726
|
+
if (!hasCardResponse) {
|
|
4725
4727
|
this.scrollToBottom();
|
|
4726
4728
|
}
|
|
4727
4729
|
this.focusOnTextarea();
|