commit
485e170967
|
|
@ -368,8 +368,8 @@ public class ConversationController : ControllerBase
|
||||||
var routing = _services.GetRequiredService<IRoutingService>();
|
var routing = _services.GetRequiredService<IRoutingService>();
|
||||||
routing.Context.SetMessageId(conversationId, inputMsg.MessageId);
|
routing.Context.SetMessageId(conversationId, inputMsg.MessageId);
|
||||||
|
|
||||||
SetStates(conv, input);
|
|
||||||
conv.SetConversationId(conversationId, input.States);
|
conv.SetConversationId(conversationId, input.States);
|
||||||
|
SetStates(conv, input);
|
||||||
|
|
||||||
var response = new ChatResponseModel();
|
var response = new ChatResponseModel();
|
||||||
|
|
||||||
|
|
@ -581,11 +581,26 @@ public class ConversationController : ControllerBase
|
||||||
#region Private methods
|
#region Private methods
|
||||||
private void SetStates(IConversationService conv, NewMessageModel input)
|
private void SetStates(IConversationService conv, NewMessageModel input)
|
||||||
{
|
{
|
||||||
conv.States.SetState("channel", input.Channel, source: StateSource.External)
|
if (string.IsNullOrEmpty(conv.States.GetState("channel")))
|
||||||
.SetState("provider", input.Provider, source: StateSource.External)
|
{
|
||||||
.SetState("model", input.Model, source: StateSource.External)
|
conv.States.SetState("channel", input.Channel, source: StateSource.External);
|
||||||
.SetState("temperature", input.Temperature, source: StateSource.External)
|
}
|
||||||
.SetState("sampling_factor", input.SamplingFactor, source: StateSource.External);
|
if (string.IsNullOrEmpty(conv.States.GetState("provider")))
|
||||||
|
{
|
||||||
|
conv.States.SetState("provider", input.Provider, source: StateSource.External);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(conv.States.GetState("model")))
|
||||||
|
{
|
||||||
|
conv.States.SetState("model", input.Model, source: StateSource.External);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(conv.States.GetState("temperature")))
|
||||||
|
{
|
||||||
|
conv.States.SetState("temperature", input.Temperature, source: StateSource.External);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(conv.States.GetState("sampling_factor")))
|
||||||
|
{
|
||||||
|
conv.States.SetState("sampling_factor", input.SamplingFactor, source: StateSource.External);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileContentResult BuildFileResult(string file)
|
private FileContentResult BuildFileResult(string file)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ public class AsyncWebsocketDataResultEnumerator : IAsyncEnumerator<ClientResult>
|
||||||
|
|
||||||
public ValueTask DisposeAsync()
|
public ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
|
ArrayPool<byte>.Shared.Return(_buffer, clearArray: true);
|
||||||
_webSocket?.Dispose();
|
_webSocket?.Dispose();
|
||||||
return new ValueTask(Task.CompletedTask);
|
return new ValueTask(Task.CompletedTask);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class RealtimeChatSession : IDisposable
|
||||||
|
|
||||||
public async IAsyncEnumerable<SessionConversationUpdate> ReceiveUpdatesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
|
public async IAsyncEnumerable<SessionConversationUpdate> ReceiveUpdatesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
await foreach (ClientResult result in ReceiveInnerUpdatesAsync())
|
await foreach (ClientResult result in ReceiveInnerUpdatesAsync(cancellationToken))
|
||||||
{
|
{
|
||||||
var update = HandleSessionResult(result);
|
var update = HandleSessionResult(result);
|
||||||
yield return update;
|
yield return update;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue