Skip to content

Conversation

@iceljc
Copy link
Collaborator

@iceljc iceljc commented Sep 5, 2025

PR Type

Enhancement


Description

  • Add is_append property to message handling logic

  • Improve message deduplication for assistant responses

  • Enhance streaming message display conditions


Diagram Walkthrough

flowchart LR
  A["Message Received"] --> B["Check is_append"]
  B --> C["Update Dialog Logic"]
  C --> D["Improved Deduplication"]
  D --> E["Enhanced Display"]
Loading

File Walkthrough

Relevant files
Enhancement
chat-box.svelte
Enhance message handling and display logic                             

src/routes/chat/[agentId]/[conversationId]/chat-box.svelte

  • Add is_append check in message deduplication logic
  • Include isThinking condition in stream end detection
+2/-1     
conversationTypes.js
Add is_append property to message type                                     

src/lib/helpers/types/conversationTypes.js

  • Add is_append boolean property to ChatResponseModel type definition
+1/-0     

@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Sep 5, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

The deduplication condition now depends on !message.is_append. If upstream messages omit this flag or send null/undefined, the check treats them as appends (falsy) and skips deduplication. Confirm producers always set is_append explicitly and default behavior is intended.

if (!message.is_streaming) {
	if (dialogs[dialogs.length - 1]?.message_id === message.message_id
		&& dialogs[dialogs.length - 1]?.sender?.role === UserRole.Assistant
		&& !message.is_append
	) {
		dialogs[dialogs.length - 1] = {
			...message,
			is_chat_message: true
UX Logic

isStreamEnd now includes !isThinking. Ensure isThinking is always accurate across the stream lifecycle; otherwise end-of-stream controls may remain hidden despite streaming being false, causing stalled UI affordances.

{#if message?.message_id === lastBotMsg?.message_id && message?.uuid === lastBotMsg?.uuid}
	{
		@const isStreamEnd = (message?.rich_content?.message?.text || message?.text) && !isStreaming && !isHandlingQueue && !isThinking
	}	
	<div style={`display: ${isStreamEnd ? 'flex' : 'none'}; gap: 10px; flex-wrap: wrap; margin-top: 5px;`}>
		{#if PUBLIC_LIVECHAT_SPEAKER_ENABLED === 'true'}
Type Contract

Added is_append to the model JSDoc, but no default or description of semantics. Clarify whether it’s required, default value, and how it interacts with is_streaming to avoid ambiguity in consumers.

* @property {RichContent} rich_content - Rich content.
* @property {string} post_action_disclaimer - The message disclaimer.
* @property {string} data - The message data.
* @property {Object} states
* @property {Date} created_at - The message sent time.
* @property {boolean} has_message_files
* @property {boolean} is_chat_message
* @property {boolean} is_streaming
* @property {boolean} is_append
* @property {string} [indication]
*/

@iceljc iceljc merged commit af33589 into SciSharp:main Sep 5, 2025
1 of 2 checks passed
@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Sep 5, 2025

PR Code Suggestions ✨

No code suggestions found for the PR.

@iceljc iceljc requested a review from Oceania2018 September 5, 2025 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant