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
bdc7611d
Commit
bdc7611d
authored
Mar 11, 2024
by
crazywoola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support change model in fe
parent
ea2945c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
index.tsx
web/app/components/datasets/settings/form/index.tsx
+21
-11
datasets.ts
web/service/datasets.ts
+6
-1
No files found.
web/app/components/datasets/settings/form/index.tsx
View file @
bdc7611d
...
@@ -24,6 +24,9 @@ import {
...
@@ -24,6 +24,9 @@ import {
useModelList
,
useModelList
,
useModelListAndDefaultModelAndCurrentProviderAndModel
,
useModelListAndDefaultModelAndCurrentProviderAndModel
,
}
from
'@/app/components/header/account-setting/model-provider-page/hooks'
}
from
'@/app/components/header/account-setting/model-provider-page/hooks'
import
type
{
DefaultModel
,
}
from
'@/app/components/header/account-setting/model-provider-page/declarations'
const
rowClass
=
`
const
rowClass
=
`
flex justify-between py-4 flex-wrap gap-y-2
flex justify-between py-4 flex-wrap gap-y-2
...
@@ -58,7 +61,17 @@ const Form = () => {
...
@@ -58,7 +61,17 @@ const Form = () => {
const
[
permission
,
setPermission
]
=
useState
(
currentDataset
?.
permission
)
const
[
permission
,
setPermission
]
=
useState
(
currentDataset
?.
permission
)
const
[
indexMethod
,
setIndexMethod
]
=
useState
(
currentDataset
?.
indexing_technique
)
const
[
indexMethod
,
setIndexMethod
]
=
useState
(
currentDataset
?.
indexing_technique
)
const
[
retrievalConfig
,
setRetrievalConfig
]
=
useState
(
currentDataset
?.
retrieval_model_dict
as
RetrievalConfig
)
const
[
retrievalConfig
,
setRetrievalConfig
]
=
useState
(
currentDataset
?.
retrieval_model_dict
as
RetrievalConfig
)
const
[
embeddingModel
,
setEmbeddingModel
]
=
useState
<
DefaultModel
>
(
currentDataset
?.
embedding_model
?
{
provider
:
currentDataset
.
embedding_model_provider
,
model
:
currentDataset
.
embedding_model
,
}
:
{
provider
:
''
,
model
:
''
,
},
)
const
{
const
{
modelList
:
rerankModelList
,
modelList
:
rerankModelList
,
defaultModel
:
rerankDefaultModel
,
defaultModel
:
rerankDefaultModel
,
...
@@ -100,6 +113,8 @@ const Form = () => {
...
@@ -100,6 +113,8 @@ const Form = () => {
permission
,
permission
,
indexing_technique
:
indexMethod
,
indexing_technique
:
indexMethod
,
retrieval_model
:
postRetrievalConfig
,
retrieval_model
:
postRetrievalConfig
,
embedding_model
:
embeddingModel
.
model
,
embedding_model_provider
:
embeddingModel
.
provider
,
},
},
})
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
notify
({
type
:
'success'
,
message
:
t
(
'common.actionMsg.modifiedSuccessfully'
)
})
...
@@ -188,18 +203,13 @@ const Form = () => {
...
@@ -188,18 +203,13 @@ const Form = () => {
</
div
>
</
div
>
<
div
className=
'w-[480px]'
>
<
div
className=
'w-[480px]'
>
<
ModelSelector
<
ModelSelector
readonly
triggerClassName=
''
triggerClassName=
'!h-9 !cursor-not-allowed opacity-60'
defaultModel=
{
embeddingModel
}
defaultModel=
{
{
provider
:
currentDataset
.
embedding_model_provider
,
model
:
currentDataset
.
embedding_model
,
}
}
modelList=
{
embeddingModelList
}
modelList=
{
embeddingModelList
}
onSelect=
{
(
model
:
DefaultModel
)
=>
{
setEmbeddingModel
(
model
)
}
}
/>
/>
<
div
className=
'mt-2 w-full text-xs leading-6 text-gray-500'
>
{
t
(
'datasetSettings.form.embeddingModelTip'
)
}
<
span
className=
'text-[#155eef] cursor-pointer'
onClick=
{
()
=>
setShowAccountSettingModal
({
payload
:
'provider'
})
}
>
{
t
(
'datasetSettings.form.embeddingModelTipLink'
)
}
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
)
}
...
...
web/service/datasets.ts
View file @
bdc7611d
...
@@ -49,7 +49,12 @@ export const fetchDatasetDetail: Fetcher<DataSet, string> = (datasetId: string)
...
@@ -49,7 +49,12 @@ export const fetchDatasetDetail: Fetcher<DataSet, string> = (datasetId: string)
return
get
<
DataSet
>
(
`/datasets/
${
datasetId
}
`
)
return
get
<
DataSet
>
(
`/datasets/
${
datasetId
}
`
)
}
}
export
const
updateDatasetSetting
:
Fetcher
<
DataSet
,
{
datasetId
:
string
;
body
:
Partial
<
Pick
<
DataSet
,
'name'
|
'description'
|
'permission'
|
'indexing_technique'
|
'retrieval_model'
>>
}
>
=
({
datasetId
,
body
})
=>
{
export
const
updateDatasetSetting
:
Fetcher
<
DataSet
,
{
datasetId
:
string
body
:
Partial
<
Pick
<
DataSet
,
'name'
|
'description'
|
'permission'
|
'indexing_technique'
|
'retrieval_model'
|
'embedding_model'
|
'embedding_model_provider'
>>
}
>
=
({
datasetId
,
body
})
=>
{
return
patch
<
DataSet
>
(
`/datasets/
${
datasetId
}
`
,
{
body
})
return
patch
<
DataSet
>
(
`/datasets/
${
datasetId
}
`
,
{
body
})
}
}
...
...
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