Define new InstructMessageModel.
This commit is contained in:
parent
1e89b0162f
commit
760a047d71
|
|
@ -59,6 +59,21 @@ public partial class ConversationService
|
||||||
}, onMessageReceived);
|
}, onMessageReceived);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (fn.StopCompletion)
|
||||||
|
{
|
||||||
|
var message = new RoleDialogModel(AgentRole.Assistant, fn.Content)
|
||||||
|
{
|
||||||
|
CurrentAgentId = fn.CurrentAgentId,
|
||||||
|
Channel = fn.Channel,
|
||||||
|
ExecutionData = fn.ExecutionData,
|
||||||
|
ExecutionResult = fn.ExecutionResult
|
||||||
|
};
|
||||||
|
|
||||||
|
await HandleAssistantMessage(message, onMessageReceived);
|
||||||
|
|
||||||
|
_storage.Append(_conversationId, agent.Id, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fn.Content = fn.FunctionArgs.Replace("\r", " ").Replace("\n", " ").Trim() + " => " + fn.ExecutionResult;
|
fn.Content = fn.FunctionArgs.Replace("\r", " ").Replace("\n", " ").Trim() + " => " + fn.ExecutionResult;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using BotSharp.Abstraction.Conversations.Models;
|
||||||
using BotSharp.Abstraction.Instructs;
|
using BotSharp.Abstraction.Instructs;
|
||||||
using BotSharp.Abstraction.Instructs.Models;
|
using BotSharp.Abstraction.Instructs.Models;
|
||||||
using BotSharp.OpenAPI.ViewModels.Conversations;
|
using BotSharp.OpenAPI.ViewModels.Conversations;
|
||||||
|
using BotSharp.OpenAPI.ViewModels.Instructs;
|
||||||
|
|
||||||
namespace BotSharp.OpenAPI.Controllers;
|
namespace BotSharp.OpenAPI.Controllers;
|
||||||
|
|
||||||
|
|
@ -23,7 +24,7 @@ public class InstructModeController : ControllerBase, IApiAdapter
|
||||||
|
|
||||||
[HttpPost("/instruct/{agentId}")]
|
[HttpPost("/instruct/{agentId}")]
|
||||||
public async Task<InstructResult> NewConversation([FromRoute] string agentId,
|
public async Task<InstructResult> NewConversation([FromRoute] string agentId,
|
||||||
[FromBody] NewMessageModel input)
|
[FromBody] InstructMessageModel input)
|
||||||
{
|
{
|
||||||
var response = new InstructResult();
|
var response = new InstructResult();
|
||||||
var instructor = _services.GetRequiredService<IInstructService>();
|
var instructor = _services.GetRequiredService<IInstructService>();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
using BotSharp.OpenAPI.ViewModels.Conversations;
|
||||||
|
|
||||||
|
namespace BotSharp.OpenAPI.ViewModels.Instructs;
|
||||||
|
|
||||||
|
public class InstructMessageModel : NewMessageModel
|
||||||
|
{
|
||||||
|
public string? TemplateName { get; set; }
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue