Skip to content

Commit

Permalink
feat: BREAKING CHANGES: refactor project.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthuridea committed Dec 8, 2023
1 parent 252d819 commit fa0f18f
Show file tree
Hide file tree
Showing 78 changed files with 450 additions and 296 deletions.
24 changes: 24 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project>

<PropertyGroup>
<Version>0.0.0.1</Version>
<Authors>arthuridea</Authors>
<LangVersion>latest</LangVersion>
<Description>A dotnet Library for Baidu ernie-bot and ErnievilgV2</Description>
<Copyright>MIT</Copyright>
<PackageTags>A dotnet Library for Baidu ernie-bot and ErnievilgV2</PackageTags>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageProjectUrl>https://github.com/arthuridea/NetCore.BaiduAIGC</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/arthuridea/NetCore.BaiduAIGC.git</RepositoryUrl>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\LICENSE.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
File renamed without changes.
36 changes: 0 additions & 36 deletions LLMServiceHub.sln

This file was deleted.

20 changes: 0 additions & 20 deletions LLMServiceHub/Client/BaiduApiClient.cs

This file was deleted.

9 changes: 0 additions & 9 deletions LLMServiceHub/Client/IBaiduApiClient.cs

This file was deleted.

23 changes: 0 additions & 23 deletions LLMServiceHub/Common/HttpResponseExtensions.cs

This file was deleted.

17 changes: 0 additions & 17 deletions LLMServiceHub/Service/IBaiduErnieVilgApiService.cs

This file was deleted.

20 changes: 0 additions & 20 deletions LLMServiceHub/Service/IBaiduWenxinApiService.cs

This file was deleted.

65 changes: 0 additions & 65 deletions LLMServiceHub/Service/ServeSentEventHandler.cs

This file was deleted.

59 changes: 59 additions & 0 deletions NetCore.BaiduAIGC.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34202.233
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LLMServiceHub", "src\LLMServiceHub\LLMServiceHub.csproj", "{3CA26111-12C9-4AF1-966F-45019EA52385}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00.Global", "00.Global", "{3BBFC57A-DC8F-4F03-8370-FD6179AD317F}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01.Src", "01.Src", "{01705FE5-59E6-4B65-B545-5DFD3AFB1F16}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LLMService.Shared", "src\LLMService.Shared\LLMService.Shared.csproj", "{DC8A11BE-3268-4F1E-B83F-27958041ABF1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLMService.Baidu.Wenxinworkshop", "src\LLMService.Baidu.Wenxinworkshop\LLMService.Baidu.Wenxinworkshop.csproj", "{E73CB18F-26D3-4A6C-8AA2-E89FF17B65C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLMService.Baidu.ErnieVilg", "src\LLMService.Baidu.ErnieVilg\LLMService.Baidu.ErnieVilg.csproj", "{E3AE89E4-31A0-4EDA-9154-2D089E1FD8A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3CA26111-12C9-4AF1-966F-45019EA52385}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3CA26111-12C9-4AF1-966F-45019EA52385}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CA26111-12C9-4AF1-966F-45019EA52385}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CA26111-12C9-4AF1-966F-45019EA52385}.Release|Any CPU.Build.0 = Release|Any CPU
{DC8A11BE-3268-4F1E-B83F-27958041ABF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC8A11BE-3268-4F1E-B83F-27958041ABF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC8A11BE-3268-4F1E-B83F-27958041ABF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC8A11BE-3268-4F1E-B83F-27958041ABF1}.Release|Any CPU.Build.0 = Release|Any CPU
{E73CB18F-26D3-4A6C-8AA2-E89FF17B65C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E73CB18F-26D3-4A6C-8AA2-E89FF17B65C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E73CB18F-26D3-4A6C-8AA2-E89FF17B65C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E73CB18F-26D3-4A6C-8AA2-E89FF17B65C5}.Release|Any CPU.Build.0 = Release|Any CPU
{E3AE89E4-31A0-4EDA-9154-2D089E1FD8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3AE89E4-31A0-4EDA-9154-2D089E1FD8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3AE89E4-31A0-4EDA-9154-2D089E1FD8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3AE89E4-31A0-4EDA-9154-2D089E1FD8A4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3CA26111-12C9-4AF1-966F-45019EA52385} = {01705FE5-59E6-4B65-B545-5DFD3AFB1F16}
{DC8A11BE-3268-4F1E-B83F-27958041ABF1} = {01705FE5-59E6-4B65-B545-5DFD3AFB1F16}
{E73CB18F-26D3-4A6C-8AA2-E89FF17B65C5} = {01705FE5-59E6-4B65-B545-5DFD3AFB1F16}
{E3AE89E4-31A0-4EDA-9154-2D089E1FD8A4} = {01705FE5-59E6-4B65-B545-5DFD3AFB1F16}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4FD3BE39-36D7-4A01-8EEC-39063ED813B4}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
namespace LLMServiceHub.Service
using LLMService.Shared.ServiceInterfaces;
using Microsoft.Extensions.Logging;

