forked from langgenius/dify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: batch run support export as csv file (langgenius#556)
- Loading branch information
Showing
7 changed files
with
90 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
web/app/components/share/text-generation/run-batch/res-download/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use client' | ||
import type { FC } from 'react' | ||
import React from 'react' | ||
import { | ||
useCSVDownloader, | ||
} from 'react-papaparse' | ||
import { useTranslation } from 'react-i18next' | ||
import cn from 'classnames' | ||
import { Download02 as DownloadIcon } from '@/app/components/base/icons/src/vender/solid/general' | ||
import Button from '@/app/components/base/button' | ||
export type IResDownloadProps = { | ||
isMobile: boolean | ||
values: Record<string, string>[] | ||
} | ||
|
||
const ResDownload: FC<IResDownloadProps> = ({ | ||
isMobile, | ||
values, | ||
}) => { | ||
const { t } = useTranslation() | ||
const { CSVDownloader, Type } = useCSVDownloader() | ||
|
||
return ( | ||
<CSVDownloader | ||
className="block cursor-pointer" | ||
type={Type.Link} | ||
filename={'result'} | ||
bom={true} | ||
config={{ | ||
// delimiter: ';', | ||
}} | ||
data={values} | ||
> | ||
<Button className={cn('flex items-center !h-8 space-x-2 bg-white !text-[13px] font-medium', isMobile ? '!p-0 !w-8 justify-center' : '!px-3')}> | ||
<DownloadIcon className='w-4 h-4 text-[#155EEF]' /> | ||
{!isMobile && <span className='text-[#155EEF]'>{t('common.operation.download')}</span>} | ||
</Button> | ||
</CSVDownloader> | ||
) | ||
} | ||
export default React.memo(ResDownload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters