mirror of
https://github.com/langgenius/dify.git
synced 2026-02-22 19:15:47 +08:00
Merge branch 'feat/support-agent-sandbox' of github.com:langgenius/dify into feat/support-agent-sandbox
This commit is contained in:
@ -4,7 +4,6 @@ import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useSandboxFileDownloadUrl } from '@/service/use-sandbox-file'
|
||||
import { getArtifactPath } from './constants'
|
||||
import { getFileExtension } from './utils/file-utils'
|
||||
@ -13,14 +12,13 @@ import ReadOnlyFilePreview from './viewer/read-only-file-preview'
|
||||
const ArtifactContentPanel = () => {
|
||||
const { t } = useTranslation('workflow')
|
||||
const activeTabId = useStore(s => s.activeTabId)
|
||||
const { userProfile } = useAppContext()
|
||||
const sandboxId = userProfile?.id
|
||||
const appId = useStore(s => s.appId)
|
||||
|
||||
const path = activeTabId ? getArtifactPath(activeTabId) : undefined
|
||||
const fileName = path?.split('/').pop() ?? ''
|
||||
const extension = getFileExtension(fileName)
|
||||
|
||||
const { data: ticket, isLoading } = useSandboxFileDownloadUrl(sandboxId, path)
|
||||
const { data: ticket, isLoading } = useSandboxFileDownloadUrl(appId, path)
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
|
||||
@ -7,7 +7,6 @@ import { useCallback, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import FolderSpark from '@/app/components/base/icons/src/vender/workflow/FolderSpark'
|
||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useDownloadSandboxFile, useSandboxFilesTree } from '@/service/use-sandbox-file'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { downloadUrl } from '@/utils/download'
|
||||
@ -19,14 +18,13 @@ type ArtifactsSectionProps = {
|
||||
|
||||
const ArtifactsSection = ({ className }: ArtifactsSectionProps) => {
|
||||
const { t } = useTranslation('workflow')
|
||||
const { userProfile } = useAppContext()
|
||||
const sandboxId = userProfile?.id
|
||||
const appId = useStore(s => s.appId)
|
||||
|
||||
const [isExpanded, setIsExpanded] = useState(false)
|
||||
|
||||
const { data: treeData, hasFiles, isLoading } = useSandboxFilesTree(sandboxId)
|
||||
const { data: treeData, hasFiles, isLoading } = useSandboxFilesTree(appId)
|
||||
|
||||
const { mutateAsync: fetchDownloadUrl, isPending: isDownloading } = useDownloadSandboxFile(sandboxId)
|
||||
const { mutateAsync: fetchDownloadUrl, isPending: isDownloading } = useDownloadSandboxFile(appId)
|
||||
const storeApi = useWorkflowStore()
|
||||
const selectedArtifactPath = useStore(s => s.selectedArtifactPath)
|
||||
|
||||
|
||||
@ -12,11 +12,11 @@ import { FileDownload01 } from '@/app/components/base/icons/src/vender/line/file
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import ArtifactsTree from '@/app/components/workflow/skill/file-tree/artifacts-tree'
|
||||
import ReadOnlyFilePreview from '@/app/components/workflow/skill/viewer/read-only-file-preview'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useDownloadSandboxFile, useSandboxFileDownloadUrl, useSandboxFilesTree } from '@/service/use-sandbox-file'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { downloadUrl } from '@/utils/download'
|
||||
import { useStore } from '../store'
|
||||
import InspectLayout from './inspect-layout'
|
||||
import SplitPanel from './split-panel'
|
||||
|
||||
@ -55,16 +55,15 @@ const formatFileSize = (bytes: number | null): string => {
|
||||
|
||||
const ArtifactsTab = (headerProps: InspectHeaderProps) => {
|
||||
const { t } = useTranslation('workflow')
|
||||
const { userProfile } = useAppContext()
|
||||
const sandboxId = userProfile?.id
|
||||
const appId = useStore(s => s.appId)
|
||||
|
||||
const { data: treeData, hasFiles, isLoading } = useSandboxFilesTree(sandboxId, {
|
||||
enabled: !!sandboxId,
|
||||
const { data: treeData, hasFiles, isLoading } = useSandboxFilesTree(appId, {
|
||||
enabled: !!appId,
|
||||
})
|
||||
const { mutateAsync: fetchDownloadUrl, isPending: isDownloading } = useDownloadSandboxFile(sandboxId)
|
||||
const { mutateAsync: fetchDownloadUrl, isPending: isDownloading } = useDownloadSandboxFile(appId)
|
||||
const [selectedFile, setSelectedFile] = useState<SandboxFileTreeNode | null>(null)
|
||||
const { data: downloadUrlData, isLoading: isDownloadUrlLoading } = useSandboxFileDownloadUrl(
|
||||
sandboxId,
|
||||
appId,
|
||||
selectedFile?.path,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user