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
fcd596c3
Commit
fcd596c3
authored
Aug 05, 2023
by
StyleZhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/multi-models' into deploy/dev
parents
c180fd3f
d60376b9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
27 deletions
+137
-27
common.module.css
web/app/components/base/confirm/common.module.css
+3
-0
common.tsx
web/app/components/base/confirm/common.tsx
+61
-0
Operation.tsx
...eader/account-setting/model-page/model-item/Operation.tsx
+9
-2
index.tsx
...ts/header/account-setting/model-page/model-item/index.tsx
+64
-13
common.en.ts
web/i18n/lang/common.en.ts
+0
-6
common.zh.ts
web/i18n/lang/common.zh.ts
+0
-6
No files found.
web/app/components/base/confirm/common.module.css
0 → 100644
View file @
fcd596c3
.wrapper
{
background
:
linear-gradient
(
180deg
,
rgba
(
217
,
45
,
32
,
0.05
)
0%
,
rgba
(
217
,
45
,
32
,
0.00
)
24.02%
),
#F9FAFB
;
}
\ No newline at end of file
web/app/components/base/confirm/common.tsx
0 → 100644
View file @
fcd596c3
import
type
{
FC
,
ReactElement
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
import
s
from
'./common.module.css'
import
Modal
from
'@/app/components/base/modal'
import
{
XClose
}
from
'@/app/components/base/icons/src/vender/line/general'
import
{
AlertCircle
}
from
'@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
import
Button
from
'@/app/components/base/button'
type
ConfirmCommonProps
=
{
type
?:
string
isShow
:
boolean
onCancel
:
()
=>
void
title
:
string
desc
?:
string
}
const
ConfirmCommon
:
FC
<
ConfirmCommonProps
>
=
({
type
=
'danger'
,
isShow
,
onCancel
,
title
,
desc
,
})
=>
{
const
{
t
}
=
useTranslation
()
const
CONFIRM_MAP
:
Record
<
string
,
{
icon
:
ReactElement
;
confirmText
:
string
}
>
=
{
danger
:
{
icon
:
<
AlertCircle
className=
'w-6 h-6 text-[#D92D20]'
/>,
confirmText
:
t
(
'common.operation.remove'
),
},
}
return
(
<
Modal
isShow=
{
isShow
}
onClose=
{
()
=>
{}
}
className=
'!w-[480px] !max-w-[480px] !p-0 !rounded-2xl'
>
<
div
className=
{
cn
(
s
.
wrapper
,
'relative p-8'
)
}
>
<
div
className=
'flex items-center justify-center absolute top-4 right-4 w-8 h-8 cursor-pointer'
onClick=
{
onCancel
}
>
<
XClose
className=
'w-4 h-4 text-gray-500'
/>
</
div
>
<
div
className=
'flex items-center justify-center mb-3 w-12 h-12 bg-white shadow-xl rounded-xl'
>
{
CONFIRM_MAP
[
type
].
icon
}
</
div
>
<
div
className=
'text-xl font-semibold text-gray-900'
>
{
title
}
</
div
>
{
desc
&&
<
div
className=
'mt-1 text-sm text-gray-500'
>
{
desc
}
</
div
>
}
<
div
className=
'flex items-center justify-end mt-10'
>
<
Button
className=
'mr-2 min-w-24 text-sm font-medium !text-gray-700'
onClick=
{
onCancel
}
>
{
t
(
'common.operation.cancel'
)
}
</
Button
>
<
Button
type=
'primary'
className=
''
>
{
CONFIRM_MAP
[
type
].
confirmText
}
</
Button
>
</
div
>
</
div
>
</
Modal
>
)
}
export
default
ConfirmCommon
web/app/components/header/account-setting/model-page/model-item/Operation.tsx
View file @
fcd596c3
import
type
{
FC
}
from
'react'
import
{
Fragment
}
from
'react'
import
{
Popover
,
Transition
}
from
'@headlessui/react'
import
{
useTranslation
}
from
'react-i18next'
...
...
@@ -7,7 +8,13 @@ const itemClassName = `
flex items-center px-3 h-9 text-sm text-gray-700 rounded-lg cursor-pointer
`
const
Operation
=
()
=>
{
type
OperationProps
=
{
onOperate
:
(
action
:
string
)
=>
void
}
const
Operation
:
FC
<
OperationProps
>
=
({
onOperate
,
})
=>
{
const
{
t
}
=
useTranslation
()
return
(
...
...
@@ -33,7 +40,7 @@ const Operation = () => {
<
Popover
.
Panel
className=
'absolute top-8 right-0 w-[144px] bg-white border-[0.5px] border-gray-200 rounded-lg shadow-lg z-10'
>
<
div
className=
'p-1'
>
<
Popover
.
Button
as=
{
Fragment
}
>
<
div
className=
{
`group ${itemClassName} hover:bg-[#FEF3F2] hover:text-[#D92D20]`
}
>
<
div
className=
{
`group ${itemClassName} hover:bg-[#FEF3F2] hover:text-[#D92D20]`
}
onClick=
{
()
=>
onOperate
(
'delete'
)
}
>
<
Trash03
className=
'mr-2 w-4 h-4 text-gray-500 group-hover:text-[#D92D20]'
/>
{
t
(
'common.operation.remove'
)
}
</
div
>
...
...
web/app/components/header/account-setting/model-page/model-item/index.tsx
View file @
fcd596c3
import
{
useState
}
from
'react'
import
type
{
FC
,
ReactElement
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
Indicator
from
'../../../indicator'
import
Operation
from
'./Operation'
import
Button
from
'@/app/components/base/button'
import
Confirm
from
'@/app/components/base/confirm/common'
type
ModelItemProps
=
{
provider
:
{
key
:
string
;
type
:
string
;
icon
:
ReactElement
}
...
...
@@ -14,26 +16,75 @@ const ModelItem: FC<ModelItemProps> = ({
onOpenModal
,
})
=>
{
const
{
t
}
=
useTranslation
()
const
[
confirmShow
,
setConfirmShow
]
=
useState
(
false
)
return
(
<
div
className=
'flex justify-between items-center mb-2 px-4 h-14 bg-gray-50 rounded-xl'
>
{
provider
.
icon
}
<
Button
className=
'!px-3 !h-7 rounded-md bg-white !text-xs font-medium text-gray-700'
onClick=
{
onOpenModal
}
>
{
t
(
`common.operation.${provider.type}`
)
}
</
Button
>
<
div
className=
'flex items-center'
>
<
Indicator
className=
'mr-3'
/>
<
div
className=
'mb-2 bg-gray-50 rounded-xl'
>
<
div
className=
'flex justify-between items-center px-4 h-14'
>
{
provider
.
icon
}
<
Button
className=
'
mr-1
!px-3 !h-7 rounded-md bg-white !text-xs font-medium text-gray-700'
className=
'!px-3 !h-7 rounded-md bg-white !text-xs font-medium text-gray-700'
onClick=
{
onOpenModal
}
>
{
t
(
'common.operation.edit'
)
}
{
t
(
`common.operation.${provider.type}`
)
}
</
Button
>
<
Operation
/>
<
div
className=
'flex items-center'
>
<
Indicator
className=
'mr-3'
/>
<
Button
className=
'mr-1 !px-3 !h-7 rounded-md bg-white !text-xs font-medium text-gray-700'
onClick=
{
onOpenModal
}
>
{
t
(
'common.operation.edit'
)
}
</
Button
>
<
Operation
onOperate=
{
()
=>
setConfirmShow
(
true
)
}
/>
</
div
>
</
div
>
<
div
className=
'px-3 pb-3'
>
<
div
className=
'flex mb-1 px-3 py-2 bg-white rounded-lg shadow-xs last:mb-0'
>
<
div
className=
'grow'
>
<
div
className=
'flex items-center mb-0.5 h-[18px] text-[13px] font-medium text-gray-700'
>
al6z-infra/llama136-v2-chat
<
div
className=
'ml-2 px-1.5 rounded-md border border-[rgba(0,0,0,0.08)] text-xs text-gray-600'
>
Embeddings
</
div
>
</
div
>
<
div
className=
'text-xs text-gray-500'
>
version: d7769041994d94e96ad9d568eac12laecf50684a060963625a41c4006126985
</
div
>
</
div
>
<
div
className=
'flex items-center'
>
<
Indicator
className=
'mr-3'
/>
<
Button
className=
'mr-1 !px-3 !h-7 rounded-md bg-white !text-xs font-medium text-gray-700'
onClick=
{
onOpenModal
}
>
{
t
(
'common.operation.edit'
)
}
</
Button
>
<
Operation
onOperate=
{
()
=>
setConfirmShow
(
true
)
}
/>
</
div
>
</
div
>
<
div
className=
'flex mb-1 px-3 py-2 bg-white rounded-lg shadow-xs last:mb-0'
>
<
div
className=
'grow'
>
<
div
className=
'flex items-center mb-0.5 h-[18px] text-[13px] font-medium text-gray-700'
>
al6z-infra/llama136-v2-chat
<
div
className=
'ml-2 px-1.5 rounded-md border border-[rgba(0,0,0,0.08)] text-xs text-gray-600'
>
Embeddings
</
div
>
</
div
>
<
div
className=
'text-xs text-gray-500'
>
version: d7769041994d94e96ad9d568eac12laecf50684a060963625a41c4006126985
</
div
>
</
div
>
<
div
className=
'flex items-center'
>
<
Indicator
className=
'mr-3'
/>
<
Button
className=
'mr-1 !px-3 !h-7 rounded-md bg-white !text-xs font-medium text-gray-700'
onClick=
{
onOpenModal
}
>
{
t
(
'common.operation.edit'
)
}
</
Button
>
<
Operation
onOperate=
{
()
=>
setConfirmShow
(
true
)
}
/>
</
div
>
</
div
>
</
div
>
<
Confirm
isShow=
{
confirmShow
}
onCancel=
{
()
=>
setConfirmShow
(
false
)
}
title=
'xxxx-xxx'
desc=
'xxxxx'
/>
</
div
>
)
}
...
...
web/i18n/lang/common.en.ts
View file @
fcd596c3
...
...
@@ -224,12 +224,6 @@ const translation = {
models
:
'Models'
,
showMoreModelProvider
:
'Show more model provider'
,
card
:
{
openai
:
{
desc
:
'Models provided by OpenAI, such as GPT-3.5-Turbo and GPT-4.'
,
},
anthropic
:
{
desc
:
'Anthropic’s powerful models, such as Claude 2 and Claude Instant.'
,
},
quota
:
'QUOTA'
,
onTrial
:
'On Trial'
,
paid
:
'Paid'
,
...
...
web/i18n/lang/common.zh.ts
View file @
fcd596c3
...
...
@@ -220,12 +220,6 @@ const translation = {
models
:
'Models'
,
showMoreModelProvider
:
'Show more model provider'
,
card
:
{
openai
:
{
desc
:
'Models provided by OpenAI, such as GPT-3.5-Turbo and GPT-4.'
,
},
anthropic
:
{
desc
:
'Anthropic’s powerful models, such as Claude 2 and Claude Instant.'
,
},
quota
:
'QUOTA'
,
onTrial
:
'On Trial'
,
paid
:
'Paid'
,
...
...
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