Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ const ConversationAccordionItem = ({
highlight = false,
showDuration = false,
}: {
conversation: Conversation;
conversation?: Conversation & {live: boolean};
highlight?: boolean;
showDuration?: boolean;
}) => {
Expand All @@ -459,15 +459,15 @@ const ConversationAccordionItem = ({
return <Skeleton height={60} />;
}

if (!conversation) {
return null;
}

const isLocked = chatContextQuery.data?.conversations?.find(
(c) => c.conversation_id === conversation.id && c.locked,
);

const isAutoSelectEnabled = chatContextQuery.data?.auto_select_bool ?? false;
const isUpload =
conversation.source?.toLowerCase().includes("upload") ?? false;

// Check if conversation has any content

return (
<NavigationButton
Expand Down Expand Up @@ -509,11 +509,11 @@ const ConversationAccordionItem = ({
</Text>
{
// if from portal and not finished
!isUpload && conversation.is_finished === false && (
<Box className="flex items-center gap-1 pr-[4px]">
(["portal_audio"].includes(conversation.source?.toLowerCase() ?? "")) && conversation.live && (
<Box className="flex items-baseline gap-1 pr-[4px]">
<div className="h-2 w-2 animate-pulse rounded-full bg-red-500" />
<Text size="xs" fs="italic" fw={500}>
<Trans>Live</Trans>
<Trans id="conversation.ongoing">Ongoing</Trans>
</Text>
</Box>
)
Expand Down Expand Up @@ -868,7 +868,7 @@ export const ConversationAccordion = ({ projectId }: { projectId: string }) => {
<ConversationAccordionItem
key={item.id}
highlight={item.id === activeConversationId}
conversation={item as Conversation}
conversation={item as Conversation & {live: boolean} ?? null}
showDuration={showDuration}
/>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ export const ConversationLink = ({
<List>
{conversation.linked_conversations.map(
(conversationLink: ConversationLink) =>
conversationLink?.target_conversation_id?.id && (
(conversationLink?.target_conversation_id as Conversation)?.id && (
<List.Item key={conversationLink?.id}>
<ConversationAnchor
to={`/projects/${projectId}/conversation/${conversationLink?.target_conversation_id?.id}/overview`}
to={`/projects/${projectId}/conversation/${(conversationLink?.target_conversation_id as Conversation)?.id}/overview`}
name={
conversationLink?.target_conversation_id
(conversationLink?.target_conversation_id as Conversation)
?.participant_name ?? ""
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const OngoingConversationsSummaryCard = ({
project_id: projectId,
},
source: {
_neq: "DASHBOARD_UPLOAD",
_nin: ["DASHBOARD_UPLOAD", "CLONE"],
},
timestamp: {
// @ts-expect-error gt is not typed
Expand Down
44 changes: 41 additions & 3 deletions echo/frontend/src/components/conversation/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,8 @@ export const useConversationsByProjectId = (
query?: Partial<Query<CustomDirectusTypes, Conversation>>,
filterBySource?: string[],
) => {
const TIME_INTERVAL_SECONDS = 40;

return useQuery({
queryKey: [
"projects",
Expand All @@ -634,8 +636,8 @@ export const useConversationsByProjectId = (
query,
filterBySource,
],
queryFn: () =>
directus.request(
queryFn: async () => {
const conversations = await directus.request(
readItems("conversation", {
sort: "-updated_at",
fields: [
Expand Down Expand Up @@ -677,7 +679,43 @@ export const useConversationsByProjectId = (
limit: 1000,
...query,
}),
),
);

return conversations;
},
select: (data) => {
// Add live field to each conversation based on recent chunk activity
const cutoffTime = new Date(Date.now() - TIME_INTERVAL_SECONDS * 1000);

if (data.length === 0) return [];

return data.map((conversation) => {

// Skip upload chunks
if (
["upload", "clone"].includes(conversation.source ?? "")
) return {
...conversation,
live: false,
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Case Sensitivity Issue in Source Handling

The useConversationsByProjectId hook incorrectly handles case for conversation.source when determining the live status. The check ["upload", "clone"].includes(conversation.source ?? "") expects lowercase values, but actual source values (e.g., "DASHBOARD_UPLOAD", "CLONE") are uppercase. This prevents "upload" and "clone" conversations from being correctly excluded, and should be fixed by using conversation.source?.toLowerCase().

Locations (1)

Fix in CursorFix in Web


if (conversation.chunks?.length === 0) return {
...conversation,
live: false,
};

const hasRecentChunks = conversation.chunks?.some((chunk: any) => {
// Check if chunk timestamp is recent
const chunkTime = new Date(chunk.timestamp || chunk.created_at || 0);
return chunkTime > cutoffTime;
});

return {
...conversation,
live: hasRecentChunks || false,
};
});
},
refetchInterval: 30000,
});
};
Expand Down
29 changes: 17 additions & 12 deletions echo/frontend/src/lib/typesDirectus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type Conversation = {
is_all_chunks_transcribed?: boolean | null;
is_audio_processing_finished?: boolean | null;
is_finished?: boolean | null;
linked_conversations: any[] | ConversationLink[];
linking_conversations: any[] | ConversationLink[];
merged_audio_path?: string | null;
merged_transcript?: string | null;
participant_email?: string | null;
Expand All @@ -75,18 +77,9 @@ type Conversation = {
source?: string | null;
summary?: string | null;
tags: any[] | ConversationProjectTag[];
linking_conversations?: any[] | ConversationLink[];
linked_conversations?: any[] | ConversationLink[];
updated_at?: string | null;
};

type ConversationLink = {
id: string;
link_type: string;
source_conversation_id: Conversation | null;
target_conversation_id: Conversation | null;
};

type ConversationChunk = {
conversation_id: string | Conversation;
conversation_segments: any[] | ConversationSegmentConversationChunk[];
Expand Down Expand Up @@ -114,6 +107,15 @@ type ConversationChunk = {
updated_at?: string | null;
};

type ConversationLink = {
date_created?: string | null;
date_updated?: string | null;
id: number;
link_type?: string | null;
source_conversation_id?: string | Conversation | null;
target_conversation_id?: string | Conversation | null;
};

type ConversationProjectTag = {
conversation_id?: string | Conversation | null;
id: number;
Expand Down Expand Up @@ -584,11 +586,13 @@ type ProcessingStatus = {
id: number;
message?: string | null;
parent?: number | ProcessingStatus | null;
project_analysis_run_id?: string | ProjectAnalysisRun | null;
project_id?: string | Project | null;
timestamp?: string | null;
};

type Project = {
conversations_count?: number | null;
context?: string | null;
conversation_ask_for_participant_name_label?: string | null;
conversations: any[] | Conversation[];
Expand Down Expand Up @@ -616,14 +620,13 @@ type Project = {
project_reports: any[] | ProjectReport[];
tags: any[] | ProjectTag[];
updated_at?: string | null;

conversations_count?: number | null;
};

type ProjectAnalysisRun = {
created_at?: string | null;
id: string;
insights: any[] | Insight[];
processing_status: any[] | ProcessingStatus[];
project_id?: string | Project | null;
updated_at?: string | null;
views: any[] | View[];
Expand Down Expand Up @@ -730,14 +733,15 @@ type ProjectTag = {
type View = {
aspects: any[] | Aspect[];
created_at?: string | null;
description?: string | null;
id: string;
language?: string | null;
name?: string | null;
project_analysis_run_id?: string | ProjectAnalysisRun | null;
summary?: string | null;
updated_at?: string | null;
user_input?: string | null;
user_input_description?: string | null;
description?: string | null;
};

type CustomDirectusTypes = {
Expand All @@ -748,6 +752,7 @@ type CustomDirectusTypes = {
aspect_segment: AspectSegment[];
conversation: Conversation[];
conversation_chunk: ConversationChunk[];
conversation_link: ConversationLink[];
conversation_project_tag: ConversationProjectTag[];
conversation_reply: ConversationReply[];
conversation_segment: ConversationSegment[];
Expand Down
13 changes: 11 additions & 2 deletions echo/frontend/src/locales/de-DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -1119,8 +1119,8 @@ msgstr "Link"
#~ msgstr "LinkedIn-Beitrag (Experimentell)"

#: src/components/conversation/ConversationAccordion.tsx:516
msgid "Live"
msgstr "Live"
#~ msgid "Live"
#~ msgstr "Live"

#: src/components/participant/MicrophoneTest.tsx:274
msgid "Live audio level:"
Expand Down Expand Up @@ -1355,6 +1355,15 @@ msgstr "Es wurden keine gültigen Audio-Dateien ausgewählt. Bitte wählen Sie n
msgid "Oldest First"
msgstr "Älteste zuerst"

#. js-lingui-explicit-id
#: src/components/conversation/ConversationAccordion.tsx:516
msgid "conversation.ongoing"
msgstr "Laufend"

#: src/components/conversation/ConversationAccordion.tsx:516
#~ msgid "Ongoing"
#~ msgstr "Laufend"

#: src/components/conversation/OngoingConversationsSummaryCard.tsx:60
msgid "Ongoing Conversations"
msgstr "Laufende Gespräche"
Expand Down
2 changes: 1 addition & 1 deletion echo/frontend/src/locales/de-DE.ts

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions echo/frontend/src/locales/en-US.po
Original file line number Diff line number Diff line change
Expand Up @@ -1156,8 +1156,8 @@ msgstr "Link"
#~ msgstr "LinkedIn Post (Experimental)"

#: src/components/conversation/ConversationAccordion.tsx:516
msgid "Live"
msgstr "Live"
#~ msgid "Live"
#~ msgstr "Live"

#: src/components/participant/MicrophoneTest.tsx:274
msgid "Live audio level:"
Expand Down Expand Up @@ -1392,6 +1392,15 @@ msgstr "No valid audio files were selected. Please select audio files only (MP3,
msgid "Oldest First"
msgstr "Oldest First"

#. js-lingui-explicit-id
#: src/components/conversation/ConversationAccordion.tsx:516
msgid "conversation.ongoing"
msgstr "Ongoing"

#: src/components/conversation/ConversationAccordion.tsx:516
#~ msgid "Ongoing"
#~ msgstr "Ongoing"

#: src/components/conversation/OngoingConversationsSummaryCard.tsx:60
msgid "Ongoing Conversations"
msgstr "Ongoing Conversations"
Expand Down
2 changes: 1 addition & 1 deletion echo/frontend/src/locales/en-US.ts

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions echo/frontend/src/locales/es-ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ msgstr "Enlace"
#~ msgstr "Publicación LinkedIn (Experimental)"

#: src/components/conversation/ConversationAccordion.tsx:516
msgid "Live"
msgstr "Vivo"
#~ msgid "Live"
#~ msgstr "Vivo"

#: src/components/participant/MicrophoneTest.tsx:274
msgid "Live audio level:"
Expand Down Expand Up @@ -1359,6 +1359,15 @@ msgstr "No se seleccionaron archivos de audio válidos. Por favor, selecciona so
msgid "Oldest First"
msgstr "Más antiguos primero"

#. js-lingui-explicit-id
#: src/components/conversation/ConversationAccordion.tsx:516
msgid "conversation.ongoing"
msgstr "En curso"

#: src/components/conversation/ConversationAccordion.tsx:516
#~ msgid "Ongoing"
#~ msgstr "En curso"

#: src/components/conversation/OngoingConversationsSummaryCard.tsx:60
msgid "Ongoing Conversations"
msgstr "Conversaciones en Curso"
Expand Down
2 changes: 1 addition & 1 deletion echo/frontend/src/locales/es-ES.ts

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions echo/frontend/src/locales/fr-FR.po
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ msgstr "Lien"
#~ msgstr "Publication LinkedIn (Expérimental)"

#: src/components/conversation/ConversationAccordion.tsx:516
msgid "Live"
msgstr "Direct"
#~ msgid "Live"
#~ msgstr "Direct"

#: src/components/participant/MicrophoneTest.tsx:274
msgid "Live audio level:"
Expand Down Expand Up @@ -1359,6 +1359,15 @@ msgstr "Aucun fichier audio valide n'a été sélectionné. Veuillez sélectionn
msgid "Oldest First"
msgstr "Plus ancien en premier"

#. js-lingui-explicit-id
#: src/components/conversation/ConversationAccordion.tsx:516
msgid "conversation.ongoing"
msgstr "En cours"

#: src/components/conversation/ConversationAccordion.tsx:516
#~ msgid "Ongoing"
#~ msgstr "En cours"

#: src/components/conversation/OngoingConversationsSummaryCard.tsx:60
msgid "Ongoing Conversations"
msgstr "Conversations en cours"
Expand Down
2 changes: 1 addition & 1 deletion echo/frontend/src/locales/fr-FR.ts

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions echo/frontend/src/locales/nl-NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -1281,8 +1281,8 @@ msgstr "Link"
#~ msgstr "LinkedIn Post (Experimenteel)"

#: src/components/conversation/ConversationAccordion.tsx:516
msgid "Live"
msgstr "Live"
#~ msgid "Live"
#~ msgstr "Live"

#: src/components/participant/MicrophoneTest.tsx:274
msgid "Live audio level:"
Expand Down Expand Up @@ -1525,6 +1525,15 @@ msgstr "Er zijn geen geldige audiobestanden geselecteerd. Selecteer alleen audio
msgid "Oldest First"
msgstr "Oudste eerst"

#. js-lingui-explicit-id
#: src/components/conversation/ConversationAccordion.tsx:516
msgid "conversation.ongoing"
msgstr "Actief"

#: src/components/conversation/ConversationAccordion.tsx:516
#~ msgid "Ongoing"
#~ msgstr "Actief"

#: src/components/conversation/OngoingConversationsSummaryCard.tsx:60
msgid "Ongoing Conversations"
msgstr "Actieve Gesprekken"
Expand Down
2 changes: 1 addition & 1 deletion echo/frontend/src/locales/nl-NL.ts

Large diffs are not rendered by default.