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"/> +