feat: 完成agent接口
This commit is contained in:
@@ -17,6 +17,7 @@ using OpenAI.Chat;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Users;
|
||||
using Yi.Framework.AiHub.Application.Contracts.Dtos;
|
||||
using Yi.Framework.AiHub.Application.Contracts.Dtos.Chat;
|
||||
using Yi.Framework.AiHub.Domain;
|
||||
using Yi.Framework.AiHub.Domain.Entities;
|
||||
using Yi.Framework.AiHub.Domain.Entities.Model;
|
||||
@@ -145,16 +146,26 @@ public class AiChatService : ApplicationService
|
||||
}
|
||||
}
|
||||
|
||||
// 使用 ChatManager
|
||||
//ai网关代理httpcontext
|
||||
await _aiGateWayManager.CompleteChatStreamForStatisticsAsync(_httpContextAccessor.HttpContext, input,
|
||||
CurrentUser.Id, sessionId, null, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Agent 发送消息
|
||||
/// </summary>
|
||||
[HttpPost("ai-chat/agent/send")]
|
||||
public async Task PostAgentSendAsync()
|
||||
[Authorize]
|
||||
public async Task PostAgentSendAsync([FromBody] AgentSendInput input, CancellationToken cancellationToken)
|
||||
{
|
||||
await _chatManager.CompleteChatStreamAsync();
|
||||
await _chatManager.AgentCompleteChatStreamAsync(_httpContextAccessor.HttpContext,
|
||||
input.SessionId,
|
||||
input.Content,
|
||||
input.TokenId,
|
||||
input.ModelId,
|
||||
CurrentUser.GetId(),
|
||||
input.Tools,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user