diff --git a/frontend/src/components/features/chat/chat-interface.tsx b/frontend/src/components/features/chat/chat-interface.tsx index dcf18553a1f6..f34618a9c916 100644 --- a/frontend/src/components/features/chat/chat-interface.tsx +++ b/frontend/src/components/features/chat/chat-interface.tsx @@ -2,6 +2,7 @@ import { useDispatch, useSelector } from "react-redux"; import toast from "react-hot-toast"; import React from "react"; import posthog from "posthog-js"; +import { useParams } from "react-router"; import { convertImageToBase64 } from "#/utils/convert-image-to-base-64"; import { FeedbackActions } from "../feedback/feedback-actions"; import { ExportActions } from "../export/export-actions"; @@ -22,7 +23,6 @@ import { ContinueButton } from "#/components/shared/buttons/continue-button"; import { ScrollToBottomButton } from "#/components/shared/buttons/scroll-to-bottom-button"; import { LoadingSpinner } from "#/components/shared/loading-spinner"; import { useGetTrajectory } from "#/hooks/mutation/use-get-trajectory"; -import { useParams } from "react-router"; import { downloadTrajectory } from "#/utils/download-files"; function getEntryPoint( @@ -105,11 +105,14 @@ export function ChatInterface() { getTrajectory(params.conversationId, { onSuccess: async (data) => { - await downloadTrajectory(params.conversationId ?? 'unknown', data.trajectory); + await downloadTrajectory( + params.conversationId ?? "unknown", + data.trajectory, + ); }, onError: (error) => { toast.error(error.message); - } + }, }); }; @@ -161,10 +164,8 @@ export function ChatInterface() { } /> - onClickExportTrajectoryButton() - }> - + onExportTrajectory={() => onClickExportTrajectoryButton()} + />
{messages.length > 2 && diff --git a/frontend/src/components/features/export/export-actions.tsx b/frontend/src/components/features/export/export-actions.tsx index 5f3bda0e9644..faafd98af293 100644 --- a/frontend/src/components/features/export/export-actions.tsx +++ b/frontend/src/components/features/export/export-actions.tsx @@ -5,9 +5,7 @@ interface ExportActionsProps { onExportTrajectory: () => void; } -export function ExportActions({ - onExportTrajectory, -}: ExportActionsProps) { +export function ExportActions({ onExportTrajectory }: ExportActionsProps) { return (
; - showSaveFilePicker(options?: SaveFilePickerOptions): Promise; + showSaveFilePicker( + options?: SaveFilePickerOptions, + ): Promise; } diff --git a/frontend/src/utils/download-files.ts b/frontend/src/utils/download-files.ts index 4605e96101b7..5e17c2b5c317 100644 --- a/frontend/src/utils/download-files.ts +++ b/frontend/src/utils/download-files.ts @@ -26,7 +26,7 @@ function isFileSystemAccessSupported(): boolean { * Checks if the Save File Picker API is supported */ function isSaveFilePickerSupported(): boolean { - return 'showSaveFilePicker' in window; + return "showSaveFilePicker" in window; } /** @@ -169,7 +169,10 @@ async function processBatch( }; } -export async function downloadTrajectory(conversationId: string, data: unknown[] | null): Promise { +export async function downloadTrajectory( + conversationId: string, + data: unknown[] | null, +): Promise { try { if (!isSaveFilePickerSupported()) { throw new Error( @@ -178,12 +181,14 @@ export async function downloadTrajectory(conversationId: string, data: unknown[] } const options = { suggestedName: `trajectory-${conversationId}.json`, - types: [{ - description: 'JSON File', - accept: { - 'application/json': ['.json'], + types: [ + { + description: "JSON File", + accept: { + "application/json": [".json"], + }, }, - }], + ], }; const handle = await window.showSaveFilePicker(options);