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
f277a347
Commit
f277a347
authored
Jul 19, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: model summary
parent
04674f30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
5 deletions
+67
-5
model-icon.tsx
.../components/app/configuration/config-model/model-icon.tsx
+5
-3
panel.tsx
...p/components/explore/universal-chat/config-view/panel.tsx
+11
-0
summary.tsx
...components/explore/universal-chat/config-view/summary.tsx
+44
-0
index.tsx
web/app/components/explore/universal-chat/index.tsx
+7
-2
No files found.
web/app/components/app/configuration/config-model/model-icon.tsx
View file @
f277a347
...
@@ -2,11 +2,13 @@
...
@@ -2,11 +2,13 @@
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
React
from
'react'
import
{
ProviderType
}
from
'@/types/app'
import
{
ProviderType
}
from
'@/types/app'
import
{
MODEL_LIST
}
from
'@/config'
export
type
IModelIconProps
=
{
provider
?:
ProviderType
;
className
?:
string
}
export
type
IModelIconProps
=
{
modelId
?:
string
;
provider
?:
ProviderType
;
className
?:
string
}
const
ModelIcon
:
FC
<
IModelIconProps
>
=
({
provider
,
className
})
=>
{
const
ModelIcon
:
FC
<
IModelIconProps
>
=
({
modelId
,
provider
,
className
})
=>
{
if
(
provider
===
ProviderType
.
anthropic
)
{
const
model
=
MODEL_LIST
.
find
(
item
=>
item
.
id
===
modelId
)
if
(
provider
===
ProviderType
.
anthropic
||
model
?.
provider
===
ProviderType
.
anthropic
)
{
return
(
return
(
<
svg
className=
{
`w-4 h-4 ${className}`
}
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
svg
className=
{
`w-4 h-4 ${className}`
}
width=
"24"
height=
"24"
viewBox=
"0 0 24 24"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
rect
width=
"24"
height=
"24"
rx=
"6"
fill=
"#CA9F7B"
/>
<
rect
width=
"24"
height=
"24"
rx=
"6"
fill=
"#CA9F7B"
/>
...
...
web/app/components/explore/universal-chat/config-view/panel.tsx
0 → 100644
View file @
f277a347
'use client'
import
type
{
FC
}
from
'react'
import
React
from
'react'
const
ConfigViewPanel
:
FC
=
()
=>
{
return
(
<
div
>
</
div
>
)
}
export
default
React
.
memo
(
ConfigViewPanel
)
web/app/components/explore/universal-chat/config-view/summary.tsx
0 → 100644
View file @
f277a347
'use client'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
cn
from
'classnames'
import
ModelIcon
from
'@/app/components/app/configuration/config-model/model-icon'
export
type
ISummaryProps
=
{
modelId
:
string
pluginIds
:
string
[]
}
const
getColorInfo
=
(
modelId
:
string
)
=>
{
if
(
modelId
===
'gpt-4'
)
return
'bg-[#EBE9FE] border-[#F4F3FF]'
if
(
modelId
===
'claude-2'
)
return
'bg-[#F9EBDF] border-[#FCF3EB]'
return
'bg-[#D3F8DF] border-[#EDFCF2]'
}
const
Summary
:
FC
<
ISummaryProps
>
=
({
modelId
,
pluginIds
,
})
=>
{
return
(
<
div
className=
{
cn
(
getColorInfo
(
modelId
),
'flex items-center px-1 h-8 rounded-lg border'
)
}
>
<
ModelIcon
modelId=
{
modelId
}
className=
'!w-6 !h-6'
/>
<
div
className=
'ml-2 text-[13px] font-medium text-gray-900'
>
{
modelId
}
</
div
>
{
pluginIds
.
length
>
0
&&
(
<
div
className=
'ml-1.5 flex items-center'
>
<
div
className=
'mr-1 h-3 w-[1px] bg-[#000] opacity-[0.05]'
></
div
>
<
div
className=
'flex space-x-1'
>
{
pluginIds
.
map
(
pluginId
=>
(
<
div
key=
{
pluginId
}
>
{
pluginId
[
0
]
}
</
div
>
))
}
</
div
>
</
div
>
)
}
</
div
>
)
}
export
default
React
.
memo
(
Summary
)
web/app/components/explore/universal-chat/index.tsx
View file @
f277a347
...
@@ -35,6 +35,7 @@ import { replaceStringWithValues } from '@/app/components/app/configuration/prom
...
@@ -35,6 +35,7 @@ import { replaceStringWithValues } from '@/app/components/app/configuration/prom
import
{
userInputsFormToPromptVariables
}
from
'@/utils/model-config'
import
{
userInputsFormToPromptVariables
}
from
'@/utils/model-config'
import
Confirm
from
'@/app/components/base/confirm'
import
Confirm
from
'@/app/components/base/confirm'
import
type
{
DataSet
}
from
'@/models/datasets'
import
type
{
DataSet
}
from
'@/models/datasets'
import
ConfigSummary
from
'@/app/components/explore/universal-chat/config-view/summary'
const
APP_ID
=
'universal-chat'
const
APP_ID
=
'universal-chat'
const
isUniversalChat
=
true
const
isUniversalChat
=
true
...
@@ -562,12 +563,16 @@ const Main: FC<IMainProps> = () => {
...
@@ -562,12 +563,16 @@ const Main: FC<IMainProps> = () => {
)
)
}
>
}
>
<
div
className=
{
cn
(
doShowSuggestion
?
'pb-[140px]'
:
(
isResponsing
?
'pb-[113px]'
:
'pb-[76px]'
),
'relative grow h-[200px] mb-3.5 overflow-hidden'
)
}
>
<
div
className=
{
cn
(
doShowSuggestion
?
'pb-[140px]'
:
(
isResponsing
?
'pb-[113px]'
:
'pb-[76px]'
),
'relative grow h-[200px] mb-3.5 overflow-hidden'
)
}
>
{
!
isNewConversation
&&
(
{
(
!
isNewConversation
||
isResponsing
)
&&
(
<
div
className=
'absolute z-10 top-0 left-0 right-0 flex items-center justify-between border-b border-gray-100 mobile:h-12 tablet:h-16 px-8 bg-white'
>
<
div
className=
'absolute z-10 top-0 left-0 right-0 flex items-center justify-between border-b border-gray-100 mobile:h-12 tablet:h-16 px-8 bg-white'
>
<
div
className=
'text-gray-900'
>
{
conversationName
}
</
div
>
<
div
className=
'text-gray-900'
>
{
conversationName
}
</
div
>
<
div
className=
'flex items-center shrink-0 ml-2'
>
<
ConfigSummary
modelId=
{
modelId
}
pluginIds=
{
Object
.
keys
(
plugins
).
filter
(
key
=>
plugins
[
key
])
}
/>
</
div
>
</
div
>
</
div
>
)
}
)
}
<
div
className=
{
cn
(
!
isNewConversation
&&
'pt-[90px]'
,
'pc:w-[794px] max-w-full mobile:w-full mx-auto h-full overflow-y-auto'
)
}
ref=
{
chatListDomRef
}
>
<
div
className=
{
cn
(
(
!
isNewConversation
||
isResponsing
)
&&
'pt-[90px]'
,
'pc:w-[794px] max-w-full mobile:w-full mx-auto h-full overflow-y-auto'
)
}
ref=
{
chatListDomRef
}
>
<
Chat
<
Chat
configElem=
{
<
Init
configElem=
{
<
Init
modelId=
{
modelId
}
modelId=
{
modelId
}
...
...
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