feat: 重构完成
This commit is contained in:
@@ -46,8 +46,7 @@ public class AiModelDescribe
|
||||
/// 模型描述
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 额外url
|
||||
/// </summary>
|
||||
|
||||
@@ -20,6 +20,11 @@ public class AiAppAggregateRoot : FullAuditedAggregateRoot<Guid>, IOrderNum
|
||||
/// </summary>
|
||||
public string Endpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 额外url
|
||||
/// </summary>
|
||||
public string? ExtraUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用key
|
||||
/// </summary>
|
||||
|
||||
@@ -44,4 +44,5 @@ public class AiModelEntity : Entity<Guid>, IOrderNum,ISoftDelete
|
||||
/// ai应用id
|
||||
/// </summary>
|
||||
public Guid AiAppId { get; set; }
|
||||
|
||||
}
|
||||
@@ -55,7 +55,8 @@ public class AiGateWayManager : DomainService
|
||||
HandlerName = model.HandlerName,
|
||||
ModelId = model.ModelId,
|
||||
ModelName = model.Name,
|
||||
Description = model.Description
|
||||
Description = model.Description,
|
||||
ExtraUrl = app.ExtraUrl
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -75,7 +76,8 @@ public class AiGateWayManager : DomainService
|
||||
[EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
var modelDescribe = await GetModelAsync(request.Model);
|
||||
var chatService = LazyServiceProvider.GetRequiredKeyedService<IChatCompletionService>(modelDescribe.HandlerName);
|
||||
var chatService =
|
||||
LazyServiceProvider.GetRequiredKeyedService<IChatCompletionService>(modelDescribe.HandlerName);
|
||||
await foreach (var result in chatService.CompleteChatStreamAsync(modelDescribe, request, cancellationToken))
|
||||
{
|
||||
yield return result;
|
||||
@@ -103,7 +105,8 @@ public class AiGateWayManager : DomainService
|
||||
response.ContentType = "application/json; charset=UTF-8";
|
||||
await using var writer = new StreamWriter(response.Body, Encoding.UTF8, leaveOpen: true);
|
||||
var modelDescribe = await GetModelAsync(request.Model);
|
||||
var chatService = LazyServiceProvider.GetRequiredKeyedService<IChatCompletionService>(modelDescribe.HandlerName);
|
||||
var chatService =
|
||||
LazyServiceProvider.GetRequiredKeyedService<IChatCompletionService>(modelDescribe.HandlerName);
|
||||
var data = await chatService.CompleteChatAsync(modelDescribe, request, cancellationToken);
|
||||
if (userId is not null)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Xml.Linq;
|
||||
using Mapster;
|
||||
using Mapster;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.DistributedLocking;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
Reference in New Issue
Block a user