Class ConversationController
public sealed class ConversationController : IConversationsApiListener
- Inheritance
-
object
ConversationController
- Implements
-
Constructors
ConversationController(IConversationContext, SetStatusDelegate, ResetToReadyStateDelegate, IReadOnlyList<IConversationListener>, ILogger)
public ConversationController(IConversationContext context, SetStatusDelegate setStatus, ResetToReadyStateDelegate resetToReadyState, IReadOnlyList<IConversationListener> handlers, ILogger logger)
Parameters
context IConversationContext
setStatus SetStatusDelegate
resetToReadyState ResetToReadyStateDelegate
handlers IReadOnlyList<IConversationListener>
logger ILogger
Properties
Conversation
public Conversation Conversation { get; }
Property Value
- Conversation
HasConversationManager
public bool HasConversationManager { get; }
Property Value
- bool
IsInitialized
public bool IsInitialized { get; }
Property Value
- bool
Items
public List<ConversationItem> Items { get; }
Property Value
- List<ConversationItem>
LastMessage
public Message LastMessage { get; }
Property Value
- Message
Messages
public List<Message> Messages { get; }
Property Value
- List<Message>
Methods
AssembleWithContextAsync(ConversationItem, int)
public UniTask<ConversationItem[]> AssembleWithContextAsync(ConversationItem inputItem, int index)
Parameters
inputItem ConversationItem
index int
Returns
- UniTask<ConversationItem[]>
CreateConversationAsync(CancellationToken)
public UniTask<Conversation> CreateConversationAsync(CancellationToken ct = default)
Parameters
ct CancellationToken
Returns
- UniTask<Conversation>
DeleteConversationAndItemsAsync(string, CancellationToken)
public UniTask<bool> DeleteConversationAndItemsAsync(string convId, CancellationToken ct = default)
Parameters
convId string
ct CancellationToken
Returns
- UniTask<bool>
InitAsync(string, Api, ConversationStoreType, IConversationsApiListener, IAgentMemorySettings)
public UniTask InitAsync(string agentId, Api modelApi, ConversationStoreType storeType, IConversationsApiListener listener, IAgentMemorySettings memorySettings)
Parameters
agentId string
modelApi Api
storeType ConversationStoreType
listener IConversationsApiListener
memorySettings IAgentMemorySettings
Returns
- UniTask
ListConversationsAsync(CancellationToken)
public UniTask<Conversation[]> ListConversationsAsync(CancellationToken ct = default)
Parameters
ct CancellationToken
Returns
- UniTask<Conversation[]>
LoadConversationAsync(string, bool, CancellationToken)
public UniTask<Conversation> LoadConversationAsync(string conversationId, bool createIfNotFound = true, CancellationToken ct = default)
Parameters
conversationId string
createIfNotFound bool
ct CancellationToken
Returns
- UniTask<Conversation>
OnConversationCreated(Conversation)
public void OnConversationCreated(Conversation conversation)
Parameters
conversation Conversation
OnConversationDeleted(string, bool)
public void OnConversationDeleted(string id, bool success)
Parameters
id string
success bool
OnConversationItemsLoaded(ConversationItem[])
public void OnConversationItemsLoaded(ConversationItem[] items)
Parameters
items ConversationItem[]
OnConversationListLoaded(Conversation[])
public void OnConversationListLoaded(Conversation[] conversations)
Parameters
conversations Conversation[]
OnConversationLoaded(Conversation)
public void OnConversationLoaded(Conversation conversation)
Parameters
conversation Conversation
OnConversationTitleUpdated(string)
public void OnConversationTitleUpdated(string newTitle)
Parameters
newTitle string
public UniTask<List<Message>> PushInputMessageAsync(Message inputMessage, int index = -1)
Parameters
inputMessage Message
index int
Returns
- UniTask<List<Message>>
public void PushOutputMessage(ResponseMessage outputMessage, UsageMetadata usage)
Parameters
outputMessage ResponseMessage
usage UsageMetadata
ReCalculateTotalUsage()
public void ReCalculateTotalUsage()
ResetFlags(ChatService, Api)
public void ResetFlags(ChatService chatApi, Api modelApi)
Parameters
chatApi ChatService
modelApi Api
SaveConversationAsync(CancellationToken)
public UniTask SaveConversationAsync(CancellationToken ct = default)
Parameters
ct CancellationToken
Returns
- UniTask
SaveConversationItemsAsync(CancellationToken)
public UniTask SaveConversationItemsAsync(CancellationToken ct = default)
Parameters
ct CancellationToken
Returns
- UniTask
SetConversationAsync(Conversation, CancellationToken)
public UniTask SetConversationAsync(Conversation conversation, CancellationToken ct = default)
Parameters
conversation Conversation
ct CancellationToken
Returns
- UniTask