n8n
Version:
n8n Workflow Automation Tool
43 lines (42 loc) • 1.93 kB
TypeScript
import type { AgentFileDto } from '@n8n/api-types';
import { BinaryDataService } from 'n8n-core';
import { AgentFileRepository } from './repositories/agent-file.repository';
import { AgentRepository } from './repositories/agent.repository';
export interface KnowledgeWorkspaceFile {
id: string;
fileName: string;
mimeType: string;
fileSizeBytes: number;
relativePath: string;
}
interface MaterializeWorkspaceOptions {
fileReferences?: string[];
}
export declare class AgentKnowledgeService {
private readonly agentRepository;
private readonly agentFileRepository;
private readonly binaryDataService;
constructor(agentRepository: AgentRepository, agentFileRepository: AgentFileRepository, binaryDataService: BinaryDataService);
uploadFiles(agentId: string, projectId: string, files: Express.Multer.File[]): Promise<AgentFileDto[]>;
listFiles(agentId: string, projectId: string): Promise<AgentFileDto[]>;
listWorkspaceFiles(agentId: string, projectId: string): Promise<KnowledgeWorkspaceFile[]>;
deleteFile(agentId: string, projectId: string, fileId: string): Promise<void>;
deleteAllFilesForAgent(agentId: string): Promise<void>;
resolveWorkspaceFiles(agentId: string, projectId: string, fileReferences?: string[]): Promise<KnowledgeWorkspaceFile[]>;
materializeWorkspace(agentId: string, projectId: string, workspaceRoot: string, options?: MaterializeWorkspaceOptions): Promise<KnowledgeWorkspaceFile[]>;
private ensureAgentBelongsToProject;
private storeFile;
private toDto;
private toWorkspaceFile;
private assertWorkspaceWithinLimits;
private filterFilesForWorkspace;
private getWorkspaceRelativePath;
private prepareStoredContent;
private isPdf;
private extractPdfText;
private validateMetadataLength;
private cleanupStoredFiles;
private cleanupUploadTempFiles;
private cleanupUploadTempFile;
}
export {};