llmodel: constify LLModel::threadCount()

This commit is contained in:
Juuso Alasuutari 2023-05-21 23:45:29 +03:00 committed by AT
parent efd39b0d73
commit 81fdc28e58
9 changed files with 12 additions and 9 deletions

View File

@ -867,7 +867,8 @@ void GPTJ::setThreadCount(int32_t n_threads) {
d_ptr->n_threads = n_threads; d_ptr->n_threads = n_threads;
} }
int32_t GPTJ::threadCount() { int32_t GPTJ::threadCount() const
{
return d_ptr->n_threads; return d_ptr->n_threads;
} }

View File

@ -23,7 +23,7 @@ public:
std::function<bool(bool)> recalculateCallback, std::function<bool(bool)> recalculateCallback,
PromptContext &ctx) override; PromptContext &ctx) override;
void setThreadCount(int32_t n_threads) override; void setThreadCount(int32_t n_threads) override;
int32_t threadCount() override; int32_t threadCount() const override;
protected: protected:
void recalculateContext(PromptContext &promptCtx, void recalculateContext(PromptContext &promptCtx,

View File

@ -75,7 +75,8 @@ void LLamaModel::setThreadCount(int32_t n_threads) {
d_ptr->n_threads = n_threads; d_ptr->n_threads = n_threads;
} }
int32_t LLamaModel::threadCount() { int32_t LLamaModel::threadCount() const
{
return d_ptr->n_threads; return d_ptr->n_threads;
} }

View File

@ -23,7 +23,7 @@ public:
std::function<bool(bool)> recalculateCallback, std::function<bool(bool)> recalculateCallback,
PromptContext &ctx) override; PromptContext &ctx) override;
void setThreadCount(int32_t n_threads) override; void setThreadCount(int32_t n_threads) override;
int32_t threadCount() override; int32_t threadCount() const override;
protected: protected:
void recalculateContext(PromptContext &promptCtx, void recalculateContext(PromptContext &promptCtx,

View File

@ -37,7 +37,7 @@ public:
std::function<bool(bool)> recalculateCallback, std::function<bool(bool)> recalculateCallback,
PromptContext &ctx) = 0; PromptContext &ctx) = 0;
virtual void setThreadCount(int32_t n_threads) {} virtual void setThreadCount(int32_t n_threads) {}
virtual int32_t threadCount() { return 1; } virtual int32_t threadCount() const { return 1; }
protected: protected:
virtual void recalculateContext(PromptContext &promptCtx, virtual void recalculateContext(PromptContext &promptCtx,

View File

@ -792,7 +792,8 @@ void MPT::setThreadCount(int32_t n_threads) {
d_ptr->n_threads = n_threads; d_ptr->n_threads = n_threads;
} }
int32_t MPT::threadCount() { int32_t MPT::threadCount() const
{
return d_ptr->n_threads; return d_ptr->n_threads;
} }

View File

@ -23,7 +23,7 @@ public:
std::function<bool(bool)> recalculateCallback, std::function<bool(bool)> recalculateCallback,
PromptContext &ctx) override; PromptContext &ctx) override;
void setThreadCount(int32_t n_threads) override; void setThreadCount(int32_t n_threads) override;
int32_t threadCount() override; int32_t threadCount() const override;
protected: protected:
void recalculateContext(PromptContext &promptCtx, void recalculateContext(PromptContext &promptCtx,

View File

@ -32,7 +32,7 @@ void ChatGPT::setThreadCount(int32_t n_threads)
qt_noop(); qt_noop();
} }
int32_t ChatGPT::threadCount() int32_t ChatGPT::threadCount() const
{ {
return 1; return 1;
} }

View File

@ -25,7 +25,7 @@ public:
std::function<bool(bool)> recalculateCallback, std::function<bool(bool)> recalculateCallback,
PromptContext &ctx) override; PromptContext &ctx) override;
void setThreadCount(int32_t n_threads) override; void setThreadCount(int32_t n_threads) override;
int32_t threadCount() override; int32_t threadCount() const override;
void setModelName(const QString &modelName) { m_modelName = modelName; } void setModelName(const QString &modelName) { m_modelName = modelName; }
void setAPIKey(const QString &apiKey) { m_apiKey = apiKey; } void setAPIKey(const QString &apiKey) { m_apiKey = apiKey; }