llm-chat 0.0.0
LLM-Chat
Loading...
Searching...
No Matches
llm_chat::Message Class Reference

The Message class represents a chat message. More...

#include <message.h>

Inheritance diagram for llm_chat::Message:
[legend]
Collaboration diagram for llm_chat::Message:
[legend]

Public Member Functions

 Message (const QString text, const bool is_user, const QVector< QVariant > &context, const bool in_progress=false, QObject *parent=nullptr)
 Constructs a new Message object.
 
QString text () const
 Returns the text of the message.
 
void setText (const QString text)
 Sets the text of the message.
 
bool isUser () const
 Returns true if the message was sent by the user, false otherwise.
 
QVector< QVariant > context () const
 Returns the context of the message.
 
void setContext (const QVector< QVariant > &context)
 Sets the context of the message.
 
bool inProgress () const
 Gets the in progress flag of the message.
 
void setInProgress (const bool in_progress)
 Sets the in progress flag of the message.
 
void updateFromJson (const QJsonObject &json)
 Updates the message from a JSON object.
 

Properties

QString text
 
bool isUser
 
QVector< QVariant > context
 
bool inProgress
 

Detailed Description

The Message class represents a chat message.

Constructor & Destructor Documentation

◆ Message()

llm_chat::Message::Message ( const QString text,
const bool is_user,
const QVector< QVariant > & context,
const bool in_progress = false,
QObject * parent = nullptr )

Constructs a new Message object.

Parameters
textThe text of the message.
is_userTrue if the message was sent by the user, false otherwise.
contextThe context of the message.
in_progressWhether the message is in progress.
parentThe parent object.

Member Function Documentation

◆ context()

QVector< QVariant > llm_chat::Message::context ( ) const
nodiscard

Returns the context of the message.

This is used to provide additional information to the LLM.

Returns
The context of the message.

◆ inProgress()

bool llm_chat::Message::inProgress ( ) const
nodiscard

Gets the in progress flag of the message.

Returns
True if the message is in progress, false otherwise.

◆ isUser()

bool llm_chat::Message::isUser ( ) const
nodiscard

Returns true if the message was sent by the user, false otherwise.

Returns
True if the message was sent by the user, false otherwise.

◆ setContext()

void llm_chat::Message::setContext ( const QVector< QVariant > & context)

Sets the context of the message.

Parameters
contextThe new context of the message.
Here is the caller graph for this function:

◆ setInProgress()

void llm_chat::Message::setInProgress ( const bool in_progress)

Sets the in progress flag of the message.

Parameters
in_progressThe new in progress flag of the message.

◆ setText()

void llm_chat::Message::setText ( const QString text)

Sets the text of the message.

Parameters
textThe new text of the message.
Here is the caller graph for this function:

◆ text()

QString llm_chat::Message::text ( ) const
nodiscard

Returns the text of the message.

Returns
The text of the message.

◆ updateFromJson()

void llm_chat::Message::updateFromJson ( const QJsonObject & json)

Updates the message from a JSON object.

Parameters
jsonThe JSON object to update the message from.

Property Documentation

◆ context

QVector<QVariant> llm_chat::Message::context
read

◆ inProgress

bool llm_chat::Message::inProgress
read

◆ isUser

bool llm_chat::Message::isUser
read

◆ text

QString llm_chat::Message::text
read

The documentation for this class was generated from the following files: