mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-10 08:19:25 -04:00
feat: Add transfer timeout settings
This commit is contained in:
@@ -76,6 +76,8 @@ void ChatCompressor::startCompression(const QString &chatFilePath, ChatModel *ch
|
|||||||
const QString customEndpoint = Settings::generalSettings().caCustomEndpoint();
|
const QString customEndpoint = Settings::generalSettings().caCustomEndpoint();
|
||||||
const QString endpoint = !customEndpoint.isEmpty() ? customEndpoint
|
const QString endpoint = !customEndpoint.isEmpty() ? customEndpoint
|
||||||
: promptTemplate->endpoint();
|
: promptTemplate->endpoint();
|
||||||
|
m_provider->client()->setTransferTimeout(
|
||||||
|
static_cast<int>(Settings::generalSettings().requestTimeout() * 1000));
|
||||||
m_currentRequestId = m_provider->sendRequest(
|
m_currentRequestId = m_provider->sendRequest(
|
||||||
QUrl(Settings::generalSettings().caUrl()), payload, endpoint);
|
QUrl(Settings::generalSettings().caUrl()), payload, endpoint);
|
||||||
LOG_MESSAGE(QString("Starting compression request: %1").arg(m_currentRequestId));
|
LOG_MESSAGE(QString("Starting compression request: %1").arg(m_currentRequestId));
|
||||||
|
|||||||
@@ -338,6 +338,9 @@ void ClientInterface::sendMessage(
|
|||||||
provider->client()->setMaxToolContinuations(
|
provider->client()->setMaxToolContinuations(
|
||||||
Settings::toolsSettings().maxToolContinuations());
|
Settings::toolsSettings().maxToolContinuations());
|
||||||
|
|
||||||
|
provider->client()->setTransferTimeout(
|
||||||
|
static_cast<int>(Settings::generalSettings().requestTimeout() * 1000));
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
provider->client(),
|
provider->client(),
|
||||||
&::LLMQore::BaseClient::chunkReceived,
|
&::LLMQore::BaseClient::chunkReceived,
|
||||||
|
|||||||
@@ -354,6 +354,9 @@ void LLMClientInterface::handleCompletion(const QJsonObject &request)
|
|||||||
&LLMClientInterface::handleRequestFailed,
|
&LLMClientInterface::handleRequestFailed,
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
|
|
||||||
|
provider->client()->setTransferTimeout(
|
||||||
|
static_cast<int>(m_generalSettings.requestTimeout() * 1000));
|
||||||
|
|
||||||
auto requestId
|
auto requestId
|
||||||
= provider->sendRequest(QUrl(url), payload, resolveEndpoint(promptTemplate, isPreset1Active));
|
= provider->sendRequest(QUrl(url), payload, resolveEndpoint(promptTemplate, isPreset1Active));
|
||||||
m_activeRequests[requestId] = {request, provider};
|
m_activeRequests[requestId] = {request, provider};
|
||||||
|
|||||||
@@ -144,6 +144,9 @@ void QuickRefactorHandler::prepareAndSendRequest(
|
|||||||
provider->client()->setMaxToolContinuations(
|
provider->client()->setMaxToolContinuations(
|
||||||
Settings::toolsSettings().maxToolContinuations());
|
Settings::toolsSettings().maxToolContinuations());
|
||||||
|
|
||||||
|
provider->client()->setTransferTimeout(
|
||||||
|
static_cast<int>(Settings::generalSettings().requestTimeout() * 1000));
|
||||||
|
|
||||||
m_isRefactoringInProgress = true;
|
m_isRefactoringInProgress = true;
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
|
|||||||
@@ -73,6 +73,17 @@ GeneralSettings::GeneralSettings()
|
|||||||
enableCheckUpdate.setLabelText(TrConstants::ENABLE_CHECK_UPDATE_ON_START);
|
enableCheckUpdate.setLabelText(TrConstants::ENABLE_CHECK_UPDATE_ON_START);
|
||||||
enableCheckUpdate.setDefaultValue(true);
|
enableCheckUpdate.setDefaultValue(true);
|
||||||
|
|
||||||
|
requestTimeout.setSettingsKey(Constants::REQUEST_TIMEOUT);
|
||||||
|
requestTimeout.setLabelText(Tr::tr("Request timeout (seconds):"));
|
||||||
|
requestTimeout.setToolTip(Tr::tr(
|
||||||
|
"Maximum time to wait for the model to send data before a request is aborted. "
|
||||||
|
"Applies to all requests — chat, code completion, quick refactor and chat compression. "
|
||||||
|
"The timer resets every time data is received, so this effectively limits the "
|
||||||
|
"time-to-first-token and any stall between tokens. Increase it for slow or local "
|
||||||
|
"models that need a long time to start responding. Set to 0 to disable the timeout."));
|
||||||
|
requestTimeout.setRange(0, 3600);
|
||||||
|
requestTimeout.setDefaultValue(120);
|
||||||
|
|
||||||
resetToDefaults.m_buttonText = TrConstants::RESET_TO_DEFAULTS;
|
resetToDefaults.m_buttonText = TrConstants::RESET_TO_DEFAULTS;
|
||||||
checkUpdate.m_buttonText = TrConstants::CHECK_UPDATE;
|
checkUpdate.m_buttonText = TrConstants::CHECK_UPDATE;
|
||||||
|
|
||||||
@@ -333,6 +344,10 @@ GeneralSettings::GeneralSettings()
|
|||||||
Row{qrPresetConfig, qrConfigureApiKey, Stretch{1}},
|
Row{qrPresetConfig, qrConfigureApiKey, Stretch{1}},
|
||||||
qrGrid}};
|
qrGrid}};
|
||||||
|
|
||||||
|
auto networkGroup = Group{
|
||||||
|
title(Tr::tr("Network")),
|
||||||
|
Column{Row{requestTimeout, Stretch{1}}}};
|
||||||
|
|
||||||
auto *supportLabel = new QLabel(Tr::tr("Support the development of QodeAssist:"));
|
auto *supportLabel = new QLabel(Tr::tr("Support the development of QodeAssist:"));
|
||||||
|
|
||||||
auto *supportLinks = new QLabel(
|
auto *supportLinks = new QLabel(
|
||||||
@@ -348,12 +363,14 @@ GeneralSettings::GeneralSettings()
|
|||||||
supportLinks->setTextFormat(Qt::RichText);
|
supportLinks->setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
auto rootLayout = Column{
|
auto rootLayout = Column{
|
||||||
Row{supportLabel, supportLinks, Stretch{1}},
|
Row{supportLabel, supportLinks, Stretch{1}, checkUpdate, resetToDefaults},
|
||||||
Space{8},
|
Space{8},
|
||||||
Row{enableQodeAssist, Stretch{1}, Row{checkUpdate, resetToDefaults}},
|
Row{enableQodeAssist, Stretch{1}},
|
||||||
Row{enableLogging, Stretch{1}},
|
Row{enableLogging, Stretch{1}},
|
||||||
Row{enableCheckUpdate, Stretch{1}},
|
Row{enableCheckUpdate, Stretch{1}},
|
||||||
Space{8},
|
Space{8},
|
||||||
|
networkGroup,
|
||||||
|
Space{8},
|
||||||
ccGroup,
|
ccGroup,
|
||||||
Space{8},
|
Space{8},
|
||||||
caGroup,
|
caGroup,
|
||||||
@@ -679,6 +696,7 @@ void GeneralSettings::resetPageToDefaults()
|
|||||||
if (reply == QMessageBox::Yes) {
|
if (reply == QMessageBox::Yes) {
|
||||||
resetAspect(enableQodeAssist);
|
resetAspect(enableQodeAssist);
|
||||||
resetAspect(enableLogging);
|
resetAspect(enableLogging);
|
||||||
|
resetAspect(requestTimeout);
|
||||||
resetAspect(ccProvider);
|
resetAspect(ccProvider);
|
||||||
resetAspect(ccModel);
|
resetAspect(ccModel);
|
||||||
resetAspect(ccTemplate);
|
resetAspect(ccTemplate);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public:
|
|||||||
Utils::BoolAspect enableLogging{this};
|
Utils::BoolAspect enableLogging{this};
|
||||||
Utils::BoolAspect enableCheckUpdate{this};
|
Utils::BoolAspect enableCheckUpdate{this};
|
||||||
|
|
||||||
|
Utils::IntegerAspect requestTimeout{this};
|
||||||
|
|
||||||
ButtonAspect checkUpdate{this};
|
ButtonAspect checkUpdate{this};
|
||||||
ButtonAspect resetToDefaults{this};
|
ButtonAspect resetToDefaults{this};
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ const char CC_SHOW_PROGRESS_WIDGET[] = "QodeAssist.ccShowProgressWidget";
|
|||||||
const char CC_USE_OPEN_FILES_CONTEXT[] = "QodeAssist.ccUseOpenFilesContext";
|
const char CC_USE_OPEN_FILES_CONTEXT[] = "QodeAssist.ccUseOpenFilesContext";
|
||||||
const char ENABLE_LOGGING[] = "QodeAssist.enableLogging";
|
const char ENABLE_LOGGING[] = "QodeAssist.enableLogging";
|
||||||
const char ENABLE_CHECK_UPDATE[] = "QodeAssist.enableCheckUpdate";
|
const char ENABLE_CHECK_UPDATE[] = "QodeAssist.enableCheckUpdate";
|
||||||
|
const char REQUEST_TIMEOUT[] = "QodeAssist.requestTimeout";
|
||||||
|
|
||||||
const char PROVIDER_PATHS[] = "QodeAssist.providerPaths";
|
const char PROVIDER_PATHS[] = "QodeAssist.providerPaths";
|
||||||
const char СС_START_SUGGESTION_TIMER[] = "QodeAssist.startSuggestionTimer";
|
const char СС_START_SUGGESTION_TIMER[] = "QodeAssist.startSuggestionTimer";
|
||||||
|
|||||||
2
sources/external/llmqore
vendored
2
sources/external/llmqore
vendored
Submodule sources/external/llmqore updated: 68ecec3dc9...48e6dfb30d
Reference in New Issue
Block a user