Skip to content

ECHO-376 optimize conversation related queries#260

Merged
spashii merged 1 commit intomainfrom
feature/echo-376-query-perf-scope-frontend-api-requests-to-only-the-fields
Aug 11, 2025
Merged

ECHO-376 optimize conversation related queries#260
spashii merged 1 commit intomainfrom
feature/echo-376-query-perf-scope-frontend-api-requests-to-only-the-fields

Conversation

@spashii
Copy link
Copy Markdown
Member

@spashii spashii commented Aug 11, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Transcript view handles missing chunk fields more gracefully, reducing blank or error states.
    • Adjusted conversation “has content” detection: conversations with any chunks are no longer shown as empty; “Add to chat context” is available more consistently.
  • Refactor

    • Standardized and streamlined conversation and chunk data fetching for more reliable loading.
    • Optimized chunk queries with explicit field selection and higher limits to support larger conversations.
  • Style

    • Minor color tweak for transcript error message for improved visual consistency.

@linear
Copy link
Copy Markdown

linear bot commented Aug 11, 2025

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 11, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Consolidates and scopes conversation/chunk query fields across hooks and call sites, introducing a shared conversation field set. Updates hooks to accept customizable fields and applies them in routes/layout. Adjusts ConversationAccordion hasContent logic. Aligns ConversationChunkAudioTranscript prop type and normalizes chunk props at use site.

Changes

Cohort / File(s) Summary
Hooks: field scoping and APIs
echo/frontend/src/components/conversation/hooks/index.ts
Added CONVERSATION_FIELDS_WITHOUT_PROCESSING_STATUS and replaced "*" queries with explicit fields. Extended useInfiniteConversationChunks to request specific chunk fields. Updated useConversationChunks signature to accept limit and fields (defaults).
Layout: apply scoped fields
echo/frontend/src/components/layout/ProjectConversationLayout.tsx
Replaced wildcard fields with CONVERSATION_FIELDS_WITHOUT_PROCESSING_STATUS, preserving chunks: ["transcript"] and deep limit.
Routes: chunk fetching updates
echo/frontend/src/routes/project/conversation/ProjectConversationOverview.tsx, echo/frontend/src/routes/project/conversation/ProjectConversationTranscript.tsx
Overview now calls useConversationChunks with limit and ["id"]. Transcript passes an explicitly shaped chunk object with safe defaults to ConversationChunkAudioTranscript; removed unused import.
Components: UI/typing adjustments
echo/frontend/src/components/conversation/ConversationAccordion.tsx, echo/frontend/src/components/conversation/ConversationChunkAudioTranscript.tsx
Accordion: hasContent now true if any chunks exist. Transcript component: prop type narrowed to explicit chunk shape; minor Mantine color prop change.

Sequence Diagram(s)

sequenceDiagram
  participant UI as UI (Routes/Layout)
  participant Hooks as Conversation Hooks
  participant API as Directus API

  UI->>Hooks: useConversationById({ fields: CONVERSATION_FIELDS_WITHOUT_PROCESSING_STATUS, deep: { chunks: {_limit:25} } })
  Hooks->>API: readItems("conversations", { fields: [...], deep })
  API-->>Hooks: Conversation data (scoped fields)
  Hooks-->>UI: Conversation data

  UI->>Hooks: useConversationChunks(conversationId, limit, fields)
  Hooks->>API: readItems("conversation_chunks", { filter, limit, fields })
  API-->>Hooks: Chunk list (scoped fields)
  Hooks-->>UI: Chunk list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Scope conversation queries to explicit fields using a centralized field set (ECHO-376)
Allow hooks to request only necessary chunk fields and limits (ECHO-376)
Replace wildcard "*" usages in conversation/chunk requests (ECHO-376)
Update call sites to pass scoped fields instead of relying on defaults (ECHO-376)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Loosened hasContent logic to any chunks present (echo/frontend/src/components/conversation/ConversationAccordion.tsx) Functional UI logic change unrelated to field scoping/performance objective.
Prop type change for ConversationChunkAudioTranscript and UI color prop tweak (echo/frontend/src/components/conversation/ConversationChunkAudioTranscript.tsx) Typing/UI polish not required by field scoping objective.

Possibly related PRs

Suggested labels

improvement

Suggested reviewers

  • ussaama
  • sameer-kymata
  • ArindamRoy23

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 725607d and 30a0b1a.

📒 Files selected for processing (6)
  • echo/frontend/src/components/conversation/ConversationAccordion.tsx (0 hunks)
  • echo/frontend/src/components/conversation/ConversationChunkAudioTranscript.tsx (2 hunks)
  • echo/frontend/src/components/conversation/hooks/index.ts (7 hunks)
  • echo/frontend/src/components/layout/ProjectConversationLayout.tsx (1 hunks)
  • echo/frontend/src/routes/project/conversation/ProjectConversationOverview.tsx (1 hunks)
  • echo/frontend/src/routes/project/conversation/ProjectConversationTranscript.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/echo-376-query-perf-scope-frontend-api-requests-to-only-the-fields

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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

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 generate unit tests to generate unit tests for 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.

@spashii spashii merged commit b2cb3f3 into main Aug 11, 2025
11 of 12 checks passed
@spashii spashii deleted the feature/echo-376-query-perf-scope-frontend-api-requests-to-only-the-fields branch August 11, 2025 20:17
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 2025
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