namespace LLMService.Baidu.ErnieVilg
{
/// <summary>
///
/// </summary>
/// <seealso cref="LLMServiceHub.Service.IImageStorageProvider" />
/// <seealso cref="IImageStorageProvider" />
public class AliyunOSSImageStorageProvider : IImageStorageProvider
{
private readonly ILogger<AliyunOSSImageStorageProvider> _logger;
Expand All @@ -26,6 +29,7 @@ public AliyunOSSImageStorageProvider(ILogger<AliyunOSSImageStorageProvider> logg
public async Task<string> Save(string url, string pathname)
{
_logger.LogInformation($"[{nameof(AliyunOSSImageStorageProvider)}] save: {url} -> {pathname}");
// TODO: code goes here...
return await Task.FromResult(url);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using LLMServiceHub.Authentication;
using LLMServiceHub.Authentication.Extentions;
using LLMServiceHub.Models;
using LLMService.Shared;
using LLMService.Shared.Extensions;
using LLMService.Shared.Models;
using LLMService.Shared.ServiceInterfaces;
using Microsoft.Extensions.Logging;
using System.Net.Http.Json;
using System.Text.Json;

namespace LLMServiceHub.Service
namespace LLMService.Baidu.ErnieVilg
{
/// <summary>
/// 百度智能绘图api
/// </summary>
/// <seealso cref="LLMServiceHub.Service.IBaiduErnieVilgApiService" />
public class BaiduErnieVilgApiService : IBaiduErnieVilgApiService
public class BaiduErnieVilgApiService : IAIPaintApiService<PaintApplyRequest, PaintResultResponse>
{
const string _api_client_key = BaiduApiConsts.BaiduErnieVilgApiClientName;
const string _api_client_key = LLMServiceConsts.BaiduErnieVilgApiClientName;
/// <summary>
/// The HTTP client factory
/// </summary>
Expand Down Expand Up @@ -56,7 +58,7 @@ private HttpClient GetClient()
/// </summary>
/// <param name="request">The request.</param>
/// <returns></returns>
public async Task<PaintResultResponse> Text2ImgV2(PaintApplyRequest request)
public async Task<PaintResultResponse> Text2Image(PaintApplyRequest request)
{
if (string.IsNullOrEmpty(request.ConversationId))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using LLMService.Baidu.ErnieVilg;
using LLMService.Shared;
using LLMService.Shared.Authentication.Handlers;
using LLMService.Shared.Authentication.Models;
using LLMService.Shared.Models;
using LLMService.Shared.ServiceInterfaces;
using Microsoft.Extensions.Configuration;

// ***************************************************************************************
// DO NOT CHANGE THE NAMESPACE! It is .Net Core convention for configuration extensions. *
// ***************************************************************************************
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
///
/// </summary>
public static class ErnieVilgDependencyInjection
{
/// <summary>
/// Adds the wenxinworkshop.
/// </summary>
/// <param name="services">The services.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="ernieVilgConfigKey"></param>
/// <returns></returns>
public static IServiceCollection AddErnieVilg(this IServiceCollection services, IConfiguration configuration, string ernieVilgConfigKey = "BaiduErnieVilgSettings")
{
// 百度配置文件
var ernieVilgSettings = configuration.GetSection(ernieVilgConfigKey).Get<ClientCredentials>();

// 智能绘画客户端
services.AddHttpClient(LLMServiceConsts.BaiduErnieVilgApiClientName, client =>
{
client.BaseAddress = new Uri($"{LLMServiceConsts.BaiduErnieVilgApiAuthority}/");
})
.AddBaiduApiAuthentication<BaiduApiAuthenticationHandler>(
ernieVilgSettings,
LLMServiceConsts.BaiduErnieVilgApiAuthority);

services.AddTransient<IAIPaintApiService<PaintApplyRequest, PaintResultResponse>, BaiduErnieVilgApiService>();

return services;
}
}
}
Loading

0 comments on commit fa0f18f

Please sign in to comment.