Skip to content

Commit

Permalink
Remove unused state in chat.cpp that saves the chat response messages. (
Browse files Browse the repository at this point in the history
nomic-ai#3169)

Signed-off-by: Adam Treat <[email protected]>
  • Loading branch information
manyoso authored Nov 5, 2024
1 parent 20a99d1 commit 46cb6b0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
10 changes: 1 addition & 9 deletions gpt4all-chat/src/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ void Chat::stopGenerating()
m_llmodel->stopGenerating();
}

QString Chat::response() const
{
return m_response;
}

Chat::ResponseState Chat::responseState() const
{
return m_responseState;
Expand All @@ -203,10 +198,8 @@ void Chat::handleResponseChanged(const QString &response)
emit responseStateChanged();
}

m_response = response;
const int index = m_chatModel->count() - 1;
m_chatModel->updateValue(index, this->response());
emit responseChanged();
m_chatModel->updateValue(index, response);
}

void Chat::handleModelLoadingPercentageChanged(float loadingPercentage)
Expand Down Expand Up @@ -246,7 +239,6 @@ void Chat::responseStopped(qint64 promptResponseMs)
{
m_tokenSpeed = QString();
emit tokenSpeedChanged();
emit responseChanged();

m_responseInProgress = false;
m_responseState = Chat::ResponseStopped;
Expand Down
4 changes: 0 additions & 4 deletions gpt4all-chat/src/chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Chat : public QObject
Q_PROPERTY(bool isModelLoaded READ isModelLoaded NOTIFY isModelLoadedChanged)
Q_PROPERTY(bool isCurrentlyLoading READ isCurrentlyLoading NOTIFY isCurrentlyLoadingChanged)
Q_PROPERTY(float modelLoadingPercentage READ modelLoadingPercentage NOTIFY modelLoadingPercentageChanged)
Q_PROPERTY(QString response READ response NOTIFY responseChanged)
Q_PROPERTY(ModelInfo modelInfo READ modelInfo WRITE setModelInfo NOTIFY modelInfoChanged)
Q_PROPERTY(bool responseInProgress READ responseInProgress NOTIFY responseInProgressChanged)
Q_PROPERTY(bool restoringFromText READ restoringFromText NOTIFY restoringFromTextChanged)
Expand Down Expand Up @@ -89,7 +88,6 @@ class Chat : public QObject

QList<ResultInfo> databaseResults() const { return m_databaseResults; }

QString response() const;
bool responseInProgress() const { return m_responseInProgress; }
ResponseState responseState() const;
ModelInfo modelInfo() const;
Expand Down Expand Up @@ -143,7 +141,6 @@ public Q_SLOTS:
void isCurrentlyLoadingChanged();
void modelLoadingPercentageChanged();
void modelLoadingWarning(const QString &warning);
void responseChanged();
void responseInProgressChanged();
void responseStateChanged();
void promptRequested(const QList<QString> &collectionList, const QString &prompt);
Expand Down Expand Up @@ -195,7 +192,6 @@ private Q_SLOTS:
QString m_tokenSpeed;
QString m_device;
QString m_fallbackReason;
QString m_response;
QList<QString> m_collections;
QList<QString> m_generatedQuestions;
ChatModel *m_chatModel;
Expand Down

0 comments on commit 46cb6b0

Please sign in to comment.