Browse Source

feat: Add Workspace management interface implementation

pull/1421/head
colin 1 week ago
parent
commit
e102e6c8f9
  1. 5
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN.Abp.AIManagement.Application.Contracts.csproj
  2. 7
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/AIManagementRemoteServiceConsts.cs
  3. 14
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/AbpAIManagementApplicationContractsModule.cs
  4. 8
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/AbpAIManagementDomainSharedModule.cs
  5. 10
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordCreateDto.cs
  6. 47
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordCreateOrUpdateDto.cs
  7. 39
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordDto.cs
  8. 14
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordGetListInput.cs
  9. 10
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordUpdateDto.cs
  10. 14
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/IWorkspaceDefinitionAppService.cs
  11. 30
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/FodyWeavers.xsd
  12. 12
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AIManagementApplicationServiceBase.cs
  13. 15
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AbpAIManagementApplicationMappers.cs
  14. 17
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AbpAIManagementApplicationModule.cs
  15. 8
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AbpAIManagementDomainSharedModule.cs
  16. 152
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/Workspaces/WorkspaceDefinitionAppService.cs
  17. 12
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/AIManagementErrorCodes.cs
  18. 16
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Workspaces/WorkspaceAlreadyExistsException.cs
  19. 2
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN/Abp/AIManagement/AbpAIManagementDbProperties.cs
  20. 30
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.EntityFrameworkCore/FodyWeavers.xsd
  21. 2
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.EntityFrameworkCore/LINGYUN/Abp/AIManagement/EntityFrameworkCore/AIManagementDbContextModelBuilderExtensions.cs
  22. 8
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.HttpApi/LINGYUN/Abp/AIManagement/AbpAIManagementDomainSharedModule.cs
  23. 52
      aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.HttpApi/LINGYUN/Abp/AIManagement/Workspaces/WorkspaceDefinitionController.cs

5
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN.Abp.AIManagement.Application.Contracts.csproj

@ -5,8 +5,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0;net10.0</TargetFrameworks>
<AssemblyName>LINGYUN.Abp.AIManagement.Domain</AssemblyName>
<PackageId>LINGYUN.Abp.AIManagement.Domain</PackageId>
<AssemblyName>LINGYUN.Abp.AIManagement.Application.Contracts</AssemblyName>
<PackageId>LINGYUN.Abp.AIManagement.Application.Contracts</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" />
<PackageReference Include="Volo.Abp.Authorization.Abstractions" />
</ItemGroup>
<ItemGroup>

7
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/AIManagementRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace LINGYUN.Abp.AIManagement;
public static class AIManagementRemoteServiceConsts
{
public const string RemoteServiceName = "AbpAIManagement";
public const string ModuleName = "ai-management";
}

14
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/AbpAIManagementApplicationContractsModule.cs

@ -0,0 +1,14 @@
using Volo.Abp.Application;
using Volo.Abp.Authorization;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AIManagement;
[DependsOn(
typeof(AbpAIManagementDomainSharedModule),
typeof(AbpDddApplicationContractsModule),
typeof(AbpAuthorizationAbstractionsModule))]
public class AbpAIManagementApplicationContractsModule : AbpModule
{
}

8
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/AbpAIManagementDomainSharedModule.cs

@ -1,8 +0,0 @@
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AIManagement;
public class AbpAIManagementDomainSharedModule : AbpModule
{
}

10
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordCreateDto.cs

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.AIManagement.Workspaces.Dtos;
public class WorkspaceDefinitionRecordCreateDto : WorkspaceDefinitionRecordCreateOrUpdateDto
{
[Required]
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxNameLength))]
public string Name { get; set; }
}

47
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordCreateOrUpdateDto.cs

@ -0,0 +1,47 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.AIManagement.Workspaces.Dtos;
public abstract class WorkspaceDefinitionRecordCreateOrUpdateDto : ExtensibleObject
{
[Required]
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxProviderLength))]
public string Provider { get; set; }
[Required]
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxModelNameLength))]
public string ModelName { get; set; }
[Required]
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxDisplayNameLength))]
public string DisplayName { get; set; }
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxDescriptionLength))]
public string? Description { get; set; }
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxApiKeyLength))]
public string? ApiKey { get; set; }
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxApiBaseUrlLength))]
public string? ApiBaseUrl { get; set; }
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxSystemPromptLength))]
public string? SystemPrompt { get; set; }
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxInstructionsLength))]
public string? Instructions { get; set; }
public float? Temperature { get; set; }
public int? MaxOutputTokens { get; set; }
public float? FrequencyPenalty { get; set; }
public float? PresencePenalty { get; set; }
public bool IsEnabled { get; set; }
[DynamicStringLength(typeof(WorkspaceDefinitionRecordConsts), nameof(WorkspaceDefinitionRecordConsts.MaxStateCheckersLength))]
public string? StateCheckers { get; set; }
}

