chore: format llm c files
C++ / fmt (pull_request) Failing after 4s
C++ / build (pull_request) Failing after 9s
JS/TS / lint (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 16s
C++ / clang-tidy (pull_request) Failing after 43s
Python / static (pull_request) Failing after 57s
Rust / fmt (pull_request) Successful in 1m30s
Rust / build (pull_request) Successful in 2m5s
Rust / clippy (pull_request) Successful in 1m55s
Python / verify (pull_request) Successful in 2m23s
C++ / fmt (pull_request) Failing after 4s
C++ / build (pull_request) Failing after 9s
JS/TS / lint (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 16s
C++ / clang-tidy (pull_request) Failing after 43s
Python / static (pull_request) Failing after 57s
Rust / fmt (pull_request) Successful in 1m30s
Rust / build (pull_request) Successful in 2m5s
Rust / clippy (pull_request) Successful in 1m55s
Python / verify (pull_request) Successful in 2m23s
This commit is contained in:
@@ -16,13 +16,12 @@ ChatSession* sessionOf(const ChatMessage* message) {
|
||||
} // namespace
|
||||
|
||||
ChatMessage::ChatMessage(Role role, qint64 timestamp, QObject* parent)
|
||||
: QObject(parent), m_role(role), m_timestamp(timestamp) {}
|
||||
: QObject(parent), m_role(role), m_timestamp(timestamp) {}
|
||||
|
||||
ChatGeneration* ChatMessage::addGeneration(qint64 timestamp) {
|
||||
auto* generation = new ChatGeneration(timestamp, this);
|
||||
m_generations.append(generation);
|
||||
if (m_active < 0)
|
||||
m_active = static_cast<int>(m_generations.size() - 1);
|
||||
if (m_active < 0) m_active = static_cast<int>(m_generations.size() - 1);
|
||||
Q_EMIT generationsChanged();
|
||||
return generation;
|
||||
}
|
||||
@@ -35,8 +34,7 @@ ChatGeneration* ChatMessage::appendGeneration(qint64 timestamp) {
|
||||
|
||||
void ChatMessage::removeGeneration(ChatGeneration* generation) {
|
||||
const int index = static_cast<int>(m_generations.indexOf(generation));
|
||||
if (index < 0)
|
||||
return;
|
||||
if (index < 0) return;
|
||||
const bool wasActive = index == m_active;
|
||||
m_generations.removeAt(index);
|
||||
delete generation;
|
||||
@@ -46,13 +44,11 @@ void ChatMessage::removeGeneration(ChatGeneration* generation) {
|
||||
m_active = static_cast<int>(m_generations.size() - 1);
|
||||
}
|
||||
Q_EMIT generationsChanged();
|
||||
if (wasActive)
|
||||
Q_EMIT activeGenerationChanged();
|
||||
if (wasActive) Q_EMIT activeGenerationChanged();
|
||||
}
|
||||
|
||||
void ChatMessage::setActiveInternal(int index) {
|
||||
if (index < 0 || index >= m_generations.size() || index == m_active)
|
||||
return;
|
||||
if (index < 0 || index >= m_generations.size() || index == m_active) return;
|
||||
m_active = index;
|
||||
Q_EMIT activeGenerationChanged();
|
||||
}
|
||||
@@ -64,18 +60,15 @@ void ChatMessage::setActiveGeneration(int index) {
|
||||
void ChatMessage::edit(const QString& newContent) {
|
||||
if (auto* generation = activeGeneration())
|
||||
generation->setContent(newContent);
|
||||
if (auto* session = sessionOf(this))
|
||||
session->persist();
|
||||
if (auto* session = sessionOf(this)) session->persist();
|
||||
}
|
||||
|
||||
void ChatMessage::retry() {
|
||||
if (auto* session = sessionOf(this))
|
||||
session->retry(this);
|
||||
if (auto* session = sessionOf(this)) session->retry(this);
|
||||
}
|
||||
|
||||
void ChatMessage::generate() {
|
||||
if (auto* session = sessionOf(this))
|
||||
session->continueFrom(this);
|
||||
if (auto* session = sessionOf(this)) session->continueFrom(this);
|
||||
}
|
||||
|
||||
} // namespace ZShell::llm
|
||||
|
||||
Reference in New Issue
Block a user