refactor(rag): 更新AI模型和RAG端点的权限控制
- 移除FastEndpoints命名空间引用 - 移除Microsoft.Extensions.AI命名空间引用 - 将AI模型端点的AllowAnonymous替换为ai-model:read权限 - 将AI模型创建、更新、删除端点的AllowAnonymous替换为ai-model:write权限 - 将RAG流查询端点的AllowAnonymous替换为rag:query权限 - 统一端点安全性配置以符合权限管理要求
This commit is contained in:
parent
fb40c47d5b
commit
6b106062b6
@ -1,4 +1,3 @@
|
||||
using FastEndpoints;
|
||||
using MediatR;
|
||||
using BuildFlow.Application.AiModel.Commands;
|
||||
using BuildFlow.Application.AiModel.DTOs;
|
||||
@ -12,7 +11,7 @@ public class GetAiModelsEndpoint(IMediator mediator) : EndpointWithoutRequest<Li
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/ai/models");
|
||||
AllowAnonymous();
|
||||
Permissions("ai-model:read");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
@ -30,7 +29,7 @@ public class CreateAiModelEndpoint(IMediator mediator) : Endpoint<CreateAiModelR
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/ai/models");
|
||||
AllowAnonymous();
|
||||
Permissions("ai-model:write");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CreateAiModelRequest req, CancellationToken ct)
|
||||
@ -48,7 +47,7 @@ public class UpdateAiModelEndpoint(IMediator mediator) : Endpoint<UpdateAiModelR
|
||||
public override void Configure()
|
||||
{
|
||||
Put("/ai/models/{Id}");
|
||||
AllowAnonymous();
|
||||
Permissions("ai-model:write");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(UpdateAiModelRequest req, CancellationToken ct)
|
||||
@ -67,7 +66,7 @@ public class DeleteAiModelEndpoint(IMediator mediator) : EndpointWithoutRequest<
|
||||
public override void Configure()
|
||||
{
|
||||
Delete("/ai/models/{Id}");
|
||||
AllowAnonymous();
|
||||
Permissions("ai-model:write");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
@ -84,7 +83,7 @@ public class SetDefaultAiModelEndpoint(IMediator mediator) : EndpointWithoutRequ
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/ai/models/{Id}/default");
|
||||
AllowAnonymous();
|
||||
Permissions("ai-model:write");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken ct)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.AI;
|
||||
using BuildFlow.Application.RagQA.DTOs;
|
||||
using BuildFlow.Domain.Interfaces;
|
||||
using BuildFlow.Infrastructure.Persistence;
|
||||
@ -24,7 +23,7 @@ public class RAGStreamEndpoint(
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/rag/stream");
|
||||
AllowAnonymous();
|
||||
Permissions("rag:query");
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(RAGQueryRequest req, CancellationToken ct)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user