Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
cb6e813b
Commit
cb6e813b
authored
Jun 29, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: csv download
parent
6b941935
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
104 additions
and
3 deletions
+104
-3
download-02.svg
...ts/base/icons/assets/vender/solid/general/download-02.svg
+3
-0
Download02.json
...nents/base/icons/src/vender/solid/general/Download02.json
+29
-0
Download02.tsx
...onents/base/icons/src/vender/solid/general/Download02.tsx
+14
-0
index.ts
...p/components/base/icons/src/vender/solid/general/index.ts
+1
-0
index.tsx
web/app/components/share/text-generation/index.tsx
+1
-1
index.tsx
...ts/share/text-generation/run-batch/csv-download/index.tsx
+49
-0
index.tsx
web/app/components/share/text-generation/run-batch/index.tsx
+5
-2
share-app.en.ts
web/i18n/lang/share-app.en.ts
+1
-0
share-app.zh.ts
web/i18n/lang/share-app.zh.ts
+1
-0
No files found.
web/app/components/base/icons/assets/vender/solid/general/download-02.svg
0 → 100644
View file @
cb6e813b
<svg
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M21 21H3M18 11L12 17M12 17L6 11M12 17V3"
stroke=
"black"
stroke-width=
"2"
stroke-linecap=
"round"
stroke-linejoin=
"round"
/>
</svg>
web/app/components/base/icons/src/vender/solid/general/Download02.json
0 → 100644
View file @
cb6e813b
{
"icon"
:
{
"type"
:
"element"
,
"isRootNode"
:
true
,
"name"
:
"svg"
,
"attributes"
:
{
"width"
:
"24"
,
"height"
:
"24"
,
"viewBox"
:
"0 0 24 24"
,
"fill"
:
"none"
,
"xmlns"
:
"http://www.w3.org/2000/svg"
},
"children"
:
[
{
"type"
:
"element"
,
"name"
:
"path"
,
"attributes"
:
{
"d"
:
"M21 21H3M18 11L12 17M12 17L6 11M12 17V3"
,
"stroke"
:
"currentColor"
,
"stroke-width"
:
"2"
,
"stroke-linecap"
:
"round"
,
"stroke-linejoin"
:
"round"
},
"children"
:
[]
}
]
},
"name"
:
"Download02"
}
\ No newline at end of file
web/app/components/base/icons/src/vender/solid/general/Download02.tsx
0 → 100644
View file @
cb6e813b
// GENERATE BY script
// DON NOT EDIT IT MANUALLY
import
*
as
React
from
'react'
import
data
from
'./Download02.json'
import
IconBase
from
'@/app/components/base/icons/IconBase'
import
type
{
IconBaseProps
,
IconData
}
from
'@/app/components/base/icons/IconBase'
const
Icon
=
React
.
forwardRef
<
React
.
MutableRefObject
<
SVGElement
>
,
Omit
<
IconBaseProps
,
'data'
>>
((
props
,
ref
,
)
=>
<
IconBase
{
...
props
}
ref=
{
ref
}
data=
{
data
as
IconData
}
/>)
export
default
Icon
web/app/components/base/icons/src/vender/solid/general/index.ts
0 → 100644
View file @
cb6e813b
export
{
default
as
Download02
}
from
'./Download02'
web/app/components/share/text-generation/index.tsx
View file @
cb6e813b
...
...
@@ -342,7 +342,7 @@ const TextGeneration: FC<IMainProps> = ({
)
}
{
currTab
===
'batch'
&&
(
<
RunBatch
inputs=
{
input
s
}
vars=
{
promptConfig
.
prompt_variable
s
}
onSend=
{
handleRunBatch
}
/>
)
}
...
...
web/app/components/share/text-generation/run-batch/csv-download/index.tsx
0 → 100644
View file @
cb6e813b
'use client'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
{
useCSVDownloader
,
}
from
'react-papaparse'
import
{
useTranslation
}
from
'react-i18next'
import
{
Download02
as
DownloadIcon
}
from
'@/app/components/base/icons/src/vender/solid/general'
export
type
ICSVDownloadProps
=
{
vars
:
{
name
:
string
}[]
}
const
CSVDownload
:
FC
<
ICSVDownloadProps
>
=
({
vars
,
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
CSVDownloader
,
Type
}
=
useCSVDownloader
()
const
template
=
(()
=>
{
const
res
:
Record
<
string
,
string
>
=
{}
vars
.
forEach
((
item
)
=>
{
res
[
item
.
name
]
=
''
})
console
.
log
(
res
)
return
res
})()
// debugger
return
(
<
CSVDownloader
className=
"block mt-2 cursor-pointer"
type=
{
Type
.
Link
}
filename=
{
'template'
}
bom=
{
true
}
config=
{
{
delimiter
:
';'
,
}
}
data=
{
[
template
,
]
}
>
<
div
className=
'flex items-center h-[18px] space-x-1 text-[#155EEF] text-xs font-medium'
>
<
DownloadIcon
className=
'w-3 h-3'
/>
<
span
>
{
t
(
'share.generation.downloadTemplate'
)
}
</
span
>
</
div
>
</
CSVDownloader
>
)
}
export
default
React
.
memo
(
CSVDownload
)
web/app/components/share/text-generation/run-batch/index.tsx
View file @
cb6e813b
...
...
@@ -6,15 +6,16 @@ import {
}
from
'@heroicons/react/24/solid'
import
{
useTranslation
}
from
'react-i18next'
import
CSVReader
from
'./csv-reader'
import
CSVDownload
from
'./csv-download'
import
Button
from
'@/app/components/base/button'
export
type
IRunBatchProps
=
{
inputs
:
Record
<
string
,
any
>
vars
:
{
name
:
string
}[]
onSend
:
()
=>
void
}
const
RunBatch
:
FC
<
IRunBatchProps
>
=
({
input
s
,
var
s
,
onSend
,
})
=>
{
const
{
t
}
=
useTranslation
()
...
...
@@ -23,11 +24,13 @@ const RunBatch: FC<IRunBatchProps> = ({
const
[
isParsed
,
setIsParsed
]
=
React
.
useState
(
false
)
const
handleParsed
=
(
data
:
string
[][])
=>
{
setCsvData
(
data
)
console
.
log
(
data
)
setIsParsed
(
true
)
}
return
(
<
div
>
<
CSVReader
onParsed=
{
handleParsed
}
/>
<
CSVDownload
vars=
{
vars
}
/>
<
Button
type=
"primary"
...
...
web/i18n/lang/share-app.en.ts
View file @
cb6e813b
...
...
@@ -46,6 +46,7 @@ const translation = {
copy
:
'Copy'
,
resultTitle
:
'AI Completion'
,
noData
:
'AI will give you what you want here.'
,
downloadTemplate
:
'Download the template here'
,
},
}
...
...
web/i18n/lang/share-app.zh.ts
View file @
cb6e813b
...
...
@@ -42,6 +42,7 @@ const translation = {
copy
:
'拷贝'
,
resultTitle
:
'AI 书写'
,
noData
:
'AI 会在这里给你惊喜。'
,
downloadTemplate
:
'下载模板'
,
},
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment