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
21 changes: 15 additions & 6 deletions echo/frontend/src/components/conversation/ConversationEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ const getSourceLabel = (source: string | null): string | null => {
const getNameDescription = (source: string | null): string => {
if (!source) return "";
const lower = source.toLowerCase();
if (lower.includes("portal")) return t`Entered by the participant on the portal`;
if (lower.includes("portal"))
return t`Entered by the participant on the portal`;
if (lower.includes("upload")) return t`Filename from uploaded file`;
if (lower.includes("clone")) return t`Copied from original conversation`;
return "";
Expand Down Expand Up @@ -137,9 +138,9 @@ export const ConversationEdit = ({
);

const defaultValues: ConversationEditFormValues = {
title: conversation.title ?? "",
participant_name: conversation.participant_name ?? "",
tagIdList: sanitizedConversationTagIds,
title: conversation.title ?? "",
};

const { register, formState, reset, setValue, control, watch, getValues } =
Expand All @@ -157,8 +158,8 @@ export const ConversationEdit = ({
await updateConversationMutation.mutateAsync({
id: conversation.id,
payload: {
title: data.title || null,
participant_name: data.participant_name,
title: data.title || null,
},
});

Expand All @@ -185,9 +186,19 @@ export const ConversationEdit = ({
queryClient.invalidateQueries({
queryKey: ["conversations", conversation.id],
});
queryClient.invalidateQueries({
queryKey: ["projects", conversation.project_id, "conversations"],
});
},
});

useEffect(() => {
const nextTitle = conversation.title ?? "";
if (!formState.dirtyFields.title && getValues("title") !== nextTitle) {
setValue("title", nextTitle, { shouldDirty: false });
}
}, [conversation.title, formState.dirtyFields.title, getValues, setValue]);

const hasSummary = !!conversation.summary;
const hasTitle = !!watch("title");
const showGenerateTitle = !hasTitle;
Expand Down Expand Up @@ -257,9 +268,7 @@ export const ConversationEdit = ({
<Text size="sm" c="dimmed">
<Trans>Duration</Trans>
</Text>
<Text size="sm">
{formatDuration(conversation.duration)}
</Text>
<Text size="sm">{formatDuration(conversation.duration)}</Text>
</Box>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {
} from "@mantine/core";
import { useClipboard } from "@mantine/hooks";
import { IconRefresh } from "@tabler/icons-react";
import { useMutation, useMutationState } from "@tanstack/react-query";
import {
useMutation,
useMutationState,
useQueryClient,
} from "@tanstack/react-query";
import { useParams } from "react-router";
import { CopyIconButton } from "@/components/common/CopyIconButton";
import { Markdown } from "@/components/common/Markdown";
Expand All @@ -35,6 +39,7 @@ import { testId } from "@/lib/testUtils";

export const ProjectConversationOverviewRoute = () => {
const { conversationId, projectId } = useParams();
const queryClient = useQueryClient();

const conversationQuery = useConversationById({
conversationId: conversationId ?? "",
Expand Down Expand Up @@ -112,7 +117,12 @@ export const ProjectConversationOverviewRoute = () => {
},
mutationKey: ["generateSummary", conversationId],
onSuccess: () => {
conversationQuery.refetch();
queryClient.invalidateQueries({
queryKey: ["conversations", conversationId],
});
queryClient.invalidateQueries({
queryKey: ["projects", projectId, "conversations"],
});
},
});

Expand Down
Loading