Commit 827040fe authored by Joel's avatar Joel

feat:run batch style

parent cb6e813b
...@@ -15,18 +15,38 @@ const CSVDownload: FC<ICSVDownloadProps> = ({ ...@@ -15,18 +15,38 @@ const CSVDownload: FC<ICSVDownloadProps> = ({
vars, vars,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { CSVDownloader, Type } = useCSVDownloader() const { CSVDownloader, Type } = useCSVDownloader()
const addQueryContentVars = [...vars, { name: t('share.generation.queryTitle') }]
const template = (() => { const template = (() => {
const res: Record<string, string> = {} const res: Record<string, string> = {}
vars.forEach((item) => { addQueryContentVars.forEach((item) => {
res[item.name] = '' res[item.name] = ''
}) })
console.log(res) // console.log(res)
return res return res
})() })()
// debugger
return ( return (
<div className='mt-6'>
<div className='text-sm text-gray-900 font-medium'>{t('share.generation.csvStructureTitle')}</div>
<div className='mt-2 max-h-[500px] overflow-auto'>
<table className='w-full border-separate border-spacing-0 border border-gray-200 rounded-lg'>
<thead className='text-gray-500'>
<tr>
{addQueryContentVars.map((item, i) => (
<td key={i} className='h-9 pl-4 border-b border-gray-200'>{item.name}</td>
))}
</tr>
</thead>
<tbody className='text-gray-300'>
<tr>
{addQueryContentVars.map((item, i) => (
<td key={i} className='h-9 pl-4'>{item.name} {t('share.generation.field')}</td>
))}
</tr>
</tbody>
</table>
</div>
<CSVDownloader <CSVDownloader
className="block mt-2 cursor-pointer" className="block mt-2 cursor-pointer"
type={Type.Link} type={Type.Link}
...@@ -44,6 +64,8 @@ const CSVDownload: FC<ICSVDownloadProps> = ({ ...@@ -44,6 +64,8 @@ const CSVDownload: FC<ICSVDownloadProps> = ({
<span>{t('share.generation.downloadTemplate')}</span> <span>{t('share.generation.downloadTemplate')}</span>
</div> </div>
</CSVDownloader> </CSVDownloader>
</div>
) )
} }
export default React.memo(CSVDownload) export default React.memo(CSVDownload)
...@@ -28,13 +28,13 @@ const RunBatch: FC<IRunBatchProps> = ({ ...@@ -28,13 +28,13 @@ const RunBatch: FC<IRunBatchProps> = ({
setIsParsed(true) setIsParsed(true)
} }
return ( return (
<div> <div className='pt-4'>
<CSVReader onParsed={handleParsed} /> <CSVReader onParsed={handleParsed} />
<CSVDownload vars={vars} /> <CSVDownload vars={vars} />
<div className='mt-4 h-[1px] bg-gray-100'></div>
<Button <Button
type="primary" type="primary"
className='w-[80px] !h-8 !p-0' className='mt-4 !h-8 !pl-3 !pr-4'
onClick={onSend} onClick={onSend}
disabled={!isParsed} disabled={!isParsed}
> >
......
...@@ -42,11 +42,13 @@ const translation = { ...@@ -42,11 +42,13 @@ const translation = {
title: 'AI Completion', title: 'AI Completion',
queryTitle: 'Query content', queryTitle: 'Query content',
queryPlaceholder: 'Write your query content...', queryPlaceholder: 'Write your query content...',
run: 'RUN', run: 'Execute',
copy: 'Copy', copy: 'Copy',
resultTitle: 'AI Completion', resultTitle: 'AI Completion',
noData: 'AI will give you what you want here.', noData: 'AI will give you what you want here.',
csvStructureTitle: 'The CSV file must conform to the following structure:',
downloadTemplate: 'Download the template here', downloadTemplate: 'Download the template here',
field: 'Field',
}, },
} }
......
...@@ -42,7 +42,9 @@ const translation = { ...@@ -42,7 +42,9 @@ const translation = {
copy: '拷贝', copy: '拷贝',
resultTitle: 'AI 书写', resultTitle: 'AI 书写',
noData: 'AI 会在这里给你惊喜。', noData: 'AI 会在这里给你惊喜。',
csvStructureTitle: 'CSV 文件必须符合以下结构:',
downloadTemplate: '下载模板', downloadTemplate: '下载模板',
field: '',
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment