diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAICoreModule.cs b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAICoreModule.cs index 8718805c2..8bdcf3754 100644 --- a/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAICoreModule.cs +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAICoreModule.cs @@ -5,7 +5,9 @@ using System; using System.Collections.Generic; using Volo.Abp.AI; using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.AI; @@ -21,15 +23,27 @@ public class AbpAICoreModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + Configure(options => { - options.Resources.Add(); + options.Resources + .Add() + .AddVirtualJson("/LINGYUN/Abp/AI/Localization/Resources"); }); Configure(options => { options.ChatClientProviders.Add(); }); + + Configure(options => + { + options.MapCodeNamespace(AbpAIErrorCodes.Namespace, typeof(AbpAIResource)); + }); } private static void AutoAddDefinitionProviders(IServiceCollection services) diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAIErrorCodes.cs b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAIErrorCodes.cs new file mode 100644 index 000000000..bb261dea1 --- /dev/null +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/AbpAIErrorCodes.cs @@ -0,0 +1,9 @@ +namespace LINGYUN.Abp.AI; +public static class AbpAIErrorCodes +{ + public const string Namespace = "Abp.AI"; + /// + /// 工作区不可用: {Workspace}! + /// + public const string WorkspaceIsNotEnabled = Namespace + ":110001"; +} diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/Localization/Resources/en.json b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/Localization/Resources/en.json new file mode 100644 index 000000000..399e2a7c9 --- /dev/null +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/Localization/Resources/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "Abp.AI:110001": "Workspace is not enabled: {Workspace}!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/Localization/Resources/zh-Hans.json b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..3fc69d30d --- /dev/null +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AI.Core/LINGYUN/Abp/AI/Localization/Resources/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "Abp.AI:110001": "工作区不可用: {Workspace}!" + } +} \ No newline at end of file