39
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordDto.cs

@ -0,0 +1,39 @@
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
namespace LINGYUN.Abp.AIManagement.Workspaces.Dtos;
[Serializable]
public class WorkspaceDefinitionRecordDto : ExtensibleAuditedEntityDto<Guid>, IHasConcurrencyStamp
{
public string Name { get; set; }
public string Provider { get; set; }
public string ModelName { get; set; }
public string DisplayName { get; set; }
public string? Description { get; set; }
public string? ApiBaseUrl { get; set; }
public string? SystemPrompt { get; set; }
public string? Instructions { get; set; }
public float? Temperature { get; set; }
public int? MaxOutputTokens { get; set; }
public float? FrequencyPenalty { get; set; }
public float? PresencePenalty { get; set; }
public bool IsEnabled { get; set; }
public string? StateCheckers { get; set; }
public string ConcurrencyStamp { get; set; }
}

14
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordGetListInput.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.AIManagement.Workspaces.Dtos;
[Serializable]
public class WorkspaceDefinitionRecordGetListInput : PagedAndSortedResultRequestDto
{
public string? Filter { get; set; }
public string? Provider { get; set; }
public string? ModelName { get; set; }
}

10
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/Dtos/WorkspaceDefinitionRecordUpdateDto.cs

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
namespace LINGYUN.Abp.AIManagement.Workspaces.Dtos;
public class WorkspaceDefinitionRecordUpdateDto : WorkspaceDefinitionRecordCreateOrUpdateDto, IHasConcurrencyStamp
{
[Required]
[StringLength(40)]
public string ConcurrencyStamp { get; set; }
}

14
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application.Contracts/LINGYUN/Abp/AIManagement/Workspaces/IWorkspaceDefinitionAppService.cs

@ -0,0 +1,14 @@
using LINGYUN.Abp.AIManagement.Workspaces.Dtos;
using System;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.AIManagement.Workspaces;
public interface IWorkspaceDefinitionAppService :
ICrudAppService<
WorkspaceDefinitionRecordDto,
Guid,
WorkspaceDefinitionRecordGetListInput,
WorkspaceDefinitionRecordCreateDto,
WorkspaceDefinitionRecordUpdateDto>
{
}

30
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

12
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AIManagementApplicationServiceBase.cs

@ -0,0 +1,12 @@
using LINGYUN.Abp.AIManagement.Localization;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.AIManagement;
public abstract class AIManagementApplicationServiceBase : ApplicationService
{
protected AIManagementApplicationServiceBase()
{
LocalizationResource = typeof(AIManagementResource);
ObjectMapperContext = typeof(AbpAIManagementApplicationModule);
}
}

15
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AbpAIManagementApplicationMappers.cs

@ -0,0 +1,15 @@
using LINGYUN.Abp.AIManagement.Workspaces;
using LINGYUN.Abp.AIManagement.Workspaces.Dtos;
using Riok.Mapperly.Abstractions;
using Volo.Abp.Mapperly;
using Volo.Abp.ObjectExtending;
namespace LINGYUN.Abp.AIManagement;
[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)]
[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)]
public partial class WorkspaceDefinitionRecordToWorkspaceDefinitionRecordDtoMapper : MapperBase<WorkspaceDefinitionRecord, WorkspaceDefinitionRecordDto>
{
public override partial WorkspaceDefinitionRecordDto Map(WorkspaceDefinitionRecord source);
public override partial void Map(WorkspaceDefinitionRecord source, WorkspaceDefinitionRecordDto destination);
}

17
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AbpAIManagementApplicationModule.cs

@ -0,0 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Application;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AIManagement;
[DependsOn(
typeof(AbpAIManagementApplicationContractsModule),
typeof(AbpAIManagementDomainModule),
typeof(AbpDddApplicationModule))]
public class AbpAIManagementApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddMapperlyObjectMapper<AbpAIManagementApplicationModule>();
}
}

8
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/AbpAIManagementDomainSharedModule.cs

@ -1,8 +0,0 @@
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AIManagement;
public class AbpAIManagementDomainSharedModule : AbpModule
{
}

152
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Application/LINGYUN/Abp/AIManagement/Workspaces/WorkspaceDefinitionAppService.cs

