Skip to main content

SmartReportAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI

Enhances the ChatBox control to allow seamless PDF report queries using an AI provider.

public class SmartReportAdapter : SmartAdapter

Utilizes these services: IDocumentConversionService. The SmartReportAdapter class extends the functionality of a ChatBox to provide capabilities for reading and interpreting reports. It utilizes prompts and sessions to interact with the user and process report data.

Constructors​

SmartReportAdapter()​

Initializes a new instance of the SmartReportAdapter class.

Properties​

AutoReset​

Boolean: Gets or sets a value indicating whether the history of the conversation is cleared after each response. (Default: False)

BotAvatar​

String: Gets or sets the avatar image source for the bot. (Default: "resource.wx/Wisej.AI/Icons/wisej-avatar.svg")

BotName​

String: Gets or sets the name of the bot. (Default: "Wisej.AI")

ChatBox​

ChatBox: Gets the ChatBox control associated with this adapter.

ConversionService​

IDocumentConversionService: Gets or sets the document conversion service used for converting documents to text.

Prompt​

String: Gets or sets the prompt to execute. Used only when the adapter is not connected to a ChatBox. (Default: null)

ReportPdfSource​

Stream: Gets or sets the PDF source stream for the report.

User​

User: Gets the user associated with the bot.

Methods​

AskAsync(question)​

ParameterTypeDescription
questionString

Returns: Task<String>.

Throws:

evaluate_expression(expression)​

Evaluates a mathematical expression asynchronously.

ParameterTypeDescription
expressionStringThe mathematical expression to evaluate.

Returns: Task<Object>. A task that represents the asynchronous operation. The task result contains the evaluated result of the expression.

This method uses the browser's evaluation engine to compute the result of the given expression.

OnAnswerReceived(e)​

Raises the AnswerReceived event.

ParameterTypeDescription
eAnswerReceivedArgsThe AnswerReceivedArgs instance containing the event data.

OnControlCreated(control)​

ParameterTypeDescription
controlControl

OnControlDisposed(control)​

ParameterTypeDescription
controlControl

OnReadingReport(e)​

Raises the ReadingReport event.

ParameterTypeDescription
eReadingReportEventArgsThe ReadingReportEventArgs instance containing the event data.

ResetSession(removeMessages)​

Resets the conversation history.

ParameterTypeDescription
removeMessagesBooleanIndicates whether all messages from the ChatBox control should also be removed.

RunAsyncCore(control)​

Executes the core logic asynchronously for running the session.

ParameterTypeDescription
controlControlThe control associated with the session.

Returns: Task<Message>. A task representing the asynchronous operation.

Events​

AnswerReceived​

AnswerReceivedHandler Occurs when an answer is received from the session.

ReadingReport​

ReadingReportEventHandler Occurs when a report is being read.

Implements​

NameDescription
IToolProviderRepresents a provider that supplies tools.