mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-05-30 10:59:30 -04:00
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
// Copyright (C) 2024-2026 Petr Mironychev
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <LLMQore/ContentBlocks.hpp>
|
|
|
|
#include <QObject>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "Message.hpp"
|
|
|
|
namespace QodeAssist {
|
|
|
|
class ConversationHistory : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_DISABLE_COPY_MOVE(ConversationHistory)
|
|
public:
|
|
explicit ConversationHistory(QObject *parent = nullptr);
|
|
~ConversationHistory() override;
|
|
|
|
const std::vector<Message> &messages() const noexcept { return m_messages; }
|
|
int size() const noexcept { return static_cast<int>(m_messages.size()); }
|
|
bool isEmpty() const noexcept { return m_messages.empty(); }
|
|
|
|
void append(Message message);
|
|
|
|
void appendBlockToLast(std::unique_ptr<LLMQore::ContentBlock> block);
|
|
|
|
void appendTextDeltaToLast(const QString &delta);
|
|
void appendThinkingDeltaToLast(const QString &delta, const QString &signature = QString());
|
|
|
|
void clear();
|
|
void resetTo(int index);
|
|
|
|
signals:
|
|
void messageAdded(int index);
|
|
void messageUpdated(int index);
|
|
void cleared();
|
|
void reset();
|
|
|
|
private:
|
|
std::vector<Message> m_messages;
|
|
};
|
|
|
|
} // namespace QodeAssist
|