@ -0,0 +1,152 @@
using LINGYUN.Abp.AIManagement.Localization;
using LINGYUN.Abp.AIManagement.Workspaces.Dtos;
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Data;
using Volo.Abp.Security.Encryption;
namespace LINGYUN.Abp.AIManagement.Workspaces;
public class WorkspaceDefinitionAppService :
CrudAppService<
WorkspaceDefinitionRecord,
WorkspaceDefinitionRecordDto,
Guid,
WorkspaceDefinitionRecordGetListInput,
WorkspaceDefinitionRecordCreateDto,
WorkspaceDefinitionRecordUpdateDto>,
IWorkspaceDefinitionAppService
{
protected IStringEncryptionService StringEncryptionService { get; }
protected IWorkspaceDefinitionRecordRepository WorkspaceDefinitionRecordRepository { get; }
public WorkspaceDefinitionAppService(
IStringEncryptionService stringEncryptionService,
IWorkspaceDefinitionRecordRepository repository) : base(repository)
{
StringEncryptionService = stringEncryptionService;
WorkspaceDefinitionRecordRepository = repository;
LocalizationResource = typeof(AIManagementResource);
ObjectMapperContext = typeof(AbpAIManagementApplicationModule);
}
protected async override Task<IQueryable<WorkspaceDefinitionRecord>> CreateFilteredQueryAsync(WorkspaceDefinitionRecordGetListInput input)
{
var queryable = await base.CreateFilteredQueryAsync(input);
return queryable
.WhereIf(!input.Provider.IsNullOrWhiteSpace(), x => x.Provider == input.Provider)
.WhereIf(!input.ModelName.IsNullOrWhiteSpace(), x => x.ModelName == input.ModelName)
.WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.Provider.Contains(input.Filter!) ||
x.ModelName.Contains(input.Filter!) || x.DisplayName.Contains(input.Filter!) ||
(!x.Description.IsNullOrWhiteSpace() && x.Description.Contains(input.Filter!)) ||
(!x.SystemPrompt.IsNullOrWhiteSpace() && x.SystemPrompt.Contains(input.Filter!)) ||
(!x.Instructions.IsNullOrWhiteSpace() && x.Instructions.Contains(input.Filter!)));
}
protected async override Task<WorkspaceDefinitionRecord> MapToEntityAsync(WorkspaceDefinitionRecordCreateDto createInput)
{
if (await WorkspaceDefinitionRecordRepository.FindByNameAsync(createInput.Name) != null)
{
throw new WorkspaceAlreadyExistsException(createInput.Name);
}
var record = new WorkspaceDefinitionRecord(
GuidGenerator.Create(),
createInput.Name,
createInput.Provider,
createInput.ModelName,
createInput.DisplayName,
createInput.Description,
createInput.SystemPrompt,
createInput.Instructions,
createInput.Temperature,
createInput.MaxOutputTokens,
createInput.FrequencyPenalty,
createInput.PresencePenalty,
createInput.StateCheckers);
if (!createInput.ApiKey.IsNullOrWhiteSpace())
{
var encryptApiKey = StringEncryptionService.Encrypt(createInput.ApiKey);
record.SetApiKey(encryptApiKey, createInput.ApiBaseUrl);
}
return record;
}
protected override void MapToEntity(WorkspaceDefinitionRecordUpdateDto updateInput, WorkspaceDefinitionRecord entity)
{
if (entity.DisplayName != updateInput.DisplayName)
{
entity.SetDisplayName(updateInput.DisplayName);
}
if (entity.Description != updateInput.Description)
{
entity.Description = updateInput.Description;
}
if (entity.Provider != updateInput.Provider || entity.ModelName != updateInput.ModelName)
{
entity.SetModel(updateInput.Provider, updateInput.ModelName);
}
if (entity.SystemPrompt != updateInput.SystemPrompt)
{
entity.SystemPrompt = updateInput.SystemPrompt;
}
if (entity.Instructions != updateInput.Instructions)
{
entity.Instructions = updateInput.Instructions;
}
if (entity.IsEnabled != updateInput.IsEnabled)
{
entity.IsEnabled = updateInput.IsEnabled;
}
if (entity.Temperature != updateInput.Temperature)
{
entity.Temperature = updateInput.Temperature;
}
if (entity.MaxOutputTokens != updateInput.MaxOutputTokens)
{
entity.MaxOutputTokens = updateInput.MaxOutputTokens;
}
if (entity.FrequencyPenalty != updateInput.FrequencyPenalty)
{
entity.FrequencyPenalty = updateInput.FrequencyPenalty;
}
if (entity.PresencePenalty != updateInput.PresencePenalty)
{
entity.PresencePenalty = updateInput.PresencePenalty;
}
if (entity.StateCheckers != updateInput.StateCheckers)
{
entity.StateCheckers = updateInput.StateCheckers;
}
if (!updateInput.ApiKey.IsNullOrWhiteSpace())
{
var encryptApiKey = StringEncryptionService.Encrypt(updateInput.ApiKey);
entity.SetApiKey(encryptApiKey, updateInput.ApiBaseUrl);
}
if (!entity.HasSameExtraProperties(updateInput))
{
entity.ExtraProperties.Clear();
foreach (var property in updateInput.ExtraProperties)
{
entity.ExtraProperties.Add(property.Key, property.Value);
}
}
}
}

