mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-05-30 02:49:12 -04:00
feat: Add session layout
This commit is contained in:
49
sources/Session/ConversationHistory.hpp
Normal file
49
sources/Session/ConversationHistory.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
// 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
|
||||
Reference in New Issue
Block a user