-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Austin_Zhang
committed
Feb 11, 2025
1 parent
e39ceec
commit acd5eca
Showing
171 changed files
with
7,593 additions
and
193 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace LuminaBrain.Application.Service; | ||
|
||
public class Class1 | ||
{ | ||
} |
13 changes: 13 additions & 0 deletions
13
LuminaBrain.Application.Service/LuminaBrain.Application.Service.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\LuminaBrain.Application\LuminaBrain.Application.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
29 changes: 29 additions & 0 deletions
29
LuminaBrain.Application.Service/Notification/NotificationService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using FastWiki.Application.Contract.Notification; | ||
using FastWiki.Application.Contract.Notification.Dto; | ||
|
||
namespace LuminaBrain.Application.Service.Notification; | ||
|
||
public class NotificationService(ICaptcha captcha) : INotificationService, IScopeDependency | ||
Check failure on line 6 in LuminaBrain.Application.Service/Notification/NotificationService.cs
|
||
{ | ||
public Task<VerificationDto> GetLoginVerificationCodeAsync() | ||
{ | ||
var uuid = "login:" + Guid.NewGuid().ToString("N"); | ||
|
||
var code = captcha.Generate(uuid, 240); | ||
|
||
return Task.FromResult(new VerificationDto | ||
{ | ||
Key = uuid, | ||
Code = "data:image/png;base64," + code.Base64 | ||
}); | ||
} | ||
|
||
public Task<string> GetRegisterVerificationCodeAsync(string account) | ||
{ | ||
var uuid = "register:" + account; | ||
|
||
var code = captcha.Generate(uuid, 240); | ||
|
||
return Task.FromResult(code.Base64); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
LuminaBrain.Application.Service/OpenAI/ChatCompleteService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using FastWiki.Application.Contract.OpenAI; | ||
using FastWiki.Application.Contract.OpenAI.Dto; | ||
using LuminaBrain.Core.Exceptions; | ||
|
||
namespace LuminaBrain.Application.Service.OpenAI; | ||
|
||
public class ChatCompleteService( | ||
IHttpContextAccessor httpContextAccessor, | ||
IAgentService agentService) : IChatCompleteService | ||
{ | ||
public async Task ChatCompleteAsync(ChatCompleteInput input) | ||
{ | ||
var httpContext = httpContextAccessor.HttpContext; | ||
var agent = await agentService.GetAsync(input.AgentId); | ||
|
||
if (agent == null) | ||
{ | ||
throw new BusinessException("未找到对应的Agent"); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using FastWiki.Application.Contract.Powers; | ||
using FastWiki.Application.Contract.Powers.Dto; | ||
using FastWiki.Application.Contract.Powers.Input; | ||
using LuminaBrain.Core.Exceptions; | ||
|
||
namespace LuminaBrain.Application.Service.Powers; | ||
|
||
public class PowersService(IRoleRepository roleRepository, IMapper mapper) : IPowersService, IScopeDependency | ||
{ | ||
public async Task CreateRoleAsync(RoleInput input) | ||
{ | ||
var role = new Role(input.Name, input.Description, input.Code); | ||
|
||
await roleRepository.CreateAsync(role); | ||
} | ||
|
||
public async Task UpdateRoleAsync(string id, RoleInput input) | ||
{ | ||
var role = await roleRepository.SingleOrDefaultAsync(r => r.Id == id.ToString()); | ||
if (role == null) | ||
{ | ||
throw new UserFriendlyException("角色不存在"); | ||
} | ||
|
||
role.SetName(input.Name); | ||
role.SetDescription(input.Description); | ||
role.SetCode(input.Code); | ||
|
||
await roleRepository.UpdateAsync(role); | ||
} | ||
|
||
public async Task DeleteRoleAsync(string id) | ||
{ | ||
var role = await roleRepository.SingleOrDefaultAsync(r => r.Id == id.ToString()); | ||
if (role == null) | ||
{ | ||
throw new UserFriendlyException("角色不存在"); | ||
} | ||
|
||
await roleRepository.DeleteAsync(role); | ||
} | ||
|
||
public async Task<List<RoleDto>> GetRolesAsync() | ||
{ | ||
var roles = await roleRepository.ListAsync(); | ||
|
||
var result = mapper.Map<List<RoleDto>>(roles); | ||
|
||
return result; | ||
} | ||
|
||
public async Task BindUserRoleAsync(string userId, List<string> roleIds) | ||
{ | ||
await roleRepository.DeleteUserRolesAsync(userId); | ||
|
||
await roleRepository.BindUserRoleAsync(userId, roleIds); | ||
} | ||
|
||
public async Task<List<RoleDto>> GetUserRolesAsync(string userId) | ||
{ | ||
var roles = roleRepository.GetRolesAsync(userId); | ||
|
||
var result = mapper.Map<List<RoleDto>>(await roles); | ||
|
||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using FastWiki.Core; | ||
using FastWiki.Domain.Users.Aggregates; | ||
using MapsterMapper; | ||
|
||
namespace FastWiki.Application.Users; | ||
|
||
public class UserService(IUserRepository userRepository, IMapper mapper, IUserContext userContext) | ||
Check failure on line 7 in LuminaBrain.Application.Service/Users/UserService.cs
|
||
: IUserService, IScopeDependency | ||
Check failure on line 8 in LuminaBrain.Application.Service/Users/UserService.cs
|
||
{ | ||
public async Task<string> CreateAsync(CreateUserInput input) | ||
{ | ||
var user = mapper.Map<User>(input); | ||
|
||
user.SetPassword(input.Password); | ||
user.SetEmail(input.Email); | ||
|
||
user = await userRepository.CreateAsync(user); | ||
|
||
return user.Id; | ||
} | ||
|
||
public async Task UpdateAsync(string id, UpdateUserInput input) | ||
{ | ||
var user = await userRepository.GetAsync(id); | ||
if (user == null) | ||
{ | ||
throw new UserFriendlyException("用户不存在"); | ||
} | ||
|
||
user.SetEmail(input.Email); | ||
user.SetName(input.Name); | ||
user.SetIntroduction(input.Introduction); | ||
|
||
await userRepository.UpdateAsync(user); | ||
} | ||
|
||
public async Task DeleteAsync(string id) | ||
{ | ||
var user = await userRepository.GetAsync(id); | ||
if (user == null) | ||
{ | ||
throw new UserFriendlyException("用户不存在"); | ||
} | ||
|
||
await userRepository.DeleteAsync(user); | ||
} | ||
|
||
public async Task<PagedResultDto<UserDto>> GetListAsync(string? keyword, int page, int pageSize) | ||
{ | ||
var users = await userRepository.GetListAsync(keyword, page, pageSize); | ||
|
||
var count = await userRepository.GetCountAsync(keyword); | ||
|
||
return new PagedResultDto<UserDto>(count, users.Select(mapper.Map<UserDto>).ToList()); | ||
} | ||
|
||
public async Task<UserDto> GetCurrentAsync() | ||
{ | ||
var user = await userRepository.GetAsync(userContext.UserId); | ||
|
||
return mapper.Map<UserDto>(user); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...Brain.Application.Service/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// <autogenerated /> | ||
using System; | ||
using System.Reflection; | ||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")] |
22 changes: 22 additions & 0 deletions
22
...rain.Application.Service/obj/Debug/net9.0/LuminaBrain.Application.Service.AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Reflection; | ||
|
||
[assembly: System.Reflection.AssemblyCompanyAttribute("LuminaBrain.Application.Service")] | ||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e39ceec3274b766a6dd15f8d21c9e05584d3714e")] | ||
[assembly: System.Reflection.AssemblyProductAttribute("LuminaBrain.Application.Service")] | ||
[assembly: System.Reflection.AssemblyTitleAttribute("LuminaBrain.Application.Service")] | ||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||
|
||
// Generated by the MSBuild WriteCodeFragment class. | ||
|
1 change: 1 addition & 0 deletions
1
...ication.Service/obj/Debug/net9.0/LuminaBrain.Application.Service.AssemblyInfoInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
84a1ab6da88c2b4853e508baffef0e31d26998fb86c644bd8c936648eb3b0989 |
15 changes: 15 additions & 0 deletions
15
...bj/Debug/net9.0/LuminaBrain.Application.Service.GeneratedMSBuildEditorConfig.editorconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
is_global = true | ||
build_property.TargetFramework = net9.0 | ||
build_property.TargetPlatformMinVersion = | ||
build_property.UsingMicrosoftNETSdkWeb = | ||
build_property.ProjectTypeGuids = | ||
build_property.InvariantGlobalization = | ||
build_property.PlatformNeutralAssembly = | ||
build_property.EnforceExtendedAnalyzerRules = | ||
build_property._SupportedPlatformList = Linux,macOS,Windows | ||
build_property.RootNamespace = LuminaBrain.Application.Service | ||
build_property.ProjectDir = F:\code\Austin\luminabrain\LuminaBrain.Application.Service\ | ||
build_property.EnableComHosting = | ||
build_property.EnableGeneratedComInterfaceComImportInterop = | ||
build_property.EffectiveAnalysisLevelStyle = 9.0 | ||
build_property.EnableCodeStyleSeverity = |
8 changes: 8 additions & 0 deletions
8
...in.Application.Service/obj/Debug/net9.0/LuminaBrain.Application.Service.GlobalUsings.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// <auto-generated/> | ||
global using global::System; | ||
global using global::System.Collections.Generic; | ||
global using global::System.IO; | ||
global using global::System.Linq; | ||
global using global::System.Net.Http; | ||
global using global::System.Threading; | ||
global using global::System.Threading.Tasks; |
Binary file added
BIN
+357 Bytes
...naBrain.Application.Service/obj/Debug/net9.0/LuminaBrain.Application.Service.assets.cache
Binary file not shown.
Oops, something went wrong.