Skip to content

ECHO-145 Block empty conversations from being selected in chat#126

Merged
spashii merged 4 commits intomainfrom
block-empty-conversations
May 2, 2025
Merged

ECHO-145 Block empty conversations from being selected in chat#126
spashii merged 4 commits intomainfrom
block-empty-conversations

Conversation

@ussaama
Copy link
Copy Markdown
Contributor

@ussaama ussaama commented May 2, 2025

  • Visual clue to distinguish between empty and non-empty conversations
  • Blocked empty conversations from being added to chat
  • "Empty" tag addition to conversations

Summary by CodeRabbit

  • New Features

    • Conversations without content now display a red "Empty" badge for clearer identification.
    • Empty conversations cannot be added to chat contexts, with tooltips and disabled checkboxes reflecting this restriction.
  • Localization

    • Added translations for "Cannot add empty conversation" and "Empty" in English, German, Spanish, French, and Dutch.
    • Updated source references in localization files to match the latest codebase.

ussaama added 2 commits May 2, 2025 08:55
…content validation

- Added checks to prevent empty conversations from being added to chat context in ConversationAccordion, improving user experience.
- Updated tooltip messages to reflect the inability to add empty conversations.
- Introduced a badge in ProjectConversationTranscript to indicate empty conversations, enhancing visibility for users.
- Implemented logic to verify conversation content before allowing interactions, ensuring meaningful chat context management.
- Adjusted message IDs and context references in German, English, Spanish, French, and Dutch localization files to ensure accurate translations across various UI elements.
- Enhanced existing translations for clarity and consistency, particularly in ProjectChatRoute and related components.
- Updated references in localization files to reflect changes in the codebase, ensuring proper context management in conversation components.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 2, 2025

Walkthrough

This update introduces a mechanism to detect and handle empty conversations—those without any meaningful transcript content—across the Echo frontend. The UI now displays a red "Empty" badge for such conversations in both the conversation accordion and transcript views. Additionally, empty conversations cannot be added to chat contexts, with the UI disabling selection controls and providing localized tooltips explaining the restriction. The change also expands localization resources in English, German, Spanish, French, and Dutch to cover the new "Empty" and "Cannot add empty conversation" messages, updating source references as needed.

Changes

Files/Group Change Summary
echo/frontend/src/components/conversation/ConversationAccordion.tsx
.../ProjectConversationTranscript.tsx
Added logic to detect empty conversations and display a red "Empty" badge; prevents adding empty conversations to chat context; disables related UI controls and tooltips.
echo/frontend/src/locales/en-US.po
de-DE.po
es-ES.po
fr-FR.po
nl-NL.po
Updated source code reference line numbers; added new translation entries for "Cannot add empty conversation" and "Empty".
echo/frontend/src/locales/en-US.ts
de-DE.ts
es-ES.ts
fr-FR.ts
nl-NL.ts
Added new message keys and translations for "Cannot add empty conversation" and/or "Empty" in respective languages.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant ConversationData

    User->>UI: View conversation list
    UI->>ConversationData: Fetch conversation chunks
    ConversationData-->>UI: Return chunks
    UI->>UI: Check if any chunk has non-empty transcript
    alt Conversation is empty
        UI->>User: Show "Empty" badge and disable selection
        User->>UI: Attempt to add conversation to chat context
        UI->>User: Show tooltip "Cannot add empty conversation"
    else Conversation has content
        UI->>User: Enable selection and normal controls
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Block empty conversations from being selectable in chat (ECHO-145)
Indicate empty conversations visually (greyed out or badge) (ECHO-145)

Poem

In the land of Echo, where chats abound,
An empty conversation will now be found—
With a crimson badge, it boldly declares,
"No transcript here!"—so user, beware!
The UI is smarter, translations are neat,
Empty chats can't sneak in, their journey's complete.
LGTM, team—this change is elite! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2691e6 and 9101195.

📒 Files selected for processing (5)
  • echo/frontend/src/locales/de-DE.po (42 hunks)
  • echo/frontend/src/locales/en-US.po (42 hunks)
  • echo/frontend/src/locales/es-ES.po (42 hunks)
  • echo/frontend/src/locales/fr-FR.po (42 hunks)
  • echo/frontend/src/locales/nl-NL.po (42 hunks)
✅ Files skipped from review due to trivial changes (1)
  • echo/frontend/src/locales/fr-FR.po
🚧 Files skipped from review as they are similar to previous changes (4)
  • echo/frontend/src/locales/de-DE.po
  • echo/frontend/src/locales/es-ES.po
  • echo/frontend/src/locales/nl-NL.po
  • echo/frontend/src/locales/en-US.po
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-check-server

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ussaama ussaama requested a review from spashii May 2, 2025 09:03
@ussaama ussaama changed the title Block empty conversations from being selected in chat Echo-145 Block empty conversations from being selected in chat May 2, 2025
@linear
Copy link
Copy Markdown

