Start Add File Support in Messages Feature ...

This commit is contained in:
2026-09-30 23:13:32 +03:30
parent efaf71d962
commit aac3eb92c1
8 changed files with 314 additions and 163 deletions
+16 -4
View File
@@ -5,6 +5,7 @@ using System.Threading;
using xAiModels.Models;
using xAiModels.Models.Dtos;
using System.Threading.Tasks;
using xIdentityModels.Models;
using Microsoft.Extensions.AI;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
@@ -87,7 +88,7 @@ namespace xAiApi.Interfaces
#endregion
//
#region Data Provider Based Actions ...
#region Loaders ...
/// <summary>
/// Load AI Projects ...
/// </summary>
@@ -126,7 +127,10 @@ namespace xAiApi.Interfaces
Guid conversationId,
CancellationToken cancellationToken = default
);
#endregion
//
#region Queries ...
/// <summary>
/// Query Projects ...
/// </summary>
@@ -139,7 +143,7 @@ namespace xAiApi.Interfaces
XQuery query,
CancellationToken cancellationToken = default
);
/// <summary>
/// Query Conversations ...
/// </summary>
@@ -154,7 +158,7 @@ namespace xAiApi.Interfaces
XQuery query,
CancellationToken cancellationToken = default
);
/// <summary>
/// Query Messages ...
/// </summary>
@@ -169,7 +173,10 @@ namespace xAiApi.Interfaces
XQuery query,
CancellationToken cancellationToken = default
);
#endregion
//
#region Creators ...
/// <summary>
/// Create an AI Project ...
/// </summary>
@@ -201,7 +208,10 @@ namespace xAiApi.Interfaces
string connectionId = null,
CancellationToken cancellationToken = default
);
#endregion
//
#region Data Actions ...
/// <summary>
/// Ask a Question as Prompt and Retrieve Response ...
/// </summary>
@@ -211,6 +221,7 @@ namespace xAiApi.Interfaces
/// <param name="conversationId"></param>
/// <param name="connectionId"></param>
/// <param name="files"></param>
/// <param name="userInfo"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<XAiMessageDto> AskAsync(
@@ -220,6 +231,7 @@ namespace xAiApi.Interfaces
Guid conversationId,
string connectionId = null,
IFormFileCollection files = null,
XUserClaimsInfoDto userInfo = null,
CancellationToken cancellationToken = default
);
+15
View File
@@ -6,6 +6,7 @@ using xAiModels.Models.Dtos;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
namespace xAiApi.Interfaces
{
@@ -176,6 +177,20 @@ namespace xAiApi.Interfaces
[FromBody] XAiResponseRequest request,
CancellationToken cancellationToken = default
);
/// <summary>
/// Ask Question with Files and Get Response ...
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("AskWithFiles")]
[Consumes("multipart/form-data")]
Task<ActionResult<string>> AskWithFiles(
[FromForm] XAiResponseRequest request,
[FromForm] IFormFileCollection files,
CancellationToken cancellationToken = default
);
#endregion
}
}