Class ConsoleChatModule
- Namespace
- Prefrontal.Modules.Chat.Text
- Assembly
- Prefrontal.Modules.dll
public class ConsoleChatModule : Module
- Inheritance
-
ConsoleChatModule
- Inherited Members
- Extension Methods
Constructors
ConsoleChatModule(ChatModule)
public ConsoleChatModule(ChatModule _)
Parameters
Methods
RunAsync(CancellationToken)
Override this method in a derived class to run the module's main logic.
- Do not call this method directly.
- Call Agent.RunAsync() to run all the modules in parallel.
- Returning from this method means the module has completed its primary task and won't be called again during the same Agent.RunAsync() call.
- The RunningModuleExceptionPolicy passed to Agent.RunAsync() controls what happens when this method throws an exception.
- The CancellationToken passed to this method signals that the method should stop running and return. This can happen when module is removed, the Stop() method is called or the agent is disposed of.
-
To keep the module's logic running indefinitely,
you can override this method and run a loop like so:
protected override async Task RunAsync(CancellationToken cancellationToken) { while(!cancellationToken.IsCancellationRequested) { // Your module's logic here } }
protected override Task RunAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenA CancellationToken whose cancellation signals that the module should stop running.