n8n
Version:
n8n Workflow Automation Tool
47 lines (46 loc) • 1.67 kB
TypeScript
import { Logger } from '@n8n/backend-common';
import type { BuiltFileStore } from '@n8n/agents';
import { BinaryDataService } from 'n8n-core';
import type { Readable } from 'node:stream';
import { AgentChatAttachment } from './entities/agent-chat-attachment.entity';
import { AgentChatAttachmentRepository } from './repositories/agent-chat-attachment.repository';
export interface StoreInboundAttachmentParams {
agentId: string | null;
projectId: string;
threadId: string;
resourceId?: string;
source: string;
fileName: string;
mimeType: string;
data: Buffer;
}
export interface StoredAttachmentRef {
id: string;
fileName: string;
mimeType: string;
sizeBytes: number;
}
export declare class AgentChatAttachmentService {
private readonly logger;
private readonly binaryDataService;
private readonly repository;
constructor(logger: Logger, binaryDataService: BinaryDataService, repository: AgentChatAttachmentRepository);
storeInbound(params: StoreInboundAttachmentParams): Promise<AgentChatAttachment>;
getForAgent(attachmentId: string, scope: {
agentId: string;
projectId: string;
}): Promise<AgentChatAttachment | null>;
getStream(attachment: AgentChatAttachment): Promise<Readable>;
deleteByIds(attachmentIds: string[]): Promise<void>;
deleteByThread(threadId: string, scope: {
projectId: string;
} | {
agentId: string;
}): Promise<void>;
deleteByAgent(agentId: string): Promise<void>;
private deleteAttachments;
getFileStore(scope: {
agentId: string;
projectId: string;
}, provider: string): BuiltFileStore;
}