YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ConversationModel Class Reference

The model of the conversation data in the ui. More...

#include </home/runner/work/yarp-documentation/yarp-documentation/yarp/src/guis/yarpllmgui/ConversationModel.h>

+ Inheritance diagram for ConversationModel:

Public Types

enum  ConversationRoles {
  TypeRole = Qt::UserRole + 1 ,
  ContentRole
}
 

Public Slots

void refreshConversation ()
 Deletes and reuploads the conversation.
 

Public Member Functions

 ConversationModel (QObject *parent=nullptr)
 
 ~ConversationModel ()
 
bool configure (const std::string &remote_rpc, const std::string &streaming_port_name)
 Configures the remote rpc and streaming port.
 
QVariant data (const QModelIndex &index, int role) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE void deleteConversation ()
 Deletes the conversation.
 
Q_INVOKABLE void eraseMessage (const int &index)
 
Q_INVOKABLE void sendMessage (const QString &message)
 Sends a message.
 
Q_INVOKABLE void configure (const QString &remote_rpc, const QString &streaming_port_name)
 Configures the rpc and streaming port.
 

Protected Member Functions

QHash< int, QByteArray > roleNames () const override
 

Detailed Description

The model of the conversation data in the ui.

It calls the llm_nwc functions in a way that allows the user to modify the conversation.

It allows the user to modify the configuration from the UI.

It has an inner callback mechanism that refreshes the UI if the conversation is changed outside of it.

Definition at line 59 of file ConversationModel.h.

Member Enumeration Documentation

◆ ConversationRoles

Enumerator
TypeRole 
ContentRole 

Definition at line 64 of file ConversationModel.h.

Constructor & Destructor Documentation

◆ ConversationModel()

ConversationModel::ConversationModel ( QObject *  parent = nullptr)
inlineexplicit

Definition at line 70 of file ConversationModel.h.

◆ ~ConversationModel()

ConversationModel::~ConversationModel ( )
inline

Definition at line 77 of file ConversationModel.h.

Member Function Documentation

◆ configure() [1/2]

void ConversationModel::configure ( const QString &  remote_rpc,
const QString &  streaming_port_name 
)

Configures the rpc and streaming port.

Invokable from the ui.

Parameters
remoteRpcname of the rpc port opened by the llm_nws
remote_streaming_port_namename of the streaming port opened by the llm nws.

Definition at line 71 of file ConversationModel.cpp.

◆ configure() [2/2]

bool ConversationModel::configure ( const std::string &  remote_rpc,
const std::string &  streaming_port_name 
)

Configures the remote rpc and streaming port.

Parameters
remoteRpcname of the rpc port opened by the llm_nws
remote_streaming_port_namename of the streaming port opened by the llm nws. It is used by the model callback.
Returns
True if connection to the port and/or device opening is successful, false otherwise.

Definition at line 46 of file ConversationModel.cpp.

◆ data()

QVariant ConversationModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 76 of file ConversationModel.cpp.

◆ deleteConversation()

void ConversationModel::deleteConversation ( )

Deletes the conversation.

Invokable from the ui.

Definition at line 114 of file ConversationModel.cpp.

◆ eraseMessage()

void ConversationModel::eraseMessage ( const int &  index)

Definition at line 175 of file ConversationModel.cpp.

◆ refreshConversation

void ConversationModel::refreshConversation ( )
slot

Deletes and reuploads the conversation.

This way the data that we keep locally is always fully synchronized with the nws.

Definition at line 125 of file ConversationModel.cpp.

◆ roleNames()

QHash< int, QByteArray > ConversationModel::roleNames ( ) const
overrideprotected

Definition at line 99 of file ConversationModel.cpp.

◆ rowCount()

int ConversationModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 93 of file ConversationModel.cpp.

◆ sendMessage()

void ConversationModel::sendMessage ( const QString &  message)

Sends a message.

Invokable from the ui.

Parameters
message.The message to send

Definition at line 154 of file ConversationModel.cpp.


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