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
604930db
Commit
604930db
authored
Mar 01, 2024
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support detect when to show vision config
parent
c3f99779
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
panel.tsx
web/app/components/workflow/nodes/llm/panel.tsx
+15
-13
use-config.ts
web/app/components/workflow/nodes/llm/use-config.ts
+14
-0
No files found.
web/app/components/workflow/nodes/llm/panel.tsx
View file @
604930db
...
...
@@ -20,6 +20,7 @@ const Panel: FC = () => {
const
{
inputs
,
isShowVisionConfig
,
handleModelChanged
,
handleCompletionParamsChange
,
handleVarListChange
,
...
...
@@ -88,8 +89,8 @@ const Panel: FC = () => {
Prompt
</
Field
>
{
/* */
}
{
isChatApp
&&
isChat
App
&&
(
{
/*
Memory examples
*/
}
{
isChatApp
&&
isChat
Model
&&
(
<
div
className=
'text-xs text-gray-300'
>
Memory examples(Designing)
</
div
>
)
}
{
/* Memory */
}
...
...
@@ -106,18 +107,19 @@ const Panel: FC = () => {
)
}
{
/* Vision: GPT4-vision and so on */
}
<
Field
title=
{
t
(
`${i18nPrefix}.vision`
)
}
tooltip=
{
t
(
'appDebug.vision.description'
)
!
}
operations=
{
<
ResolutionPicker
value=
{
inputs
.
vision
.
configs
.
detail
}
onChange=
{
handleVisionResolutionChange
}
/>
}
/>
{
isShowVisionConfig
&&
(
<
Field
title=
{
t
(
`${i18nPrefix}.vision`
)
}
tooltip=
{
t
(
'appDebug.vision.description'
)
!
}
operations=
{
<
ResolutionPicker
value=
{
inputs
.
vision
.
configs
.
detail
}
onChange=
{
handleVisionResolutionChange
}
/>
}
/>
)
}
</
div
>
<
Split
/>
<
div
className=
'px-4 pt-4 pb-2'
>
<
OutputVars
>
<>
...
...
web/app/components/workflow/nodes/llm/use-config.ts
View file @
604930db
...
...
@@ -4,11 +4,14 @@ import useVarList from '../_base/hooks/use-var-list'
import
type
{
Memory
,
ValueSelector
}
from
'../../types'
import
type
{
LLMNodeType
}
from
'./types'
import
type
{
Resolution
}
from
'@/types/app'
import
{
useTextGenerationCurrentProviderAndModelAndModelList
}
from
'@/app/components/header/account-setting/model-provider-page/hooks'
import
{
ModelFeatureEnum
}
from
'@/app/components/header/account-setting/model-provider-page/declarations'
const
useConfig
=
(
initInputs
:
LLMNodeType
)
=>
{
const
[
inputs
,
setInputs
]
=
useState
<
LLMNodeType
>
(
initInputs
)
// model
const
model
=
inputs
.
model
const
handleModelChanged
=
useCallback
((
model
:
{
provider
:
string
;
modelId
:
string
;
mode
?:
string
})
=>
{
const
newInputs
=
produce
(
inputs
,
(
draft
)
=>
{
draft
.
model
.
provider
=
model
.
provider
...
...
@@ -25,6 +28,16 @@ const useConfig = (initInputs: LLMNodeType) => {
setInputs
(
newInputs
)
},
[
inputs
,
setInputs
])
const
{
currentModel
:
currModel
,
}
=
useTextGenerationCurrentProviderAndModelAndModelList
(
{
provider
:
model
.
provider
,
model
:
model
.
name
,
},
)
const
isShowVisionConfig
=
!!
currModel
?.
features
?.
includes
(
ModelFeatureEnum
.
vision
)
// variables
const
{
handleVarListChange
,
handleAddVariable
}
=
useVarList
<
LLMNodeType
>
({
inputs
,
...
...
@@ -55,6 +68,7 @@ const useConfig = (initInputs: LLMNodeType) => {
return
{
inputs
,
isShowVisionConfig
,
handleModelChanged
,
handleCompletionParamsChange
,
handleVarListChange
,
...
...
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