fix Create Conversation to Handle Default Project Id ...
This commit is contained in:
@@ -237,7 +237,7 @@ namespace xAiModels.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<XAiConversationDto> CreateConversation(
|
||||
string ownerId,
|
||||
Guid projectId,
|
||||
Guid? projectId,
|
||||
XAiConversationDto item = null,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
|
||||
@@ -778,7 +778,7 @@ namespace xAiModels.Providers
|
||||
/// <returns></returns>
|
||||
public async Task<XAiConversationDto> CreateConversation(
|
||||
string ownerId,
|
||||
Guid projectId,
|
||||
Guid? projectId,
|
||||
XAiConversationDto item = null,
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
@@ -786,16 +786,34 @@ namespace xAiModels.Providers
|
||||
{
|
||||
//
|
||||
// Validate Args ...
|
||||
if (projectId.IsNull() ||
|
||||
projectId.IsDefaultGuid())
|
||||
if (ownerId.IsNullOrEmpty())
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
if (!projectId.HasValue ||
|
||||
projectId.Value.IsDefaultGuid())
|
||||
{
|
||||
//
|
||||
var defaultProject = await GetDefaultProject(
|
||||
ownerId: ownerId,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (defaultProject.IsNullOrDefault())
|
||||
{
|
||||
XException.ActionFailed.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
projectId = defaultProject.Id;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Proejct ...
|
||||
XAiProjectDto project = await projectRepositoryService.GetAsync(
|
||||
id: projectId,
|
||||
id: projectId.Value,
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: true,
|
||||
// fillConversations: false,
|
||||
|
||||
Reference in New Issue
Block a user