Skip to content

Commit 11db3aa

Browse files
committed
Update FastService.Analyzers package version, refactor FastApi service registration, and add tags to PromptService and PromptTemplateService
1 parent a771d6b commit 11db3aa

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/Console.Service/Console.Service.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="FastService.Analyzers" Version="0.2.0" />
12+
<PackageReference Include="FastService.Analyzers" Version="0.2.2" />
1313
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.5" />
1414
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5">
1515
<PrivateAssets>all</PrivateAssets>

src/Console.Service/Program.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
builder.Services.AddSerilog(logger);
1818
builder.Services.AddOpenApi();
19-
builder.Services.WithFast();
19+
builder.Services.AddFastApis();
2020
builder.Services.AddResponseCompression();
2121

2222
if (builder.Configuration.GetConnectionString("Type").Equals("postgresql", StringComparison.OrdinalIgnoreCase))
@@ -63,6 +63,10 @@ await context.Response.SendFileAsync(
6363
app.UseResponseCompression();
6464
app.UseStaticFiles();
6565

66-
app.MapFast();
66+
app.MapFastApis(options =>
67+
{
68+
options.Prefix = "/api";
69+
options.Version = "v1";
70+
});
6771

6872
await app.RunAsync();

src/Console.Service/Services/PromptService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
namespace Console.Service.Services;
1313

1414
[FastService.Route("/v1/prompt")]
15-
public class PromptService(IConfiguration configuration, IDbContext dbContext) : FastApi
15+
[Tags("提示词生成")]
16+
public class PromptService(IDbContext dbContext) : FastApi
1617
{
1718
[EndpointSummary("优化提示词")]
1819
[HttpPost("generate")]

src/Console.Service/Services/PromptTemplateService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Console.Service.Services;
1010

1111
[FastService.Route("/v1/prompt-templates")]
12+
[Tags("提示词模板管理")]
1213
public class PromptTemplateService(IDbContext dbContext, JwtService jwtService) : FastApi
1314
{
1415
private (bool IsValid, string? UserId, object? ErrorResponse) ValidateTokenAndGetUserId(HttpContext context)

0 commit comments

Comments
 (0)