diff --git a/gpt4all-chat/chat.cpp b/gpt4all-chat/chat.cpp index 28cbb143..453f17f0 100644 --- a/gpt4all-chat/chat.cpp +++ b/gpt4all-chat/chat.cpp @@ -142,17 +142,9 @@ QString Chat::response() const return m_response; } -QString Chat::responseState() const +Chat::ResponseState Chat::responseState() const { - switch (m_responseState) { - case ResponseStopped: return QStringLiteral("response stopped"); - case LocalDocsRetrieval: return QStringLiteral("retrieving ") + m_collections.join(", "); - case LocalDocsProcessing: return QStringLiteral("processing ") + m_collections.join(", "); - case PromptProcessing: return QStringLiteral("processing"); - case ResponseGeneration: return QStringLiteral("generating response"); - }; - Q_UNREACHABLE(); - return QString(); + return m_responseState; } void Chat::handleResponseChanged(const QString &response) diff --git a/gpt4all-chat/chat.h b/gpt4all-chat/chat.h index 45aa1816..f13747dd 100644 --- a/gpt4all-chat/chat.h +++ b/gpt4all-chat/chat.h @@ -21,7 +21,7 @@ class Chat : public QObject Q_PROPERTY(bool responseInProgress READ responseInProgress NOTIFY responseInProgressChanged) Q_PROPERTY(bool isRecalc READ isRecalc NOTIFY recalcChanged) Q_PROPERTY(bool isServer READ isServer NOTIFY isServerChanged) - Q_PROPERTY(QString responseState READ responseState NOTIFY responseStateChanged) + Q_PROPERTY(ResponseState responseState READ responseState NOTIFY responseStateChanged) Q_PROPERTY(QList collectionList READ collectionList NOTIFY collectionListChanged) Q_PROPERTY(QString modelLoadingError READ modelLoadingError NOTIFY modelLoadingErrorChanged) Q_PROPERTY(QString tokenSpeed READ tokenSpeed NOTIFY tokenSpeedChanged); @@ -68,7 +68,7 @@ public: QString response() const; bool responseInProgress() const { return m_responseInProgress; } - QString responseState() const; + ResponseState responseState() const; ModelInfo modelInfo() const; void setModelInfo(const ModelInfo &modelInfo); bool isRecalc() const; diff --git a/gpt4all-chat/main.qml b/gpt4all-chat/main.qml index 898c388d..fceee50a 100644 --- a/gpt4all-chat/main.qml +++ b/gpt4all-chat/main.qml @@ -815,8 +815,17 @@ Window { } Label { anchors.verticalCenter: parent.verticalCenter - text: currentChat.responseState + "..." color: theme.textAccent + text: { + switch (currentChat.responseState) { + case Chat.ResponseStopped: return "response stopped ..."; + case Chat.LocalDocsRetrieval: return "retrieving " + currentChat.collectionList.join(", ") + " ..."; + case Chat.LocalDocsProcessing: return "processing " + currentChat.collectionList.join(", ") + " ..."; + case Chat.PromptProcessing: return "processing ..." + case Chat.ResponseGeneration: return "generating response ..."; + default: return ""; // handle unexpected values + } + } } } }