From cc0fa3576d4ba4d94b5b2b827a38cff0803f9243 Mon Sep 17 00:00:00 2001 From: jackqqq123 <1175861874@qq.com> Date: Wed, 24 Sep 2025 15:38:50 +0800 Subject: [PATCH] =?UTF-8?q?feta:=20=E6=96=B0=E5=A2=9E=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93=E7=AE=A1=E7=90=86=EF=BC=9A=20-=20Core=E6=96=B0?= =?UTF-8?q?=E5=A2=9EGit=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=A3=E7=90=86=20-=20Knowledge=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=9F=A5=E8=AF=86=E5=BA=93=E6=9D=A5=E6=BA=90=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LubanHub.sln | 7 + src/LubanHub.App/App.axaml.cs | 21 + src/LubanHub.App/LubanHub.App.csproj | 6 + src/LubanHub.App/MainWindow.axaml | 132 +++--- src/LubanHub.App/MainWindow.axaml.cs | 13 + .../ViewModels/ConfigurationViewModel.cs | 245 +++++++++++ .../KnowledgeSourceItemViewModel.cs | 332 +++++++++++++++ .../KnowledgeSourceManagementViewModel.cs | 150 +++++++ .../Views/ConfigurationView.axaml | 116 +++++ .../Views/ConfigurationView.axaml.cs | 82 ++++ .../Views/KnowledgeSourceManagementView.axaml | 315 ++++++++++++++ .../KnowledgeSourceManagementView.axaml.cs | 36 ++ .../ConfigurationPropertyAttribute.cs | 131 ++++++ .../ConfigurationSectionAttribute.cs | 51 +++ .../Configurations/GitConfiguration.cs | 159 +++++++ .../ICoreConfigurationDiscoveryService.cs | 39 ++ .../Interfaces/ICoreGitService.cs | 60 +++ .../Interfaces/ICoreProcessService.cs | 14 + src/LubanHub.Core/Models/ConfigurationInfo.cs | 112 +++++ .../Models/GitOperationResult.cs | 139 ++++++ .../CoreConfigurationDiscoveryService.cs | 198 +++++++++ src/LubanHub.Core/Services/CoreGitService.cs | 398 ++++++++++++++++++ .../Services/CoreProcessService.cs | 180 ++++++++ .../Configurations/AIConfiguration.cs | 135 ++++++ .../Configurations/KnowledgeConfiguration.cs | 65 +++ .../Interfaces/IKnowledgeSourceService.cs | 44 ++ .../LubanHub.KnowledgeService.csproj | 18 + .../Models/KnowledgeSource.cs | 72 ++++ .../Models/KnowledgeUpdateResult.cs | 137 ++++++ .../ServiceCollectionExtensions.cs | 76 ++++ .../Services/KnowledgeSourceService.cs | 361 ++++++++++++++++ test_config.cs | 29 ++ 32 files changed, 3823 insertions(+), 50 deletions(-) create mode 100644 src/LubanHub.App/ViewModels/ConfigurationViewModel.cs create mode 100644 src/LubanHub.App/ViewModels/KnowledgeSourceItemViewModel.cs create mode 100644 src/LubanHub.App/ViewModels/KnowledgeSourceManagementViewModel.cs create mode 100644 src/LubanHub.App/Views/ConfigurationView.axaml create mode 100644 src/LubanHub.App/Views/ConfigurationView.axaml.cs create mode 100644 src/LubanHub.App/Views/KnowledgeSourceManagementView.axaml create mode 100644 src/LubanHub.App/Views/KnowledgeSourceManagementView.axaml.cs create mode 100644 src/LubanHub.Core/Attributes/ConfigurationPropertyAttribute.cs create mode 100644 src/LubanHub.Core/Attributes/ConfigurationSectionAttribute.cs create mode 100644 src/LubanHub.Core/Configurations/GitConfiguration.cs create mode 100644 src/LubanHub.Core/Interfaces/ICoreConfigurationDiscoveryService.cs create mode 100644 src/LubanHub.Core/Interfaces/ICoreGitService.cs create mode 100644 src/LubanHub.Core/Models/ConfigurationInfo.cs create mode 100644 src/LubanHub.Core/Models/GitOperationResult.cs create mode 100644 src/LubanHub.Core/Services/CoreConfigurationDiscoveryService.cs create mode 100644 src/LubanHub.Core/Services/CoreGitService.cs create mode 100644 src/LubanHub.KnowledgeService/Configurations/AIConfiguration.cs create mode 100644 src/LubanHub.KnowledgeService/Configurations/KnowledgeConfiguration.cs create mode 100644 src/LubanHub.KnowledgeService/Interfaces/IKnowledgeSourceService.cs create mode 100644 src/LubanHub.KnowledgeService/LubanHub.KnowledgeService.csproj create mode 100644 src/LubanHub.KnowledgeService/Models/KnowledgeSource.cs create mode 100644 src/LubanHub.KnowledgeService/Models/KnowledgeUpdateResult.cs create mode 100644 src/LubanHub.KnowledgeService/ServiceCollectionExtensions.cs create mode 100644 src/LubanHub.KnowledgeService/Services/KnowledgeSourceService.cs create mode 100644 test_config.cs diff --git a/LubanHub.sln b/LubanHub.sln index 6abfaf7..c1f6e83 100644 --- a/LubanHub.sln +++ b/LubanHub.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LubanHub.App", "src\LubanHu EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LubanHub.Core", "src\LubanHub.Core\LubanHub.Core.csproj", "{B8F5E9A2-1234-4567-890A-BCDEF0123456}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LubanHub.KnowledgeService", "src\LubanHub.KnowledgeService\LubanHub.KnowledgeService.csproj", "{2AD79ACA-24BD-46D4-A2A4-1C5F8086B88B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,9 +28,14 @@ Global {B8F5E9A2-1234-4567-890A-BCDEF0123456}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8F5E9A2-1234-4567-890A-BCDEF0123456}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8F5E9A2-1234-4567-890A-BCDEF0123456}.Release|Any CPU.Build.0 = Release|Any CPU + {2AD79ACA-24BD-46D4-A2A4-1C5F8086B88B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2AD79ACA-24BD-46D4-A2A4-1C5F8086B88B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2AD79ACA-24BD-46D4-A2A4-1C5F8086B88B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2AD79ACA-24BD-46D4-A2A4-1C5F8086B88B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {9A66E728-EA8A-4644-9CC2-2C056479AF5A} = {06401A04-D861-4FAC-988F-C06E2D5AC553} {B8F5E9A2-1234-4567-890A-BCDEF0123456} = {06401A04-D861-4FAC-988F-C06E2D5AC553} + {2AD79ACA-24BD-46D4-A2A4-1C5F8086B88B} = {06401A04-D861-4FAC-988F-C06E2D5AC553} EndGlobalSection EndGlobal diff --git a/src/LubanHub.App/App.axaml.cs b/src/LubanHub.App/App.axaml.cs index 39a0623..47fe8cd 100644 --- a/src/LubanHub.App/App.axaml.cs +++ b/src/LubanHub.App/App.axaml.cs @@ -3,6 +3,7 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; using LubanHub.App.Services; using LubanHub.Core; +using LubanHub.KnowledgeService; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; @@ -44,9 +45,15 @@ public partial class App : Application builder.SetMinimumLevel(LogLevel.Debug); }); + // 强制加载所有LubanHub程序集(确保配置发现能找到它们) + LoadLubanHubAssemblies(); + // 添加Core服务 services.AddCoreServices(); + // 添加知识库服务 + services.AddKnowledgeServices(); + // 添加App层服务 services.AddSingleton(); services.AddSingleton(); @@ -56,6 +63,20 @@ public partial class App : Application // services.AddSingleton(); } + private static void LoadLubanHubAssemblies() + { + try + { + // 强制加载LubanHub.KnowledgeService程序集 + var knowledgeAssembly = typeof(LubanHub.KnowledgeService.Configurations.AIConfiguration).Assembly; + Console.WriteLine($"已加载程序集: {knowledgeAssembly.GetName().Name}"); + } + catch (Exception ex) + { + Console.WriteLine($"加载LubanHub程序集时出错: {ex.Message}"); + } + } + public override void OnFrameworkInitializationCompleted() { try diff --git a/src/LubanHub.App/LubanHub.App.csproj b/src/LubanHub.App/LubanHub.App.csproj index db80f74..b6d819d 100644 --- a/src/LubanHub.App/LubanHub.App.csproj +++ b/src/LubanHub.App/LubanHub.App.csproj @@ -9,6 +9,11 @@ LubanHub.App LubanHub.App + + + + Exe + @@ -27,5 +32,6 @@ + diff --git a/src/LubanHub.App/MainWindow.axaml b/src/LubanHub.App/MainWindow.axaml index 99bf9cb..eb9aeda 100644 --- a/src/LubanHub.App/MainWindow.axaml +++ b/src/LubanHub.App/MainWindow.axaml @@ -37,6 +37,10 @@ Content="📚 知识库" Classes="navigation-button" Click="OnKnowledgeButtonClick"/> +