mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
fix
This commit is contained in:
parent
45c9b77e82
commit
55bff10f0d
@ -10,7 +10,6 @@ import { CodeLanguage } from './types'
|
|||||||
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
|
||||||
import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-step-run'
|
import useOneStepRun from '@/app/components/workflow/nodes/_base/hooks/use-one-step-run'
|
||||||
import { fetchNodeDefault } from '@/service/workflow'
|
import { fetchNodeDefault } from '@/service/workflow'
|
||||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
||||||
import {
|
import {
|
||||||
useNodesReadOnly,
|
useNodesReadOnly,
|
||||||
} from '@/app/components/workflow/hooks'
|
} from '@/app/components/workflow/hooks'
|
||||||
@ -18,7 +17,7 @@ import {
|
|||||||
const useConfig = (id: string, payload: CodeNodeType) => {
|
const useConfig = (id: string, payload: CodeNodeType) => {
|
||||||
const { nodesReadOnly: readOnly } = useNodesReadOnly()
|
const { nodesReadOnly: readOnly } = useNodesReadOnly()
|
||||||
|
|
||||||
const appId = useAppStore.getState().appDetail?.id
|
const appId = useStore(s => s.appId)
|
||||||
|
|
||||||
const [allLanguageDefault, setAllLanguageDefault] = useState<Record<CodeLanguage, CodeNodeType> | null>(null)
|
const [allLanguageDefault, setAllLanguageDefault] = useState<Record<CodeLanguage, CodeNodeType> | null>(null)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -34,7 +33,7 @@ const useConfig = (id: string, payload: CodeNodeType) => {
|
|||||||
}
|
}
|
||||||
}, [appId])
|
}, [appId])
|
||||||
|
|
||||||
const defaultConfig = useStore(s => s.nodesDefaultConfigs)[payload.type]
|
const defaultConfig = useStore(s => s.nodesDefaultConfigs)?.[payload.type]
|
||||||
const { inputs, setInputs } = useNodeCrud<CodeNodeType>(id, payload)
|
const { inputs, setInputs } = useNodeCrud<CodeNodeType>(id, payload)
|
||||||
const { handleVarListChange, handleAddVariable } = useVarList<CodeNodeType>({
|
const { handleVarListChange, handleAddVariable } = useVarList<CodeNodeType>({
|
||||||
inputs,
|
inputs,
|
||||||
|
|||||||
@ -159,8 +159,9 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
|
|||||||
}
|
}
|
||||||
<OutputVars>
|
<OutputVars>
|
||||||
{
|
{
|
||||||
COMMON_OUTPUT.map(item => (
|
COMMON_OUTPUT.map((item, index) => (
|
||||||
<VarItem
|
<VarItem
|
||||||
|
key={index}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
type={item.type}
|
type={item.type}
|
||||||
description={item.description}
|
description={item.description}
|
||||||
@ -168,8 +169,9 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
isLocalFile && LOCAL_FILE_OUTPUT.map(item => (
|
isLocalFile && LOCAL_FILE_OUTPUT.map((item, index) => (
|
||||||
<VarItem
|
<VarItem
|
||||||
|
key={index}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
type={item.type}
|
type={item.type}
|
||||||
description={item.description}
|
description={item.description}
|
||||||
@ -182,8 +184,9 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
isWebsiteCrawl && WEBSITE_CRAWL_OUTPUT.map(item => (
|
isWebsiteCrawl && WEBSITE_CRAWL_OUTPUT.map((item, index) => (
|
||||||
<VarItem
|
<VarItem
|
||||||
|
key={index}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
type={item.type}
|
type={item.type}
|
||||||
description={item.description}
|
description={item.description}
|
||||||
@ -191,8 +194,9 @@ const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
isOnlineDocument && ONLINE_DOCUMENT_OUTPUT.map(item => (
|
isOnlineDocument && ONLINE_DOCUMENT_OUTPUT.map((item, index) => (
|
||||||
<VarItem
|
<VarItem
|
||||||
|
key={index}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
type={item.type}
|
type={item.type}
|
||||||
description={item.description}
|
description={item.description}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import {
|
|||||||
PortalToFollowElemContent,
|
PortalToFollowElemContent,
|
||||||
PortalToFollowElemTrigger,
|
PortalToFollowElemTrigger,
|
||||||
} from '@/app/components/base/portal-to-follow-elem'
|
} from '@/app/components/base/portal-to-follow-elem'
|
||||||
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
|
|
||||||
const ExportImage: FC = () => {
|
const ExportImage: FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@ -23,9 +24,10 @@ const ExportImage: FC = () => {
|
|||||||
|
|
||||||
const appDetail = useAppStore(s => s.appDetail)
|
const appDetail = useAppStore(s => s.appDetail)
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
const knowledgeName = useStore(s => s.knowledgeName)
|
||||||
|
|
||||||
const handleExportImage = useCallback(async (type: 'png' | 'jpeg' | 'svg') => {
|
const handleExportImage = useCallback(async (type: 'png' | 'jpeg' | 'svg') => {
|
||||||
if (!appDetail)
|
if (!appDetail && !knowledgeName)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (getNodesReadOnly())
|
if (getNodesReadOnly())
|
||||||
@ -60,7 +62,7 @@ const ExportImage: FC = () => {
|
|||||||
|
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = dataUrl
|
link.href = dataUrl
|
||||||
link.download = `${appDetail.name}.${type}`
|
link.download = `${appDetail ? appDetail.name : knowledgeName}.${type}`
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
document.body.removeChild(link)
|
document.body.removeChild(link)
|
||||||
@ -68,7 +70,7 @@ const ExportImage: FC = () => {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
console.error('Export image failed:', error)
|
console.error('Export image failed:', error)
|
||||||
}
|
}
|
||||||
}, [getNodesReadOnly, appDetail])
|
}, [getNodesReadOnly, appDetail, knowledgeName])
|
||||||
|
|
||||||
const handleTrigger = useCallback(() => {
|
const handleTrigger = useCallback(() => {
|
||||||
if (getNodesReadOnly())
|
if (getNodesReadOnly())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user