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

This commit is contained in:
2026-08-31 19:02:26 +02:00
parent dbb51ceadd
commit 52feb6006a
27 changed files with 741 additions and 1190 deletions
+13 -18
View File
@@ -10,9 +10,10 @@
namespace ZShell::llm {
Chat::Chat(QObject* parent)
: QObject(parent), m_store(new ChatStore(this)), m_client(new LlmClient(this)) {
if (!config::Config::instance())
new config::Config();
: QObject(parent)
, m_store(new ChatStore(this))
, m_client(new LlmClient(this)) {
if (!config::Config::instance()) new config::Config();
m_store->setLlmClient(m_client);
m_client->tools()->registerTool(new WebFetchTool(m_client->tools()));
@@ -44,10 +45,8 @@ Chat::Chat(QObject* parent)
}
Q_EMIT busyChanged();
});
connect(
m_client, &LlmClient::endpointChanged, this, &Chat::endpointChanged);
connect(
m_client, &LlmClient::modelChanged, this, &Chat::modelChanged);
connect(m_client, &LlmClient::endpointChanged, this, &Chat::endpointChanged);
connect(m_client, &LlmClient::modelChanged, this, &Chat::modelChanged);
connect(
m_client,
&LlmClient::availableModelsChanged,
@@ -88,7 +87,7 @@ Chat::Chat(QObject* parent)
this,
[this](ChatSession* session, const QString& title) {
qInfo() << "Chat: applying generated title" << session->id()
<< title << "(was" << session->title() << ")";
<< title << "(was" << session->title() << ")";
session->setTitle(title);
m_store->saveMeta(session);
});
@@ -97,8 +96,8 @@ Chat::Chat(QObject* parent)
&LlmClient::iconSuggested,
this,
[this](ChatSession* session, const QString& icon) {
qInfo() << "Chat: applying generated icon" << session->id()
<< icon << "(was" << session->icon() << ")";
qInfo() << "Chat: applying generated icon" << session->id() << icon
<< "(was" << session->icon() << ")";
session->setIcon(icon);
m_store->saveMeta(session);
});
@@ -141,8 +140,7 @@ QString Chat::streamingChatId() const {
Chat* Chat::s_instance = nullptr;
Chat* Chat::create(QQmlEngine*, QJSEngine*) {
if (!s_instance)
s_instance = new Chat();
if (!s_instance) s_instance = new Chat();
return s_instance;
}
@@ -151,8 +149,7 @@ void Chat::stop() {
}
void Chat::dismissError() {
if (m_lastError.isEmpty())
return;
if (m_lastError.isEmpty()) return;
m_lastError.clear();
Q_EMIT lastErrorChanged();
}
@@ -162,11 +159,9 @@ void Chat::refreshModels() {
}
void Chat::selectModel(const QString& id) {
if (id.isEmpty())
return;
if (id.isEmpty()) return;
m_client->setModel(id);
if (auto* config = config::Config::instance())
config->llm()->set_model(id);
if (auto* config = config::Config::instance()) config->llm()->set_model(id);
}
} // namespace ZShell::llm