fix: restore lost changes
C++ / fmt (pull_request) Failing after 3s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 7s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 25s
Rust / build (pull_request) Successful in 50s
Rust / fmt (pull_request) Successful in 30s
Python / verify (pull_request) Successful in 1m44s
Rust / clippy (pull_request) Successful in 45s
C++ / fmt (pull_request) Failing after 3s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 7s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 25s
Rust / build (pull_request) Successful in 50s
Rust / fmt (pull_request) Successful in 30s
Python / verify (pull_request) Successful in 1m44s
Rust / clippy (pull_request) Successful in 45s
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
#include "chat.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "filetool.hpp"
|
||||
#include "llm.hpp"
|
||||
#include "llmclient.hpp"
|
||||
#include "shelltool.hpp"
|
||||
#include "webfetchtool.hpp"
|
||||
|
||||
#include "config/rootnodes.hpp"
|
||||
#include "config/llm.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace ZShell::llm {
|
||||
@@ -15,14 +16,12 @@ Chat::Chat(QObject* parent)
|
||||
: 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()));
|
||||
m_client->tools()->registerTool(new FileReadTool(m_client->tools()));
|
||||
m_client->tools()->registerTool(new ShellTool(m_client, m_client->tools()));
|
||||
|
||||
const auto* llm = config::Config::instance()->llm();
|
||||
const auto* llm = config::ConfigSingleton::instance()->llm();
|
||||
m_client->setEndpoint(llm->endpoint());
|
||||
m_client->setModel(llm->model());
|
||||
m_client->setTemperature(llm->temperature());
|
||||
@@ -144,7 +143,7 @@ bool Chat::toolsEnabled() const {
|
||||
|
||||
void Chat::setToolsEnabled(bool value) {
|
||||
m_client->setToolsEnabled(value);
|
||||
if (auto* config = config::Config::instance())
|
||||
if (auto* config = config::ConfigSingleton::instance())
|
||||
config->llm()->set_tools(value);
|
||||
}
|
||||
|
||||
@@ -154,7 +153,7 @@ bool Chat::sandboxEnabled() const {
|
||||
|
||||
void Chat::setSandboxEnabled(bool value) {
|
||||
m_client->setSandboxEnabled(value);
|
||||
if (auto* config = config::Config::instance())
|
||||
if (auto* config = config::ConfigSingleton::instance())
|
||||
config->llm()->set_sandbox(value);
|
||||
}
|
||||
|
||||
@@ -195,7 +194,8 @@ void Chat::refreshFromServer() {
|
||||
void Chat::selectModel(const QString& id) {
|
||||
if (id.isEmpty()) return;
|
||||
m_client->setModel(id);
|
||||
if (auto* config = config::Config::instance()) config->llm()->set_model(id);
|
||||
if (auto* config = config::ConfigSingleton::instance())
|
||||
config->llm()->set_model(id);
|
||||
}
|
||||
|
||||
} // namespace ZShell::llm
|
||||
|
||||
Reference in New Issue
Block a user