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
9acd9a72
Commit
9acd9a72
authored
Jul 06, 2023
by
StyleZhang
Browse files
Options
Browse Files
Download
Plain Diff
merge main
parents
c31f86ca
cde1797c
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
158 additions
and
16 deletions
+158
-16
dataset_service.py
api/services/dataset_service.py
+1
-0
index.tsx
web/app/components/app/configuration/config-model/index.tsx
+19
-1
x.svg
...pp/components/base/icons/assets/vender/line/general/x.svg
+5
-0
alert-triangle.svg
.../assets/vender/solid/alertsAndFeedback/alert-triangle.svg
+5
-0
X.json
web/app/components/base/icons/src/vender/line/general/X.json
+39
-0
X.tsx
web/app/components/base/icons/src/vender/line/general/X.tsx
+14
-0
index.ts
...pp/components/base/icons/src/vender/line/general/index.ts
+1
-0
AlertTriangle.json
...ons/src/vender/solid/alertsAndFeedback/AlertTriangle.json
+38
-0
AlertTriangle.tsx
...cons/src/vender/solid/alertsAndFeedback/AlertTriangle.tsx
+14
-0
index.ts
...ts/base/icons/src/vender/solid/alertsAndFeedback/index.ts
+1
-0
index.module.css
...onents/datasets/create/embedding-process/index.module.css
+2
-0
index.tsx
web/app/components/datasets/create/step-one/index.tsx
+1
-1
list.tsx
web/app/components/datasets/documents/list.tsx
+1
-1
app-context.tsx
web/context/app-context.tsx
+13
-11
common.en.ts
web/i18n/lang/common.en.ts
+1
-0
common.zh.ts
web/i18n/lang/common.zh.ts
+1
-0
dataset-documents.en.ts
web/i18n/lang/dataset-documents.en.ts
+1
-1
dataset-documents.zh.ts
web/i18n/lang/dataset-documents.zh.ts
+1
-1
No files found.
api/services/dataset_service.py
View file @
9acd9a72
...
...
@@ -35,6 +35,7 @@ class DatasetService:
permission_filter
=
Dataset
.
permission
==
'all_team_members'
datasets
=
Dataset
.
query
.
filter
(
db
.
and_
(
Dataset
.
provider
==
provider
,
Dataset
.
tenant_id
==
tenant_id
,
permission_filter
))
\
.
order_by
(
Dataset
.
created_at
.
desc
())
\
.
paginate
(
page
=
page
,
per_page
=
per_page
,
...
...
web/app/components/app/configuration/config-model/index.tsx
View file @
9acd9a72
'use client'
import
type
{
FC
}
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
cn
from
'classnames'
import
{
useTranslation
}
from
'react-i18next'
import
{
useBoolean
,
useClickAway
}
from
'ahooks'
...
...
@@ -12,6 +12,7 @@ import type { CompletionParams } from '@/models/debug'
import
{
AppType
}
from
'@/types/app'
import
{
TONE_LIST
}
from
'@/config'
import
Toast
from
'@/app/components/base/toast'
import
{
AlertTriangle
}
from
'@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
export
type
IConifgModelProps
=
{
mode
:
string
...
...
@@ -55,6 +56,7 @@ const ConifgModel: FC<IConifgModelProps> = ({
const
isChatApp
=
mode
===
AppType
.
chat
const
availableModels
=
options
.
filter
(
item
=>
item
.
type
===
mode
)
const
[
isShowConfig
,
{
setFalse
:
hideConfig
,
toggle
:
toogleShowConfig
}]
=
useBoolean
(
false
)
const
[
maxTokenSettingTipVisible
,
setMaxTokenSettingTipVisible
]
=
useState
(
false
)
const
configContentRef
=
React
.
useRef
(
null
)
useClickAway
(()
=>
{
hideConfig
()
...
...
@@ -177,6 +179,14 @@ const ConifgModel: FC<IConifgModelProps> = ({
const
ableStyle
=
'bg-indigo-25 border-[#2A87F5] cursor-pointer'
const
diabledStyle
=
'bg-[#FFFCF5] border-[#F79009]'
useEffect
(()
=>
{
const
max
=
params
[
4
].
max
if
(
completionParams
.
max_tokens
>
max
*
2
/
3
)
setMaxTokenSettingTipVisible
(
true
)
else
setMaxTokenSettingTipVisible
(
false
)
},
[
params
,
completionParams
.
max_tokens
,
setMaxTokenSettingTipVisible
])
return
(
<
div
className=
'relative'
ref=
{
configContentRef
}
>
<
div
...
...
@@ -247,6 +257,14 @@ const ConifgModel: FC<IConifgModelProps> = ({
{
params
.
map
(({
key
,
...
param
})
=>
(<
ParamItem
key=
{
key
}
{
...
param
}
value=
{
(
completionParams
as
any
)[
key
]
as
any
}
onChange=
{
handleParamChange
}
/>))
}
</
div
>
</
div
>
{
maxTokenSettingTipVisible
&&
(
<
div
className=
'flex py-2 pr-4 pl-5 bg-[#FFFAEB] border-t border-[#FEF0C7]'
>
<
AlertTriangle
className=
'shrink-0 mr-2 mt-[3px] w-3 h-3 text-[#F79009]'
/>
<
div
className=
'mr-2 text-xs font-medium text-gray-700'
>
{
t
(
'common.model.params.maxTokenSettingTip'
)
}
</
div
>
</
div
>
)
}
</
Panel
>
)
}
</
div
>
...
...
web/app/components/base/icons/assets/vender/line/general/x.svg
0 → 100644
View file @
9acd9a72
<svg
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<g
id=
"x"
>
<path
id=
"Icon"
d=
"M11.3334 4.66663L4.66675 11.3333M4.66675 4.66663L11.3334 11.3333"
stroke=
"#667085"
stroke-width=
"1.5"
stroke-linecap=
"round"
stroke-linejoin=
"round"
/>
</g>
</svg>
web/app/components/base/icons/assets/vender/solid/alertsAndFeedback/alert-triangle.svg
0 → 100644
View file @
9acd9a72
<svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<g
id=
"alert-triangle"
>
<path
id=
"Solid"
fill-rule=
"evenodd"
clip-rule=
"evenodd"
d=
"M6.40616 0.834185C6.14751 0.719172 5.85222 0.719172 5.59356 0.834185C5.3938 0.923011 5.26403 1.07947 5.17373 1.20696C5.08495 1.3323 4.9899 1.49651 4.88536 1.67711L0.751783 8.81693C0.646828 8.99818 0.551451 9.16289 0.486781 9.30268C0.421056 9.44475 0.349754 9.63572 0.372478 9.85369C0.401884 10.1357 0.549654 10.392 0.779012 10.5588C0.956259 10.6877 1.15726 10.7217 1.31314 10.736C1.46651 10.75 1.65684 10.75 1.86628 10.75H10.1334C10.3429 10.75 10.5332 10.75 10.6866 10.736C10.8425 10.7217 11.0435 10.6877 11.2207 10.5588C11.4501 10.392 11.5978 10.1357 11.6272 9.85369C11.65 9.63572 11.5787 9.44475 11.5129 9.30268C11.4483 9.1629 11.3529 8.9982 11.248 8.81697L7.11436 1.67709C7.00983 1.49651 6.91477 1.3323 6.82599 1.20696C6.73569 1.07947 6.60593 0.923011 6.40616 0.834185ZM6.49988 4.5C6.49988 4.22386 6.27602 4 5.99988 4C5.72374 4 5.49988 4.22386 5.49988 4.5V6.5C5.49988 6.77614 5.72374 7 5.99988 7C6.27602 7 6.49988 6.77614 6.49988 6.5V4.5ZM5.99988 8C5.72374 8 5.49988 8.22386 5.49988 8.5C5.49988 8.77614 5.72374 9 5.99988 9H6.00488C6.28102 9 6.50488 8.77614 6.50488 8.5C6.50488 8.22386 6.28102 8 6.00488 8H5.99988Z"
fill=
"#F79009"
/>
</g>
</svg>
web/app/components/base/icons/src/vender/line/general/X.json
0 → 100644
View file @
9acd9a72
{
"icon"
:
{
"type"
:
"element"
,
"isRootNode"
:
true
,
"name"
:
"svg"
,
"attributes"
:
{
"width"
:
"16"
,
"height"
:
"16"
,
"viewBox"
:
"0 0 16 16"
,
"fill"
:
"none"
,
"xmlns"
:
"http://www.w3.org/2000/svg"
},
"children"
:
[
{
"type"
:
"element"
,
"name"
:
"g"
,
"attributes"
:
{
"id"
:
"x"
},
"children"
:
[
{
"type"
:
"element"
,
"name"
:
"path"
,
"attributes"
:
{
"id"
:
"Icon"
,
"d"
:
"M11.3334 4.66663L4.66675 11.3333M4.66675 4.66663L11.3334 11.3333"
,
"stroke"
:
"currentColor"
,
"stroke-width"
:
"1.5"
,
"stroke-linecap"
:
"round"
,
"stroke-linejoin"
:
"round"
},
"children"
:
[]
}
]
}
]
},
"name"
:
"X"
}
\ No newline at end of file
web/app/components/base/icons/src/vender/line/general/X.tsx
0 → 100644
View file @
9acd9a72
// GENERATE BY script
// DON NOT EDIT IT MANUALLY
import
*
as
React
from
'react'
import
data
from
'./X.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/line/general/index.ts
View file @
9acd9a72
export
{
default
as
Loading02
}
from
'./Loading02'
export
{
default
as
Trash03
}
from
'./Trash03'
export
{
default
as
XClose
}
from
'./XClose'
export
{
default
as
X
}
from
'./X'
web/app/components/base/icons/src/vender/solid/alertsAndFeedback/AlertTriangle.json
0 → 100644
View file @
9acd9a72
{
"icon"
:
{
"type"
:
"element"
,
"isRootNode"
:
true
,
"name"
:
"svg"
,
"attributes"
:
{
"width"
:
"12"
,
"height"
:
"12"
,
"viewBox"
:
"0 0 12 12"
,
"fill"
:
"none"
,
"xmlns"
:
"http://www.w3.org/2000/svg"
},
"children"
:
[
{
"type"
:
"element"
,
"name"
:
"g"
,
"attributes"
:
{
"id"
:
"alert-triangle"
},
"children"
:
[
{
"type"
:
"element"
,
"name"
:
"path"
,
"attributes"
:
{
"id"
:
"Solid"
,
"fill-rule"
:
"evenodd"
,
"clip-rule"
:
"evenodd"
,
"d"
:
"M6.40616 0.834185C6.14751 0.719172 5.85222 0.719172 5.59356 0.834185C5.3938 0.923011 5.26403 1.07947 5.17373 1.20696C5.08495 1.3323 4.9899 1.49651 4.88536 1.67711L0.751783 8.81693C0.646828 8.99818 0.551451 9.16289 0.486781 9.30268C0.421056 9.44475 0.349754 9.63572 0.372478 9.85369C0.401884 10.1357 0.549654 10.392 0.779012 10.5588C0.956259 10.6877 1.15726 10.7217 1.31314 10.736C1.46651 10.75 1.65684 10.75 1.86628 10.75H10.1334C10.3429 10.75 10.5332 10.75 10.6866 10.736C10.8425 10.7217 11.0435 10.6877 11.2207 10.5588C11.4501 10.392 11.5978 10.1357 11.6272 9.85369C11.65 9.63572 11.5787 9.44475 11.5129 9.30268C11.4483 9.1629 11.3529 8.9982 11.248 8.81697L7.11436 1.67709C7.00983 1.49651 6.91477 1.3323 6.82599 1.20696C6.73569 1.07947 6.60593 0.923011 6.40616 0.834185ZM6.49988 4.5C6.49988 4.22386 6.27602 4 5.99988 4C5.72374 4 5.49988 4.22386 5.49988 4.5V6.5C5.49988 6.77614 5.72374 7 5.99988 7C6.27602 7 6.49988 6.77614 6.49988 6.5V4.5ZM5.99988 8C5.72374 8 5.49988 8.22386 5.49988 8.5C5.49988 8.77614 5.72374 9 5.99988 9H6.00488C6.28102 9 6.50488 8.77614 6.50488 8.5C6.50488 8.22386 6.28102 8 6.00488 8H5.99988Z"
,
"fill"
:
"currentColor"
},
"children"
:
[]
}
]
}
]
},
"name"
:
"AlertTriangle"
}
\ No newline at end of file
web/app/components/base/icons/src/vender/solid/alertsAndFeedback/AlertTriangle.tsx
0 → 100644
View file @
9acd9a72
// GENERATE BY script
// DON NOT EDIT IT MANUALLY
import
*
as
React
from
'react'
import
data
from
'./AlertTriangle.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/alertsAndFeedback/index.ts
0 → 100644
View file @
9acd9a72
export
{
default
as
AlertTriangle
}
from
'./AlertTriangle'
web/app/components/datasets/create/embedding-process/index.module.css
View file @
9acd9a72
...
...
@@ -30,6 +30,7 @@
.sourceItem
.info
{
display
:
flex
;
align-items
:
center
;
z-index
:
1
;
}
.sourceItem
.info
.name
{
font-weight
:
500
;
...
...
@@ -45,6 +46,7 @@
font-size
:
12px
;
line-height
:
18px
;
color
:
#344054
;
z-index
:
1
;
}
.sourceItem
.error
{
color
:
#D92D20
;
...
...
web/app/components/datasets/create/step-one/index.tsx
View file @
9acd9a72
...
...
@@ -74,7 +74,7 @@ const StepOne = ({
setCurrentFile
(
file
)
}
const
hideFilePreview
=
()
=>
{
setCurrent
NotionPag
e
(
undefined
)
setCurrent
Fil
e
(
undefined
)
}
const
updateCurrentPage
=
(
page
:
Page
)
=>
{
...
...
web/app/components/datasets/documents/list.tsx
View file @
9acd9a72
...
...
@@ -57,7 +57,7 @@ export const useIndexStatus = () => {
return
{
queuing
:
{
color
:
'orange'
,
text
:
t
(
'datasetDocuments.list.status.queuing'
)
},
// waiting
indexing
:
{
color
:
'blue'
,
text
:
t
(
'datasetDocuments.list.status.indexing'
)
},
// indexing splitting parsing cleaning
paused
:
{
color
:
'orange'
,
text
:
t
(
'datasetDocuments.list.status.pa
r
sed'
)
},
// paused
paused
:
{
color
:
'orange'
,
text
:
t
(
'datasetDocuments.list.status.pa
u
sed'
)
},
// paused
error
:
{
color
:
'red'
,
text
:
t
(
'datasetDocuments.list.status.error'
)
},
// error
available
:
{
color
:
'green'
,
text
:
t
(
'datasetDocuments.list.status.available'
)
},
// completed,archived = false,enabled = true
enabled
:
{
color
:
'green'
,
text
:
t
(
'datasetDocuments.list.status.enabled'
)
},
// completed,archived = false,enabled = true
...
...
web/context/app-context.tsx
View file @
9acd9a72
...
...
@@ -20,6 +20,16 @@ export type AppContextValue = {
useSelector
:
typeof
useSelector
}
const
initialLangeniusVersionInfo
=
{
current_env
:
''
,
current_version
:
''
,
latest_version
:
''
,
release_date
:
''
,
release_notes
:
''
,
version
:
''
,
can_auto_update
:
false
,
}
const
AppContext
=
createContext
<
AppContextValue
>
({
apps
:
[],
mutateApps
:
()
=>
{
},
...
...
@@ -30,15 +40,7 @@ const AppContext = createContext<AppContextValue>({
},
mutateUserProfile
:
()
=>
{
},
pageContainerRef
:
createRef
(),
langeniusVersionInfo
:
{
current_env
:
''
,
current_version
:
''
,
latest_version
:
''
,
release_date
:
''
,
release_notes
:
''
,
version
:
''
,
can_auto_update
:
false
,
},
langeniusVersionInfo
:
initialLangeniusVersionInfo
,
useSelector
,
})
...
...
@@ -57,7 +59,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
const
{
data
:
userProfileResponse
,
mutate
:
mutateUserProfile
}
=
useSWR
({
url
:
'/account/profile'
,
params
:
{}
},
fetchUserProfile
)
const
[
userProfile
,
setUserProfile
]
=
useState
<
UserProfileResponse
>
()
const
[
langeniusVersionInfo
,
setLangeniusVersionInfo
]
=
useState
<
LangGeniusVersionResponse
>
()
const
[
langeniusVersionInfo
,
setLangeniusVersionInfo
]
=
useState
<
LangGeniusVersionResponse
>
(
initialLangeniusVersionInfo
)
const
updateUserProfileAndVersion
=
async
()
=>
{
if
(
userProfileResponse
&&
!
userProfileResponse
.
bodyUsed
)
{
const
result
=
await
userProfileResponse
.
json
()
...
...
@@ -72,7 +74,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
updateUserProfileAndVersion
()
},
[
userProfileResponse
])
if
(
!
appList
||
!
userProfile
||
!
langeniusVersionInfo
)
if
(
!
appList
||
!
userProfile
)
return
<
Loading
type=
'app'
/>
return
(
...
...
web/i18n/lang/common.en.ts
View file @
9acd9a72
...
...
@@ -51,6 +51,7 @@ const translation = {
maxToken
:
'Max token'
,
maxTokenTip
:
'Max tokens depending on the model. Prompt and completion share this limit. One token is roughly 1 English character.'
,
maxTokenSettingTip
:
'Your max token setting is high, potentially limiting space for prompts, queries, and data. Consider setting it below 2/3.'
,
setToCurrentModelMaxTokenTip
:
'Max token is updated to the maximum token of the current model 4,000.'
,
},
tone
:
{
...
...
web/i18n/lang/common.zh.ts
View file @
9acd9a72
...
...
@@ -51,6 +51,7 @@ const translation = {
maxToken
:
'最大 Token'
,
maxTokenTip
:
'生成的最大令牌数取决于模型。提示和完成共享令牌数限制。一个令牌约等于 1 个英文或 半个中文字符。'
,
maxTokenSettingTip
:
'您设置的最大 tokens 数较大,可能会导致 prompt、用户问题、数据集内容没有 token 空间进行处理,建议设置到 2/3 以下。'
,
setToCurrentModelMaxTokenTip
:
'最大令牌数更新为当前模型最大的令牌数 4,000。'
,
},
tone
:
{
...
...
web/i18n/lang/dataset-documents.en.ts
View file @
9acd9a72
...
...
@@ -32,7 +32,7 @@ const translation = {
status
:
{
queuing
:
'Queuing'
,
indexing
:
'Indexing'
,
pa
rsed
:
'Par
sed'
,
pa
used
:
'Pau
sed'
,
error
:
'Error'
,
available
:
'Available'
,
enabled
:
'Enabled'
,
...
...
web/i18n/lang/dataset-documents.zh.ts
View file @
9acd9a72
...
...
@@ -32,7 +32,7 @@ const translation = {
status
:
{
queuing
:
'排队中'
,
indexing
:
'索引中'
,
pa
rsed
:
'已解析
'
,
pa
used
:
'已暂停
'
,
error
:
'错误'
,
available
:
'可用'
,
enabled
:
'已启用'
,
...
...
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