Move Knowledge Constants and Fix Inverted Ownership Filters
- Add XAiKnowledgeScope enum (Conversation=0, Project=1, Global=2, User=3) with StringValue prefixes; - Add Knowledge constants, scope prefixes, metadata keys and XAiErrorRoute to XAiModelsConstants; - Fix inverted ownerId condition in QueryProjects / QueryConversations / QueryMessages (ownership filter was skipped for real owners -> cross-user data exposure); - Fix inverted HasChild() validation in HasDefaultProject / HasDefaultConversation; - LoadConversations: ignore soft-deleted conversations; - CreateProject / CreateConversation: set isDefaultLanguageHandled = true; - GetDefaultConversation: use projectId instead of unloaded project.Id.
This commit is contained in:
@@ -237,7 +237,7 @@ namespace xAiModels.Providers
|
||||
// Retrieve Conversation's List ...
|
||||
var result = await conversationRepositoryService.FindManyAsync(
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: false,
|
||||
ignoreSoftDeleteds: true,
|
||||
cancellationToken: cancellationToken,
|
||||
predicate: x => x.ProjectId == projectId,
|
||||
orderBuilder: x => x.OrderBy(y => y.CreatedOn)
|
||||
@@ -490,7 +490,7 @@ namespace xAiModels.Providers
|
||||
{
|
||||
//
|
||||
trl.Language = defaultLanguage;
|
||||
isDefaultLanguageHandled = false;
|
||||
isDefaultLanguageHandled = true;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -534,7 +534,7 @@ namespace xAiModels.Providers
|
||||
{
|
||||
//
|
||||
trl.Language = defaultLanguage;
|
||||
isDefaultLanguageHandled = false;
|
||||
isDefaultLanguageHandled = true;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -742,7 +742,7 @@ namespace xAiModels.Providers
|
||||
{
|
||||
//
|
||||
trl.Language = defaultLanguage;
|
||||
isDefaultLanguageHandled = false;
|
||||
isDefaultLanguageHandled = true;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1039,7 +1039,7 @@ namespace xAiModels.Providers
|
||||
{
|
||||
//
|
||||
project = await projectRepositoryService.GetAsync(
|
||||
id: project.Id,
|
||||
id: projectId,
|
||||
includeBuilder: null,
|
||||
ignoreSoftDeleteds: true,
|
||||
cancellationToken: cancellationToken
|
||||
@@ -1128,7 +1128,7 @@ namespace xAiModels.Providers
|
||||
{
|
||||
//
|
||||
Expression<Func<XAiProject, bool>> predicate = null;
|
||||
if (ownerId.IsNullOrEmpty())
|
||||
if (!ownerId.IsNullOrEmpty())
|
||||
{
|
||||
predicate = x => x.OwnerId == ownerId;
|
||||
}
|
||||
@@ -1196,7 +1196,7 @@ namespace xAiModels.Providers
|
||||
//
|
||||
Expression<Func<XAiConversation, bool>> predicate = x =>
|
||||
x.ProjectId == projectId;
|
||||
if (ownerId.IsNullOrEmpty())
|
||||
if (!ownerId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
predicate = x =>
|
||||
@@ -1266,7 +1266,7 @@ namespace xAiModels.Providers
|
||||
//
|
||||
Expression<Func<XAiMessage, bool>> predicate = x =>
|
||||
x.ConversationId == conversationId;
|
||||
if (ownerId.IsNullOrEmpty())
|
||||
if (!ownerId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
predicate = x =>
|
||||
|
||||
Reference in New Issue
Block a user