linear bot commented May 2, 2025

@ussaama ussaama changed the title Echo-145 Block empty conversations from being selected in chat ECHO-145 Block empty conversations from being selected in chat May 2, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
echo/frontend/src/components/conversation/ConversationAccordion.tsx (2)

359-362: Consider extracting hasContent check to reduce duplication

This implementation works great but duplicates the logic from lines 116-119. Consider extracting this check into a utility function or method to maintain DRY.

-  // Check if conversation has any content
-  const hasContent = conversation.chunks?.some(
-    (chunk) => chunk.transcript && chunk.transcript.trim().length > 0
-  );
+  // Import hasConversationContent from a shared utils file
+  const hasContent = hasConversationContent(conversation);

Then in a shared utility file:

export const hasConversationContent = (conversation) => {
  return conversation.chunks?.some(
    (chunk) => chunk.transcript && chunk.transcript.trim().length > 0
  ) ?? false; // Added fallback for null/undefined chunks
}

114-119: Consider adding defensive null check for chunks

Both implementations of the hasContent check could benefit from a null/undefined fallback:

  // Check if conversation has any content
-  const hasContent = conversation.chunks?.some(
+  const hasContent = conversation.chunks?.some(
    (chunk) => chunk.transcript && chunk.transcript.trim().length > 0
-  );
+  ) ?? false;

This would handle edge cases where chunks is null even after the optional chaining.

Also applies to: 359-362

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 446e84c and 55b003b.

📒 Files selected for processing (12)
  • echo/frontend/src/components/conversation/ConversationAccordion.tsx (4 hunks)
  • echo/frontend/src/locales/de-DE.po (41 hunks)
  • echo/frontend/src/locales/de-DE.ts (1 hunks)
  • echo/frontend/src/locales/en-US.po (41 hunks)
  • echo/frontend/src/locales/en-US.ts (1 hunks)
  • echo/frontend/src/locales/es-ES.po (41 hunks)
  • echo/frontend/src/locales/es-ES.ts (1 hunks)
  • echo/frontend/src/locales/fr-FR.po (41 hunks)
  • echo/frontend/src/locales/fr-FR.ts (1 hunks)
  • echo/frontend/src/locales/nl-NL.po (41 hunks)
  • echo/frontend/src/locales/nl-NL.ts (1 hunks)
  • echo/frontend/src/routes/project/conversation/ProjectConversationTranscript.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
echo/frontend/src/locales/es-ES.ts (1)
echo/frontend/src/locales/en-US.ts (1)
  • messages (1-1)
echo/frontend/src/locales/de-DE.ts (4)
echo/frontend/src/locales/es-ES.ts (1)
  • messages (1-1)
echo/frontend/src/locales/fr-FR.ts (1)
  • messages (1-1)
echo/frontend/src/locales/en-US.ts (1)
  • messages (1-1)
