Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix file selection in new filetree
Tomas Valenta4b170edada61
diff --git a/components/AgentLogFilesList.tsx b/components/AgentLogFilesList.tsxindex e7233ae76..5e4de725c 100644--- a/components/AgentLogFilesList.tsx+++ b/components/AgentLogFilesList.tsx@@ -198,6 +198,7 @@ function AgentLogFilesList({<div className="flex flex-col space-y-3 border-l border-gray-800 pl-2 ml-[10px]"><UploadTreelogUpload={logUpload}+ onFileSelect={setSelectedLogFile}/></div>)}diff --git a/components/Uploadtree/index.tsx b/components/Uploadtree/index.tsxindex aee463975..00e0a8de7 100644--- a/components/Uploadtree/index.tsx+++ b/components/Uploadtree/index.tsx@@ -2,17 +2,20 @@ import { useCallback } from 'react'import path from 'path-browserify'import Filesystem, { FileInfo } from 'components/Filesystem'-import { LiteLogUpload } from 'utils/agentLogs'+import { AgentNextActionLog, AgentPromptLogs, LiteLogUpload } from 'utils/agentLogs'import { FiletreeProvider } from 'hooks/useFiletree'+import { NodeType } from 'filesystem'+import { log_files } from 'db/prisma'export interface Props {logUpload: LiteLogUpload+ onFileSelect: (file: Omit<log_files, 'project_id' | 'type' | 'size' | 'log_upload_id' | 'content' | 'last_modified'> & { content: AgentPromptLogs | AgentNextActionLog }) => void}function UploadTree({logUpload,+ onFileSelect,}: Props) {-const fetchLogDirContent = useCallback<(dirpath: string) => FileInfo[]>(dirpath => {const currentDir = dirpath.slice(1)const childFiles = logUpload@@ -21,8 +24,6 @@ function UploadTree({return path.dirname(f.relativePath) === currentDir})- console.log('childFiles', childFiles)-const filesInChildDirs = logUpload.log_files.filter(f => {@@ -53,8 +54,6 @@ function UploadTree({isDir: true,})),]-- console.log('content', content)return content}, [logUpload])@@ -62,6 +61,16 @@ function UploadTree({<div className="flex flex-col items-start justify-start"><FiletreeProvider><Filesystem+ onFiletreeClick={(path, type) => {+ console.log('select file', path, type)+ const pathWithoutLeadingSlash = path.slice(1)+ if (type === NodeType.File) {+ const file = logUpload.log_files.find(f => f.relativePath === pathWithoutLeadingSlash)+ if (file) {+ onFileSelect(file)+ }+ }+ }}rootPath='/'fetchContent={fetchLogDirContent}/>