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
fa8ab213
Unverified
Commit
fa8ab213
authored
Mar 01, 2024
by
Joel
Committed by
GitHub
Mar 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: displaying the tool description when clicking on a custom tool (#2642)
parent
1a677da7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
22 deletions
+53
-22
index.tsx
...ents/app/configuration/config/agent/agent-tools/index.tsx
+13
-12
setting-built-in-tool.tsx
...ration/config/agent/agent-tools/setting-built-in-tool.tsx
+24
-8
index.tsx
web/app/components/tools/index.tsx
+14
-1
item.tsx
web/app/components/tools/tool-list/item.tsx
+2
-1
No files found.
web/app/components/app/configuration/config/agent/agent-tools/index.tsx
View file @
fa8ab213
...
@@ -153,18 +153,18 @@ const AgentTools: FC = () => {
...
@@ -153,18 +153,18 @@ const AgentTools: FC = () => {
)
)
:
(
:
(
<
div
className=
'hidden group-hover:flex items-center'
>
<
div
className=
'hidden group-hover:flex items-center'
>
{
item
.
provider_type
===
CollectionType
.
builtIn
&&
(
{
/* {item.provider_type === CollectionType.builtIn && ( */
}
<
TooltipPlus
<
TooltipPlus
popupContent=
{
t
(
'tools.setBuiltInTools.infoAndSetting'
)
}
popupContent=
{
t
(
'tools.setBuiltInTools.infoAndSetting'
)
}
>
>
<
div
className=
'mr-1 p-1 rounded-md hover:bg-black/5 cursor-pointer'
onClick=
{
()
=>
{
<
div
className=
'mr-1 p-1 rounded-md hover:bg-black/5 cursor-pointer'
onClick=
{
()
=>
{
setCurrentTool
(
item
)
setCurrentTool
(
item
)
setIsShowSettingTool
(
true
)
setIsShowSettingTool
(
true
)
}
}
>
}
}
>
<
InfoCircle
className=
'w-4 h-4 text-gray-500'
/>
<
InfoCircle
className=
'w-4 h-4 text-gray-500'
/>
</
div
>
</
div
>
</
TooltipPlus
>
</
TooltipPlus
>
)
}
{
/* )} */
}
<
div
className=
'p-1 rounded-md hover:bg-black/5 cursor-pointer'
onClick=
{
()
=>
{
<
div
className=
'p-1 rounded-md hover:bg-black/5 cursor-pointer'
onClick=
{
()
=>
{
const
newModelConfig
=
produce
(
modelConfig
,
(
draft
)
=>
{
const
newModelConfig
=
produce
(
modelConfig
,
(
draft
)
=>
{
...
@@ -209,6 +209,7 @@ const AgentTools: FC = () => {
...
@@ -209,6 +209,7 @@ const AgentTools: FC = () => {
toolName=
{
currentTool
?.
tool_name
as
string
}
toolName=
{
currentTool
?.
tool_name
as
string
}
setting=
{
currentTool
?.
tool_parameters
as
any
}
setting=
{
currentTool
?.
tool_parameters
as
any
}
collection=
{
currentTool
?.
collection
as
Collection
}
collection=
{
currentTool
?.
collection
as
Collection
}
isBuiltIn=
{
currentTool
?.
collection
?.
type
===
CollectionType
.
builtIn
}
onSave=
{
handleToolSettingChange
}
onSave=
{
handleToolSettingChange
}
onHide=
{
()
=>
setIsShowSettingTool
(
false
)
}
onHide=
{
()
=>
setIsShowSettingTool
(
false
)
}
/>)
/>)
...
...
web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
View file @
fa8ab213
...
@@ -8,14 +8,17 @@ import Drawer from '@/app/components/base/drawer-plus'
...
@@ -8,14 +8,17 @@ import Drawer from '@/app/components/base/drawer-plus'
import
Form
from
'@/app/components/header/account-setting/model-provider-page/model-modal/Form'
import
Form
from
'@/app/components/header/account-setting/model-provider-page/model-modal/Form'
import
{
addDefaultValue
,
toolParametersToFormSchemas
}
from
'@/app/components/tools/utils/to-form-schema'
import
{
addDefaultValue
,
toolParametersToFormSchemas
}
from
'@/app/components/tools/utils/to-form-schema'
import
type
{
Collection
,
Tool
}
from
'@/app/components/tools/types'
import
type
{
Collection
,
Tool
}
from
'@/app/components/tools/types'
import
{
fetchBuiltInToolList
}
from
'@/service/tools'
import
{
fetchBuiltInToolList
,
fetchCustomToolList
}
from
'@/service/tools'
import
I18n
from
'@/context/i18n'
import
I18n
from
'@/context/i18n'
import
Button
from
'@/app/components/base/button'
import
Button
from
'@/app/components/base/button'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
import
{
DiagonalDividingLine
}
from
'@/app/components/base/icons/src/public/common'
import
{
DiagonalDividingLine
}
from
'@/app/components/base/icons/src/public/common'
import
{
getLanguage
}
from
'@/i18n/language'
import
{
getLanguage
}
from
'@/i18n/language'
import
AppIcon
from
'@/app/components/base/app-icon'
type
Props
=
{
type
Props
=
{
collection
:
Collection
collection
:
Collection
isBuiltIn
?:
boolean
toolName
:
string
toolName
:
string
setting
?:
Record
<
string
,
any
>
setting
?:
Record
<
string
,
any
>
readonly
?:
boolean
readonly
?:
boolean
...
@@ -25,6 +28,7 @@ type Props = {
...
@@ -25,6 +28,7 @@ type Props = {
const
SettingBuiltInTool
:
FC
<
Props
>
=
({
const
SettingBuiltInTool
:
FC
<
Props
>
=
({
collection
,
collection
,
isBuiltIn
=
true
,
toolName
,
toolName
,
setting
=
{},
setting
=
{},
readonly
,
readonly
,
...
@@ -52,7 +56,7 @@ const SettingBuiltInTool: FC<Props> = ({
...
@@ -52,7 +56,7 @@ const SettingBuiltInTool: FC<Props> = ({
(
async
()
=>
{
(
async
()
=>
{
setIsLoading
(
true
)
setIsLoading
(
true
)
try
{
try
{
const
list
=
await
fetchBuiltIn
ToolList
(
collection
.
name
)
const
list
=
isBuiltIn
?
await
fetchBuiltInToolList
(
collection
.
name
)
:
await
fetchCustom
ToolList
(
collection
.
name
)
setTools
(
list
)
setTools
(
list
)
const
currTool
=
list
.
find
(
tool
=>
tool
.
name
===
toolName
)
const
currTool
=
list
.
find
(
tool
=>
tool
.
name
===
toolName
)
if
(
currTool
)
{
if
(
currTool
)
{
...
@@ -135,12 +139,24 @@ const SettingBuiltInTool: FC<Props> = ({
...
@@ -135,12 +139,24 @@ const SettingBuiltInTool: FC<Props> = ({
onHide=
{
onHide
}
onHide=
{
onHide
}
title=
{
(
title=
{
(
<
div
className=
'flex'
>
<
div
className=
'flex'
>
<
div
{
collection
.
icon
===
'string'
className=
'w-6 h-6 bg-cover bg-center rounded-md'
?
(
style=
{
{
<
div
backgroundImage
:
`url(${collection.icon})`
,
className=
'w-6 h-6 bg-cover bg-center rounded-md'
}
}
style=
{
{
></
div
>
backgroundImage
:
`url(${collection.icon})`
,
}
}
></
div
>
)
:
(
<
AppIcon
className=
'rounded-md'
size=
'tiny'
icon=
{
(
collection
.
icon
as
any
)?.
content
}
background=
{
(
collection
.
icon
as
any
)?.
background
}
/>
)
}
<
div
className=
'ml-2 leading-6 text-base font-semibold text-gray-900'
>
{
currTool
?.
label
[
language
]
}
</
div
>
<
div
className=
'ml-2 leading-6 text-base font-semibold text-gray-900'
>
{
currTool
?.
label
[
language
]
}
</
div
>
{
(
hasSetting
&&
!
readonly
)
&&
(<>
{
(
hasSetting
&&
!
readonly
)
&&
(<>
<
DiagonalDividingLine
className=
'mx-4'
/>
<
DiagonalDividingLine
className=
'mx-4'
/>
...
...
web/app/components/tools/index.tsx
View file @
fa8ab213
...
@@ -69,9 +69,22 @@ const Tools: FC<Props> = ({
...
@@ -69,9 +69,22 @@ const Tools: FC<Props> = ({
})()
})()
const
[
query
,
setQuery
]
=
useState
(
''
)
const
[
query
,
setQuery
]
=
useState
(
''
)
const
[
collectionType
,
set
CollectionType
]
=
useTabSearchParams
({
const
[
toolPageCollectionType
,
setToolPage
CollectionType
]
=
useTabSearchParams
({
defaultTab
:
collectionTypeOptions
[
0
].
value
,
defaultTab
:
collectionTypeOptions
[
0
].
value
,
})
})
const
[
appPageCollectionType
,
setAppPageCollectionType
]
=
useState
(
collectionTypeOptions
[
0
].
value
)
const
{
collectionType
,
setCollectionType
}
=
(()
=>
{
if
(
isInToolsPage
)
{
return
{
collectionType
:
toolPageCollectionType
,
setCollectionType
:
setToolPageCollectionType
,
}
}
return
{
collectionType
:
appPageCollectionType
,
setCollectionType
:
setAppPageCollectionType
,
}
})()
const
showCollectionList
=
(()
=>
{
const
showCollectionList
=
(()
=>
{
let
typeFilteredList
:
Collection
[]
=
[]
let
typeFilteredList
:
Collection
[]
=
[]
...
...
web/app/components/tools/tool-list/item.tsx
View file @
fa8ab213
...
@@ -63,7 +63,7 @@ const Item: FC<Props> = ({
...
@@ -63,7 +63,7 @@ const Item: FC<Props> = ({
)
}
)
}
</
div
>
</
div
>
</
div
>
</
div
>
{
showDetail
&&
isBuiltIn
&&
(
{
showDetail
&&
(
<
SettingBuiltInTool
<
SettingBuiltInTool
collection=
{
collection
}
collection=
{
collection
}
toolName=
{
payload
.
name
}
toolName=
{
payload
.
name
}
...
@@ -71,6 +71,7 @@ const Item: FC<Props> = ({
...
@@ -71,6 +71,7 @@ const Item: FC<Props> = ({
onHide=
{
()
=>
{
onHide=
{
()
=>
{
setShowDetail
(
false
)
setShowDetail
(
false
)
}
}
}
}
isBuiltIn=
{
isBuiltIn
}
/>
/>
)
}
)
}
</>
</>
...
...
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