12
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/AIManagementErrorCodes.cs

@ -0,0 +1,12 @@
namespace LINGYUN.Abp.AIManagement;
public static class AIManagementErrorCodes
{
public const string Namespace = "AIManagement";
public static class Workspace
{
public const string Prefix = Namespace + ":100";
public const string NameAlreadyExists = Prefix + "001";
}
}

16
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Workspaces/WorkspaceAlreadyExistsException.cs

@ -0,0 +1,16 @@
using Volo.Abp;
namespace LINGYUN.Abp.AIManagement.Workspaces;
public class WorkspaceAlreadyExistsException : BusinessException
{
public string Workspace { get; }
public WorkspaceAlreadyExistsException(string workspace)
: base(
AIManagementErrorCodes.Workspace.NameAlreadyExists,
$"A Workspace named {workspace} already exists!")
{
Workspace = workspace;
WithData(nameof(Workspace), workspace);
}
}

2
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN/Abp/AIManagement/AbpAIManagementDbProperties.cs

@ -3,7 +3,7 @@
namespace LINGYUN.Abp.AIManagement;
public static class AbpAIManagementDbProperties
{
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix;
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix + "AI";
public static string? DbSchema { get; set; } = AbpCommonDbProperties.DbSchema;

30
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.EntityFrameworkCore/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

2
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.EntityFrameworkCore/LINGYUN/Abp/AIManagement/EntityFrameworkCore/AIManagementDbContextModelBuilderExtensions.cs

@ -80,7 +80,7 @@ public static class AIManagementDbContextModelBuilderExtensions
b.Property(x => x.ApiKey)
.HasMaxLength(WorkspaceDefinitionRecordConsts.MaxApiKeyLength);
b.Property(x => x.ApiBaseUrl)
.HasMaxLength(WorkspaceDefinitionRecordConsts.MaxApiKeyLength);
.HasMaxLength(WorkspaceDefinitionRecordConsts.MaxApiBaseUrlLength);
b.Property(x => x.SystemPrompt)
.HasMaxLength(WorkspaceDefinitionRecordConsts.MaxSystemPromptLength);
b.Property(x => x.Instructions)

8
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.HttpApi/LINGYUN/Abp/AIManagement/AbpAIManagementDomainSharedModule.cs

@ -1,8 +0,0 @@
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.AIManagement;
public class AbpAIManagementDomainSharedModule : AbpModule
{
}

52
aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.HttpApi/LINGYUN/Abp/AIManagement/Workspaces/WorkspaceDefinitionController.cs

@ -0,0 +1,52 @@
using LINGYUN.Abp.AIManagement.Workspaces.Dtos;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.AIManagement.Workspaces;
[Controller]
[RemoteService(Name = AIManagementRemoteServiceConsts.RemoteServiceName)]
[Area(AIManagementRemoteServiceConsts.ModuleName)]
[Route($"api/{AIManagementRemoteServiceConsts.ModuleName}/workspaces")]
public class WorkspaceDefinitionController : AbpControllerBase, IWorkspaceDefinitionAppService
{
private readonly IWorkspaceDefinitionAppService _service;
public WorkspaceDefinitionController(IWorkspaceDefinitionAppService service)
{
_service = service;
}
[HttpPost]
public virtual Task<WorkspaceDefinitionRecordDto> CreateAsync(WorkspaceDefinitionRecordCreateDto input)
{
return _service.CreateAsync(input);
}
[HttpDelete("{id}")]
public virtual Task DeleteAsync(Guid id)
{
return _service.DeleteAsync(id);
}
[HttpGet("{id}")]
public virtual Task<WorkspaceDefinitionRecordDto> GetAsync(Guid id)
{
return _service.GetAsync(id);
}
[HttpGet]
public virtual Task<PagedResultDto<WorkspaceDefinitionRecordDto>> GetListAsync(WorkspaceDefinitionRecordGetListInput input)
{
return _service.GetListAsync(input);
}
[HttpPut("{id}")]
public virtual Task<WorkspaceDefinitionRecordDto> UpdateAsync(Guid id, WorkspaceDefinitionRecordUpdateDto input)
{
return _service.UpdateAsync(id, input);
}
}
Loading…
Cancel
Save