From 395f263a52ddc4445a4901442c48095f74456643 Mon Sep 17 00:00:00 2001 From: xmccln Date: Fri, 25 Jul 2025 14:07:03 +0800 Subject: [PATCH 1/2] Add a download button to save the response as a Markdown file --- src/components/Ask.tsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/components/Ask.tsx b/src/components/Ask.tsx index 6dad348b..125ec0e5 100644 --- a/src/components/Ask.tsx +++ b/src/components/Ask.tsx @@ -763,6 +763,29 @@ const Ask: React.FC = ({ )} +
+ {/* Download button */} + + {/* Clear button */}
+ )} From e803b0d89e28f0bd11a50eae051106fae3834ee3 Mon Sep 17 00:00:00 2001 From: xmccln Date: Fri, 25 Jul 2025 14:30:47 +0800 Subject: [PATCH 2/2] Implement code changes to enhance functionality and improve performance --- src/components/Ask.tsx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/Ask.tsx b/src/components/Ask.tsx index 125ec0e5..056afcd2 100644 --- a/src/components/Ask.tsx +++ b/src/components/Ask.tsx @@ -160,6 +160,17 @@ const Ask: React.FC = ({ inputRef.current.focus(); } }; + const downloadresponse = () =>{ + const blob = new Blob([response], { type: 'text/markdown' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = `response-${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.md`; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); +} // Function to check if research is complete based on response content const checkIfResearchComplete = (content: string): boolean => { @@ -766,17 +777,7 @@ const Ask: React.FC = ({
{/* Download button */}