TextAutoGenerateText::TextAutoGenerateMessage Class
class TextAutoGenerateText::TextAutoGenerateMessageThe TextAutoGenerateMessage class Author: Laurent Montel <montel@kde.org>. More...
| Header: | #include <TextAutoGenerateText/TextAutoGenerateMessage> |
Public Types
| enum | MessageState { None, HoverHighlight, Edited, InProgress, TextToSpeechInProgress } |
| flags | MessageStates |
| enum class | Sender { Unknown, User, Assistant, System, Tool } |
| enum class | ToolCallFormat { OpenAI, Ollama } |
Public Functions
| TextAutoGenerateMessage() | |
| ~TextAutoGenerateMessage() | |
| QByteArray | answerUuid() const |
| void | appendToolExchange(const QString &content, const QList<TextAutoGenerateText::TextAutoGenerateReply::ToolCallArgumentInfo> &toolCalls, const QList<QPair<QByteArray, QString>> &results) |
| QString | content() const |
| QList<QJsonObject> | convertToChatJson(bool hasSystemMessageSupport, bool hasTextOnlySupport, TextAutoGenerateText::TextAutoGenerateMessage::ToolCallFormat format) const |
| QJsonObject | convertToOllamaChatJson(bool hasSystemMessageSupport, bool hasTextOnlySupport) const |
| qint64 | dateTime() const |
| QString | dateTimeStr() const |
| bool | editingMode() const |
| QString | engineName() const |
| void | generateHtml(const QString &searchText = {}, int hightLightStringIndex = -1) |
| QString | htmlGenerated() const |
| bool | inProgress() const |
| QString | instanceName() const |
| bool | isValid() const |
| const TextAutoGenerateText::TextAutoGenerateAttachments * | messageAttachments() const |
| const TextAutoGenerateText::TextAutoGenerateAnswerInfo * | messageInfo() const |
| QString | modelName() const |
| bool | mouseHover() const |
| int | numberOfTextSearched() const |
| TextAutoGenerateText::TextAutoGenerateMessage::Sender | sender() const |
| QString | senderToString() const |
| void | setAnswerUuid(const QByteArray &newAnswerUuid) |
| void | setContent(const QString &newContent) |
| void | setDateTime(qint64 newDateTime) |
| void | setEditingMode(bool newEditingMode) |
| void | setInProgress(bool newInProgress) |
| void | setMessageAttachments(const TextAutoGenerateText::TextAutoGenerateAttachments &newMessageAttachment) |
| void | setMessageInfo(const TextAutoGenerateText::TextAutoGenerateAnswerInfo &messageInfo) |
| void | setMouseHover(bool newMouseHover) |
| void | setSender(TextAutoGenerateText::TextAutoGenerateMessage::Sender newSender) |
| void | setTextToSpeechInProgress(bool newTextToSpeechInProgress) |
| void | setUuid(const QByteArray &newUuid) |
| bool | textToSpeechInProgress() const |
| QJsonArray | toolExchange() const |
| QList<QByteArray> | tools() const |
| QByteArray | uuid() const |
| bool | operator==(const TextAutoGenerateText::TextAutoGenerateMessage &other) const |
Static Public Members
| QJsonObject | convertToolExchangeToChatJson(const QJsonObject &obj, TextAutoGenerateText::TextAutoGenerateMessage::ToolCallFormat format) |
| TextAutoGenerateText::TextAutoGenerateMessage | deserialize(const QJsonObject &o) |
| TextAutoGenerateText::TextAutoGenerateMessage::Sender | senderFromString(const QString &str) |
| QByteArray | serialize(const TextAutoGenerateText::TextAutoGenerateMessage &msg, bool toBinary = true) |
| QJsonObject | serializeToJson(const TextAutoGenerateText::TextAutoGenerateMessage &msg) |
Detailed Description
Member Type Documentation
enum TextAutoGenerateMessage::MessageState
flags TextAutoGenerateMessage::MessageStates
The MessageState enum
The MessageStates type is a typedef for QFlags<MessageState>. It stores an OR combination of MessageState values.
enum class TextAutoGenerateMessage::Sender
The Sender enum
enum class TextAutoGenerateMessage::ToolCallFormat
Format of tool calls in messages sent to LLM
Member Function Documentation
TextAutoGenerateMessage::TextAutoGenerateMessage()
Constructs a new TextAutoGenerateMessage object.
[noexcept] TextAutoGenerateMessage::~TextAutoGenerateMessage()
Destroys the TextAutoGenerateMessage object.
QByteArray TextAutoGenerateMessage::answerUuid() const
Returns the UUID of the associated answer message. Returns The answer UUID as a QByteArray
See also setAnswerUuid().
void TextAutoGenerateMessage::appendToolExchange(const QString &content, const QList<TextAutoGenerateText::TextAutoGenerateReply::ToolCallArgumentInfo> &toolCalls, const QList<QPair<QByteArray, QString>> &results)
Add tool calls requested by LLM (with text content sent before them) and their results.
QString TextAutoGenerateMessage::content() const
Returns the content of the message. Returns The message content as a QString
See also setContent().
QList<QJsonObject> TextAutoGenerateMessage::convertToChatJson(bool hasSystemMessageSupport, bool hasTextOnlySupport, TextAutoGenerateText::TextAutoGenerateMessage::ToolCallFormat format) const
Convert message (tool exchange and content) to messages sent to LLM.
QJsonObject TextAutoGenerateMessage::convertToOllamaChatJson(bool hasSystemMessageSupport, bool hasTextOnlySupport) const
Converts the message to Ollama chat JSON format. Returns The message as a QJsonObject in Ollama chat format
[static] QJsonObject TextAutoGenerateMessage::convertToolExchangeToChatJson(const QJsonObject &obj, TextAutoGenerateText::TextAutoGenerateMessage::ToolCallFormat format)
Convert an element of tool exchange to a message for LLM using format
qint64 TextAutoGenerateMessage::dateTime() const
Returns the date and time of the message. Returns The date/time as a 64-bit integer timestamp
See also setDateTime().
QString TextAutoGenerateMessage::dateTimeStr() const
Returns the date and time as a formatted string. Returns The formatted date/time as a QString
[static] TextAutoGenerateText::TextAutoGenerateMessage TextAutoGenerateMessage::deserialize(const QJsonObject &o)
Deserializes a TextAutoGenerateMessage object from JSON. o The JSON object to deserialize from Returns The deserialized TextAutoGenerateMessage
bool TextAutoGenerateMessage::editingMode() const
Returns whether the message is in editing mode. Returns true if in editing mode, false otherwise
See also setEditingMode().
QString TextAutoGenerateMessage::engineName() const
Returns the name of the engine used for this message. Returns The engine name as a QString
void TextAutoGenerateMessage::generateHtml(const QString &searchText = {}, int hightLightStringIndex = -1)
Generates HTML representation of the message with optional search text highlighting. searchText Optional text to search for and highlight hightLightStringIndex The index of the highlight position
QString TextAutoGenerateMessage::htmlGenerated() const
Returns the generated HTML representation of the message. Returns The HTML content as a QString
bool TextAutoGenerateMessage::inProgress() const
Returns whether the message is currently being processed. Returns true if in progress, false otherwise
See also setInProgress().
QString TextAutoGenerateMessage::instanceName() const
Returns the name of the instance used for this message. Returns The instance name as a QString
bool TextAutoGenerateMessage::isValid() const
Returns whether the message is valid. Returns true if the message is valid, false otherwise
const TextAutoGenerateText::TextAutoGenerateAttachments *TextAutoGenerateMessage::messageAttachments() const
Returns the attachments for this message. Returns A pointer to the TextAutoGenerateAttachments
See also setMessageAttachments().
const TextAutoGenerateText::TextAutoGenerateAnswerInfo *TextAutoGenerateMessage::messageInfo() const
Returns the answer information for this message. Returns A pointer to the TextAutoGenerateAnswerInfo
See also setMessageInfo().
QString TextAutoGenerateMessage::modelName() const
Returns the name of the model used for this message. Returns The model name as a QString
bool TextAutoGenerateMessage::mouseHover() const
Returns whether the mouse is hovering over the message. Returns true if hovering, false otherwise
See also setMouseHover().
int TextAutoGenerateMessage::numberOfTextSearched() const
Returns the number of text search matches in the message. Returns The number of matches found
TextAutoGenerateText::TextAutoGenerateMessage::Sender TextAutoGenerateMessage::sender() const
Returns the sender type of the message. Returns The Sender enum value
See also setSender().
[static] TextAutoGenerateText::TextAutoGenerateMessage::Sender TextAutoGenerateMessage::senderFromString(const QString &str)
Converts a string representation to a Sender enum value. str The sender string to convert Returns The corresponding Sender enum value
QString TextAutoGenerateMessage::senderToString() const
Converts the sender type to a string representation. Returns The sender type as a QString
[static] QByteArray TextAutoGenerateMessage::serialize(const TextAutoGenerateText::TextAutoGenerateMessage &msg, bool toBinary = true)
Serializes the given TextAutoGenerateMessage object. msg The TextAutoGenerateMessage to serialize toBinary true to serialize to binary format, false for JSON format Returns The serialized data as a QByteArray
[static] QJsonObject TextAutoGenerateMessage::serializeToJson(const TextAutoGenerateText::TextAutoGenerateMessage &msg)
Serializes the given TextAutoGenerateMessage object to a JSON object. msg The TextAutoGenerateMessage to serialize Returns The JSON object
void TextAutoGenerateMessage::setAnswerUuid(const QByteArray &newAnswerUuid)
Sets the UUID of the associated answer message. newAnswerUuid The answer UUID to set
See also answerUuid().
void TextAutoGenerateMessage::setContent(const QString &newContent)
Sets the content of the message. newContent The content to set
See also content().
void TextAutoGenerateMessage::setDateTime(qint64 newDateTime)
Sets the date and time of the message. newDateTime The date/time to set as a 64-bit integer timestamp
See also dateTime().
void TextAutoGenerateMessage::setEditingMode(bool newEditingMode)
Sets the editing mode for the message. newEditingMode true to enable editing mode, false otherwise
See also editingMode().
void TextAutoGenerateMessage::setInProgress(bool newInProgress)
Sets the processing status of the message. newInProgress true if in progress, false otherwise
See also inProgress().
void TextAutoGenerateMessage::setMessageAttachments(const TextAutoGenerateText::TextAutoGenerateAttachments &newMessageAttachment)
Sets the attachments for this message. newMessageAttachment The TextAutoGenerateAttachments to set
See also messageAttachments().
void TextAutoGenerateMessage::setMessageInfo(const TextAutoGenerateText::TextAutoGenerateAnswerInfo &messageInfo)
Sets the answer information for this message. messageInfo The TextAutoGenerateAnswerInfo to set
See also messageInfo().
void TextAutoGenerateMessage::setMouseHover(bool newMouseHover)
Sets the mouse hover state for the message. newMouseHover true if hovering, false otherwise
See also mouseHover().
void TextAutoGenerateMessage::setSender(TextAutoGenerateText::TextAutoGenerateMessage::Sender newSender)
Sets the sender type of the message. newSender The sender type to set
See also sender().
void TextAutoGenerateMessage::setTextToSpeechInProgress(bool newTextToSpeechInProgress)
Sets the text-to-speech synthesis progress status. newTextToSpeechInProgress true if synthesis is in progress, false otherwise
See also textToSpeechInProgress().
void TextAutoGenerateMessage::setUuid(const QByteArray &newUuid)
Sets the unique identifier of the message. newUuid The UUID to set
See also uuid().
bool TextAutoGenerateMessage::textToSpeechInProgress() const
Returns whether text-to-speech synthesis is in progress. Returns true if synthesis is in progress, false otherwise
See also setTextToSpeechInProgress().
QJsonArray TextAutoGenerateMessage::toolExchange() const
Tool calls requested by LLM and their results, before final answer (content). Each element is a message: {"role":"assistant","content","tool_calls":[{"id","name","arguments"}]} or {"role":"tool","tool_call_id","name","content"}.
QList<QByteArray> TextAutoGenerateMessage::tools() const
Returns the list of tools available for this message. Returns A list of tool names as QByteArray
QByteArray TextAutoGenerateMessage::uuid() const
Returns the unique identifier of the message. Returns The message UUID as a QByteArray
See also setUuid().
bool TextAutoGenerateMessage::operator==(const TextAutoGenerateText::TextAutoGenerateMessage &other) const
Compares this TextAutoGenerateMessage with another for equality. other The TextAutoGenerateMessage to compare with Returns true if both messages are equal, false otherwise