echo/frontend/src/locales/nl-NL.ts (1)
  • messages (1-1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-check-server
🔇 Additional comments (26)
echo/frontend/src/locales/en-US.ts (1)

1-1: LGTM! Solid localization addition for the empty conversation feature.

The new translation key "RKD99R" with the value "Cannot add empty conversation" aligns perfectly with the PR objectives to block empty conversations from being added to chat.

echo/frontend/src/routes/project/conversation/ProjectConversationTranscript.tsx (2)

109-109: Nice boolean variable implementation for empty conversation detection.

The isEmptyConversation logic elegantly handles both cases - completely empty conversations with no chunks and conversations with chunks but no valid transcript content.


164-168: Solid UI enhancement for empty conversation indicator.

The red "Empty" badge implementation is clean, properly conditional, and uses the localized string. This visual indicator perfectly matches the PR's objective to provide a visual clue for empty conversations.

echo/frontend/src/locales/fr-FR.ts (1)

1-1: LGTM! Internationalization game on point.

The French translations for both "Cannot add empty conversation" ("Impossible d'ajouter une conversation vide") and "Empty" ("Vide") have been properly implemented, maintaining a consistent user experience across language settings.

echo/frontend/src/locales/de-DE.po (2)

288-290: Solid German translation implementation for blocking empty conversations.

The addition of "Cannot add empty conversation" with the German translation "Leeres Gespräch kann nicht hinzugefügt werden" maintains consistency across the application's localization.


544-547: Clean implementation of the "Empty" label translation.

"Empty" translated to "Leer" in German completes the internationalization needs for the visual indicator of empty conversations.

echo/frontend/src/locales/es-ES.ts (1)

1-1: LGTM! Added Spanish localizations for empty conversation handling

The additions for "Empty" badge ("N2S1rs": ["Vacío"]) and the error message "Cannot add empty conversation" ("RKD99R": ["No se puede añadir una conversación vacía"]) are properly integrated into the Spanish locale file. These changes perfectly align with the PR's goals of preventing empty conversations from being selected in chat.

echo/frontend/src/locales/de-DE.ts (1)

1-1: LGTM! German localization updates added

Perfect addition of the German translations for the empty conversation feature - "RKD99R": ["Leeres Gespräch kann nicht hinzugefügt werden"] and "N2S1rs": ["Leer"]. The JSON structure is maintained and the translations are accurate.

echo/frontend/src/locales/nl-NL.ts (1)

1-1: LGTM! Dutch localization for empty conversation handling

Solid implementation of the Dutch translations for "Empty" ("N2S1rs": ["Leeg"]) and "Cannot add empty conversation" ("RKD99R": ["Kan geen leeg gesprek toevoegen"]). These changes maintain consistency with the other language files and support the UI enhancements for handling empty conversations.

echo/frontend/src/locales/es-ES.po (2)

292-294: LGTM! Added Spanish translation for empty conversation error message

Excellent addition of the Spanish translation for the error message shown when attempting to add an empty conversation. This translates "Cannot add empty conversation" to "No se puede añadir una conversación vacía" which is accurate and clear.


548-551: LGTM! Added Spanish translation for "Empty" badge

Perfect addition of the "Empty" badge translation ("Vacío") which will be displayed in both the conversation accordion and transcript views for empty conversations. This maintains consistency with the UI changes in the frontend components.

echo/frontend/src/locales/fr-FR.po (4)

292-294: New translation string for empty conversation handling looks good.

Clean implementation of the French translation for the error message when a user attempts to add an empty conversation. The translation is grammatically correct and maintains the appropriate context.


548-551: Solid translation for the "Empty" badge.

Simple but effective translation of "Empty" to "Vide" - matches the semantic meaning well and will display properly in the UI as a badge for empty conversations.


111-113: Line reference update LGTM.

Updated reference to the source code location for existing translation string "Add to this chat" - this is expected as the PR has modified the source file structure.


143-145: Line reference update is ship-ready.

Source reference update for the "Already added to this chat" translation string - correctly maintains the existing translation while updating the code reference.

echo/frontend/src/locales/en-US.po (4)

309-311: New message string implementation is perfect.

Added the English source string "Cannot add empty conversation" which matches the French translation implementation. This is the key string that will be shown to users when they attempt to add an empty conversation to the chat.


573-576: "Empty" badge string looks good to ship.

Added the English source string "Empty" which will be used as a visual indicator/badge for conversations without content. Implementation is consistent with the French translation.


116-118: Line reference update LGTM.

Updated reference for "Add to this chat" matches the change in the French localization file. This maintains consistency across language files.


148-150: Source reference update is solid.

Updated line reference for "Already added to this chat" - keeps the existing translation while properly pointing to the updated code location.

echo/frontend/src/locales/nl-NL.po (2)

365-367: LGTM! New translation added for empty conversation blocking

The Dutch translation for "Cannot add empty conversation" looks solid. Perfect linguistic mapping for the new UX blocker feature.


661-664: LGTM! "Empty" badge translation looks good

Concise and accurate translation of "Empty" to "Leeg". This will ensure Dutch users get the same visual indicator experience as other language users.

echo/frontend/src/components/conversation/ConversationAccordion.tsx (5)

116-119: LGTM! Solid hasContent check implementation

This is a clean implementation to detect empty conversations by checking for meaningful transcript content. The code efficiently uses some() which short-circuits on the first match.


123-126: LGTM! Early return pattern blocks empty conversations

Good defensive programming here - preventing empty conversations from being added to chat context with an early return. This handles the core requirement of blocking empty conversations elegantly.


140-145: LGTM! Tooltips enhanced with empty state feedback

The conditional tooltip message chain provides appropriate user feedback based on conversation state. Good UX implementation.


152-152: LGTM! Checkbox disabled for empty conversations

Disabling the UI control for empty conversations provides a clear visual cue that these conversations can't be added. Good match between the UI state and the underlying constraints.


396-400: LGTM! Clear visual indication for empty conversations

The red badge is a perfect visual indicator for empty conversations. This makes it immediately clear to users why they can't interact with these conversations.

@spashii spashii merged commit 518ba09 into main May 2, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 2025
spashii pushed a commit that referenced this pull request Nov 18, 2025
* Enhance ConversationAccordion and ProjectConversationTranscript with content validation

- Added checks to prevent empty conversations from being added to chat context in ConversationAccordion, improving user experience.
- Updated tooltip messages to reflect the inability to add empty conversations.
- Introduced a badge in ProjectConversationTranscript to indicate empty conversations, enhancing visibility for users.
- Implemented logic to verify conversation content before allowing interactions, ensuring meaningful chat context management.

* Update localization files for improved translations and context handling

- Adjusted message IDs and context references in German, English, Spanish, French, and Dutch localization files to ensure accurate translations across various UI elements.
- Enhanced existing translations for clarity and consistency, particularly in ProjectChatRoute and related components.
- Updated references in localization files to reflect changes in the codebase, ensuring proper context management in conversation components.

* tab space update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants