mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
Merge branch 'main' into feat/workflow
This commit is contained in:
@ -210,6 +210,7 @@ const AgentTools: FC = () => {
|
||||
setting={currentTool?.tool_parameters as any}
|
||||
collection={currentTool?.collection as Collection}
|
||||
isBuiltIn={currentTool?.collection?.type === CollectionType.builtIn}
|
||||
isModel={currentTool?.collection?.type === CollectionType.model}
|
||||
onSave={handleToolSettingChange}
|
||||
onHide={() => setIsShowSettingTool(false)}
|
||||
/>)
|
||||
|
||||
@ -58,11 +58,16 @@ const SettingBuiltInTool: FC<Props> = ({
|
||||
(async () => {
|
||||
setIsLoading(true)
|
||||
try {
|
||||
const list = isBuiltIn
|
||||
? await fetchBuiltInToolList(collection.name)
|
||||
: isModel
|
||||
? await fetchModelToolList(collection.name)
|
||||
: await fetchCustomToolList(collection.name)
|
||||
const list = await new Promise<Tool[]>((resolve) => {
|
||||
(async function () {
|
||||
if (isModel)
|
||||
resolve(await fetchModelToolList(collection.name))
|
||||
else if (isBuiltIn)
|
||||
resolve(await fetchBuiltInToolList(collection.name))
|
||||
else
|
||||
resolve(await fetchCustomToolList(collection.name))
|
||||
}())
|
||||
})
|
||||
setTools(list)
|
||||
const currTool = list.find(tool => tool.name === toolName)
|
||||
if (currTool) {
|
||||
|
||||
@ -3,7 +3,7 @@ import type { FC } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import cn from 'classnames'
|
||||
import { toolCredentialToFormSchemas } from '../../utils/to-form-schema'
|
||||
import { addDefaultValue, toolCredentialToFormSchemas } from '../../utils/to-form-schema'
|
||||
import type { Collection } from '../../types'
|
||||
import Drawer from '@/app/components/base/drawer-plus'
|
||||
import Button from '@/app/components/base/button'
|
||||
@ -30,12 +30,15 @@ const ConfigCredential: FC<Props> = ({
|
||||
const { t } = useTranslation()
|
||||
const [credentialSchema, setCredentialSchema] = useState<any>(null)
|
||||
const { team_credentials: credentialValue, name: collectionName } = collection
|
||||
const [tempCredential, setTempCredential] = React.useState<any>(credentialValue)
|
||||
useEffect(() => {
|
||||
fetchBuiltInToolCredentialSchema(collectionName).then((res) => {
|
||||
setCredentialSchema(toolCredentialToFormSchemas(res))
|
||||
const toolCredentialSchemas = toolCredentialToFormSchemas(res)
|
||||
const defaultCredentials = addDefaultValue(credentialValue, toolCredentialSchemas)
|
||||
setCredentialSchema(toolCredentialSchemas)
|
||||
setTempCredential(defaultCredentials)
|
||||
})
|
||||
}, [])
|
||||
const [tempCredential, setTempCredential] = React.useState<any>(credentialValue)
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
|
||||
Reference in New Issue
Block a user