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
cd78adb0
Unverified
Commit
cd78adb0
authored
Aug 17, 2023
by
Joel
Committed by
GitHub
Aug 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support show model display name (#887)
parent
f42e7d1a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
6 deletions
+20
-6
index.tsx
web/app/components/app/configuration/config-model/index.tsx
+1
-1
model-name.tsx
.../components/app/configuration/config-model/model-name.tsx
+7
-1
index.tsx
...ents/explore/universal-chat/config-view/summary/index.tsx
+6
-1
declarations.ts
...ponents/header/account-setting/model-page/declarations.ts
+1
-0
index.tsx
...eader/account-setting/model-page/model-selector/index.tsx
+5
-3
No files found.
web/app/components/app/configuration/config-model/index.tsx
View file @
cd78adb0
...
@@ -257,7 +257,7 @@ const ConfigModel: FC<IConfigModelProps> = ({
...
@@ -257,7 +257,7 @@ const ConfigModel: FC<IConfigModelProps> = ({
providerName=
{
provider
}
providerName=
{
provider
}
/>
/>
<
div
className=
'text-[13px] text-gray-900 font-medium'
>
<
div
className=
'text-[13px] text-gray-900 font-medium'
>
<
ModelName
modelId=
{
selectedModel
.
name
}
/>
<
ModelName
modelId=
{
selectedModel
.
name
}
modelDisplayName=
{
currModel
?.
model_display_name
}
/>
</
div
>
</
div
>
{
disabled
?
<
InformationCircleIcon
className=
'w-3.5 h-3.5 text-[#F79009]'
/>
:
<
Cog8ToothIcon
className=
'w-3.5 h-3.5 text-gray-500'
/>
}
{
disabled
?
<
InformationCircleIcon
className=
'w-3.5 h-3.5 text-[#F79009]'
/>
:
<
Cog8ToothIcon
className=
'w-3.5 h-3.5 text-gray-500'
/>
}
</
div
>
</
div
>
...
...
web/app/components/app/configuration/config-model/model-name.tsx
View file @
cd78adb0
...
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'
...
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'
export
type
IModelNameProps
=
{
export
type
IModelNameProps
=
{
modelId
:
string
modelId
:
string
modelDisplayName
?:
string
}
}
export
const
supportI18nModelName
=
[
export
const
supportI18nModelName
=
[
...
@@ -16,9 +17,14 @@ export const supportI18nModelName = [
...
@@ -16,9 +17,14 @@ export const supportI18nModelName = [
const
ModelName
:
FC
<
IModelNameProps
>
=
({
const
ModelName
:
FC
<
IModelNameProps
>
=
({
modelId
,
modelId
,
modelDisplayName
,
})
=>
{
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
name
=
supportI18nModelName
.
includes
(
modelId
)
?
t
(
`common.modelName.
${
modelId
}
`
)
:
modelId
let
name
=
modelId
if
(
supportI18nModelName
.
includes
(
modelId
))
name
=
t
(
`common.modelName.
${
modelId
}
`
)
else
if
(
modelDisplayName
)
name
=
modelDisplayName
return
(
return
(
<
span
title=
{
name
}
>
<
span
title=
{
name
}
>
...
...
web/app/components/explore/universal-chat/config-view/summary/index.tsx
View file @
cd78adb0
...
@@ -9,6 +9,8 @@ import { Google, WebReader, Wikipedia } from '@/app/components/base/icons/src/pu
...
@@ -9,6 +9,8 @@ import { Google, WebReader, Wikipedia } from '@/app/components/base/icons/src/pu
import
ConfigDetail
from
'@/app/components/explore/universal-chat/config-view/detail'
import
ConfigDetail
from
'@/app/components/explore/universal-chat/config-view/detail'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
type
{
ProviderEnum
}
from
'@/app/components/header/account-setting/model-page/declarations'
import
ModelName
from
'@/app/components/app/configuration/config-model/model-name'
import
ModelName
from
'@/app/components/app/configuration/config-model/model-name'
import
{
useProviderContext
}
from
'@/context/provider-context'
export
type
ISummaryProps
=
{
export
type
ISummaryProps
=
{
modelId
:
string
modelId
:
string
providerName
:
ProviderEnum
providerName
:
ProviderEnum
...
@@ -46,6 +48,9 @@ const Summary: FC<ISummaryProps> = ({
...
@@ -46,6 +48,9 @@ const Summary: FC<ISummaryProps> = ({
plugins
,
plugins
,
dataSets
,
dataSets
,
})
=>
{
})
=>
{
const
{
agentThoughtModelList
}
=
useProviderContext
()
const
currModel
=
agentThoughtModelList
.
find
(
item
=>
item
.
model_name
===
modelId
&&
item
.
model_provider
.
provider_name
===
providerName
)
// current_datetime is not configable and do not have icon
// current_datetime is not configable and do not have icon
const
pluginIds
=
Object
.
keys
(
plugins
).
filter
(
key
=>
plugins
[
key
]
&&
key
!==
'current_datetime'
)
const
pluginIds
=
Object
.
keys
(
plugins
).
filter
(
key
=>
plugins
[
key
]
&&
key
!==
'current_datetime'
)
const
[
isShowConfig
,
{
setFalse
:
hideConfig
,
toggle
:
toggleShowConfig
}]
=
useBoolean
(
false
)
const
[
isShowConfig
,
{
setFalse
:
hideConfig
,
toggle
:
toggleShowConfig
}]
=
useBoolean
(
false
)
...
@@ -58,7 +63,7 @@ const Summary: FC<ISummaryProps> = ({
...
@@ -58,7 +63,7 @@ const Summary: FC<ISummaryProps> = ({
<
div
ref=
{
configContentRef
}
className=
'relative'
>
<
div
ref=
{
configContentRef
}
className=
'relative'
>
<
div
onClick=
{
toggleShowConfig
}
className=
{
cn
(
getColorInfo
(
modelId
),
'flex items-center px-1 h-8 rounded-lg border cursor-pointer'
)
}
>
<
div
onClick=
{
toggleShowConfig
}
className=
{
cn
(
getColorInfo
(
modelId
),
'flex items-center px-1 h-8 rounded-lg border cursor-pointer'
)
}
>
<
ModelIcon
providerName=
{
providerName
}
modelId=
{
modelId
}
className=
'!w-6 !h-6'
/>
<
ModelIcon
providerName=
{
providerName
}
modelId=
{
modelId
}
className=
'!w-6 !h-6'
/>
<
div
className=
'ml-2 text-[13px] font-medium text-gray-900'
><
ModelName
modelId=
{
modelId
}
/></
div
>
<
div
className=
'ml-2 text-[13px] font-medium text-gray-900'
><
ModelName
modelId=
{
modelId
}
modelDisplayName=
{
currModel
?.
model_display_name
}
/></
div
>
{
{
pluginIds
.
length
>
0
&&
(
pluginIds
.
length
>
0
&&
(
<
div
className=
'ml-1.5 flex items-center'
>
<
div
className=
'ml-1.5 flex items-center'
>
...
...
web/app/components/header/account-setting/model-page/declarations.ts
View file @
cd78adb0
...
@@ -70,6 +70,7 @@ export enum ModelFeature {
...
@@ -70,6 +70,7 @@ export enum ModelFeature {
// backend defined model struct: /console/api/workspaces/current/models/model-type/:model_type
// backend defined model struct: /console/api/workspaces/current/models/model-type/:model_type
export
type
BackendModel
=
{
export
type
BackendModel
=
{
model_name
:
string
model_name
:
string
model_display_name
:
string
// not always exist
model_type
:
ModelType
model_type
:
ModelType
model_provider
:
{
model_provider
:
{
provider_name
:
ProviderEnum
provider_name
:
ProviderEnum
...
...
web/app/components/header/account-setting/model-page/model-selector/index.tsx
View file @
cd78adb0
...
@@ -47,6 +47,7 @@ const ModelSelector: FC<Props> = ({
...
@@ -47,6 +47,7 @@ const ModelSelector: FC<Props> = ({
[
ModelType
.
embeddings
]:
embeddingsModelList
,
[
ModelType
.
embeddings
]:
embeddingsModelList
,
[
ModelType
.
speech2text
]:
speech2textModelList
,
[
ModelType
.
speech2text
]:
speech2textModelList
,
})[
modelType
]
})[
modelType
]
const
currModel
=
modelList
.
find
(
item
=>
item
.
model_name
===
value
?.
modelName
&&
item
.
model_provider
.
provider_name
===
value
.
providerName
)
const
allModelNames
=
(()
=>
{
const
allModelNames
=
(()
=>
{
if
(
!
search
)
if
(
!
search
)
return
{}
return
{}
...
@@ -77,11 +78,12 @@ const ModelSelector: FC<Props> = ({
...
@@ -77,11 +78,12 @@ const ModelSelector: FC<Props> = ({
value
:
providerName
,
value
:
providerName
,
})
})
const
models
=
filteredModelList
.
filter
(
m
=>
m
.
model_provider
.
provider_name
===
providerName
)
const
models
=
filteredModelList
.
filter
(
m
=>
m
.
model_provider
.
provider_name
===
providerName
)
models
.
forEach
(({
model_name
})
=>
{
models
.
forEach
(({
model_name
,
model_display_name
})
=>
{
res
.
push
({
res
.
push
({
type
:
'model'
,
type
:
'model'
,
providerName
,
providerName
,
value
:
model_name
,
value
:
model_name
,
modelDisplayName
:
model_display_name
,
})
})
})
})
})
})
...
@@ -104,7 +106,7 @@ const ModelSelector: FC<Props> = ({
...
@@ -104,7 +106,7 @@ const ModelSelector: FC<Props> = ({
modelId=
{
value
.
modelName
}
modelId=
{
value
.
modelName
}
providerName=
{
value
.
providerName
}
providerName=
{
value
.
providerName
}
/>
/>
<
div
className=
'mr-1.5 grow text-left text-sm text-gray-900 truncate'
><
ModelName
modelId=
{
value
.
modelName
}
/></
div
>
<
div
className=
'mr-1.5 grow text-left text-sm text-gray-900 truncate'
><
ModelName
modelId=
{
value
.
modelName
}
modelDisplayName=
{
currModel
?.
model_display_name
}
/></
div
>
</>
</>
)
)
:
(
:
(
...
@@ -193,7 +195,7 @@ const ModelSelector: FC<Props> = ({
...
@@ -193,7 +195,7 @@ const ModelSelector: FC<Props> = ({
modelId=
{
model
.
value
}
modelId=
{
model
.
value
}
providerName=
{
model
.
providerName
}
providerName=
{
model
.
providerName
}
/>
/>
<
div
className=
'grow text-left text-sm text-gray-900 truncate'
><
ModelName
modelId=
{
model
.
value
}
/></
div
>
<
div
className=
'grow text-left text-sm text-gray-900 truncate'
><
ModelName
modelId=
{
model
.
value
}
modelDisplayName=
{
model
.
modelDisplayName
}
/></
div
>
{
(
value
?.
providerName
===
model
.
providerName
&&
value
?.
modelName
===
model
.
value
)
&&
<
Check
className=
'shrink-0 w-4 h-4 text-primary-600'
/>
}
{
(
value
?.
providerName
===
model
.
providerName
&&
value
?.
modelName
===
model
.
value
)
&&
<
Check
className=
'shrink-0 w-4 h-4 text-primary-600'
/>
}
</
Popover
.
Button
>
</
Popover
.
Button
>
)
)
...
...
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