6#ifndef CONVERSATIONMODEL_H
7#define CONVERSATIONMODEL_H
20#include <QAbstractListModel>
71 QAbstractListModel(parent)
73 m_prop.
put(
"device",
"LLM_nwc_yarp");
74 m_prop.
put(
"local", m_local_rpc_port);
79 m_conversation_port.
close();
90 bool configure(
const std::string& remote_rpc,
const std::string& streaming_port_name);
93 QVariant
data(
const QModelIndex& index,
int role)
const override;
94 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
106 Q_INVOKABLE
void sendMessage(
const QString& message);
113 Q_INVOKABLE
void configure(
const QString& remote_rpc,
const QString& streaming_port_name);
124 QHash<int, QByteArray>
roleNames()
const override;
132 QList<Message> m_conversation;
134 const std::string m_conversation_port_name =
"/llmgui/conv:i";
135 const std::string m_local_rpc_port =
"/yarpllmgui/rpc";
136 const std::string m_no_device_message =
"yarpLLMGui: no LLM_nwc was found. Operation is not allowed.";
138 void setRemoteRpc(
const std::string& remoteRpc);
139 bool setRemoteStreamingPort(
const std::string& remote_streaming_port_name);
141 void addMessage(
const Message& message);
142 void eraseConversation();
The model of the conversation data in the ui.
Q_INVOKABLE void sendMessage(const QString &message)
Sends a message.
void refreshConversation()
Deletes and reuploads the conversation.
QVariant data(const QModelIndex &index, int role) const override
Q_INVOKABLE void eraseMessage(const int &index)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
bool configure(const std::string &remote_rpc, const std::string &streaming_port_name)
Configures the remote rpc and streaming port.
ConversationModel(QObject *parent=nullptr)
Q_INVOKABLE void deleteConversation()
Deletes the conversation.
QHash< int, QByteArray > roleNames() const override
Inner class for message representation in ConversationModel.
Message(const QString &type, const QString &content)
A container for a device driver.
bool close() override
Close the DeviceDriver.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
A class for storing options and configuration information.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.