Class FilesController
- Namespace
- FoundationaLLM.Core.API.Controllers
- Assembly
- FoundationaLLM.Core.API.dll
Provides methods for retrieving and managing files.
[Authorize(AuthenticationSchemes = "Bearer", Policy = "MicrosoftEntraIDStandard")]
[Authorize(AuthenticationSchemes = "AgentAccessToken", Policy = "FoundationaLLMAgentAccessToken")]
[ApiController]
[Route("instances/{instanceId}/[controller]")]
public class FilesController : ControllerBase
- Inheritance
-
FilesController
- Inherited Members
- Extension Methods
Constructors
FilesController(IOrchestrationContext, IOptions<InstanceSettings>, ICoreService, ILogger<FilesController>)
The controller for managing files.
public FilesController(IOrchestrationContext callContext, IOptions<InstanceSettings> instanceOptions, ICoreService coreService, ILogger<FilesController> logger)
Parameters
callContext
IOrchestrationContextThe IOrchestrationContext call context of the request being handled.
instanceOptions
IOptions<InstanceSettings>The options providing the InstanceSettings with instance settings.
coreService
ICoreServiceThe ICoreService core service.
logger
ILogger<FilesController>
Exceptions
Methods
Delete(string, List<string>)
Deletes the specified file(s).
[HttpPost("delete")]
public Task<IActionResult> Delete(string instanceId, List<string> resourcePaths)
Parameters
instanceId
stringThe instance ID.
resourcePaths
List<string>The list of object identifiers to be deleted.
Returns
Download(string, string, string)
Downloads a file.
[HttpGet("{fileProvider}/{fileId}")]
public Task<IActionResult> Download(string instanceId, string fileProvider, string fileId)
Parameters
instanceId
stringThe instance ID.
fileProvider
stringThe name of the file provider.
fileId
stringThe identifier of the file.
Returns
- Task<IActionResult>
The file content.
Remarks
The following file providers are supported:
- FoundationaLLM.Attachments
- FoundationaLLM.AzureOpenAI
Upload(string, string, string, IFormFile)
Uploads an attachment.
[HttpPost("upload")]
public Task<IActionResult> Upload(string instanceId, string sessionId, string agentName, IFormFile file)
Parameters
instanceId
stringThe instance ID.
sessionId
stringThe session ID from which the file is uploaded.
agentName
stringThe agent name.
file
IFormFileThe file sent with the HTTP request.