diff --git a/Controllers/XAiServiceControllerBase.cs b/Controllers/XAiServiceControllerBase.cs
index 2acd9e9..9e59c0c 100644
--- a/Controllers/XAiServiceControllerBase.cs
+++ b/Controllers/XAiServiceControllerBase.cs
@@ -1022,6 +1022,66 @@ namespace xAiApi.Controllers
return result;
}
}
+
+ ///
+ /// Create an AI Conversation ...
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Authorize(Policy = XPolicies.EnabledUser)]
+ [HttpPost("Projects/Conversations")]
+ public async Task> CreateProjectConversation(
+ [FromQuery] Guid? projectId,
+ [FromBody] XAiConversationDto item,
+ CancellationToken cancellationToken = default
+ )
+ {
+ //
+ try
+ {
+ //
+ // Validate ...
+ if (projectId.IsNull() ||
+ !projectId.HasValue ||
+ item.IsNullOrDefault() ||
+ projectId.Value.IsDefaultGuid())
+ {
+ XException.InvalidArgs.Throw();
+ }
+
+ //
+ var userInfo = await GetUserInfo();
+ var connectionId = GetConnectionId();
+
+ //
+ // Update Required Params ...
+ item.OwnerId = userInfo.UserId;
+ if (!item.IsValidForAddOrUpdate())
+ {
+ XException.InvalidData.Throw();
+ }
+
+ //
+ var result = await aiService.CreateConversation(
+ item: item,
+ projectId: projectId,
+ ownerId: userInfo.UserId,
+ connectionId: connectionId,
+ cancellationToken: cancellationToken
+ );
+
+ //
+ return Ok(result);
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
#endregion
//
diff --git a/Interfaces/IXAiServiceBase.cs b/Interfaces/IXAiServiceBase.cs
index 6b54fad..6c446b0 100644
--- a/Interfaces/IXAiServiceBase.cs
+++ b/Interfaces/IXAiServiceBase.cs
@@ -307,7 +307,7 @@ namespace xAiApi.Interfaces
///
Task CreateConversation(
string ownerId,
- Guid projectId,
+ Guid? projectId,
XAiConversationDto item,
string connectionId = null,
CancellationToken cancellationToken = default
diff --git a/Providers/XAIServiceBase.cs b/Providers/XAIServiceBase.cs
index cd5d1ab..5decac2 100644
--- a/Providers/XAIServiceBase.cs
+++ b/Providers/XAIServiceBase.cs
@@ -1072,7 +1072,7 @@ namespace xAiApi.Providers
///
public virtual async Task CreateConversation(
string ownerId,
- Guid projectId,
+ Guid? projectId,
XAiConversationDto item,
string connectionId = null,
CancellationToken cancellationToken = default