mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-25 23:13:06 +00:00
Move this logic to QML.
This commit is contained in:
parent
f5f22fdbd0
commit
f529d55380
@ -142,17 +142,9 @@ QString Chat::response() const
|
|||||||
return m_response;
|
return m_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Chat::responseState() const
|
Chat::ResponseState Chat::responseState() const
|
||||||
{
|
{
|
||||||
switch (m_responseState) {
|
return 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chat::handleResponseChanged(const QString &response)
|
void Chat::handleResponseChanged(const QString &response)
|
||||||
|
@ -21,7 +21,7 @@ class Chat : public QObject
|
|||||||
Q_PROPERTY(bool responseInProgress READ responseInProgress NOTIFY responseInProgressChanged)
|
Q_PROPERTY(bool responseInProgress READ responseInProgress NOTIFY responseInProgressChanged)
|
||||||
Q_PROPERTY(bool isRecalc READ isRecalc NOTIFY recalcChanged)
|
Q_PROPERTY(bool isRecalc READ isRecalc NOTIFY recalcChanged)
|
||||||
Q_PROPERTY(bool isServer READ isServer NOTIFY isServerChanged)
|
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<QString> collectionList READ collectionList NOTIFY collectionListChanged)
|
Q_PROPERTY(QList<QString> collectionList READ collectionList NOTIFY collectionListChanged)
|
||||||
Q_PROPERTY(QString modelLoadingError READ modelLoadingError NOTIFY modelLoadingErrorChanged)
|
Q_PROPERTY(QString modelLoadingError READ modelLoadingError NOTIFY modelLoadingErrorChanged)
|
||||||
Q_PROPERTY(QString tokenSpeed READ tokenSpeed NOTIFY tokenSpeedChanged);
|
Q_PROPERTY(QString tokenSpeed READ tokenSpeed NOTIFY tokenSpeedChanged);
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
QString response() const;
|
QString response() const;
|
||||||
bool responseInProgress() const { return m_responseInProgress; }
|
bool responseInProgress() const { return m_responseInProgress; }
|
||||||
QString responseState() const;
|
ResponseState responseState() const;
|
||||||
ModelInfo modelInfo() const;
|
ModelInfo modelInfo() const;
|
||||||
void setModelInfo(const ModelInfo &modelInfo);
|
void setModelInfo(const ModelInfo &modelInfo);
|
||||||
bool isRecalc() const;
|
bool isRecalc() const;
|
||||||
|
@ -815,8 +815,17 @@ Window {
|
|||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: currentChat.responseState + "..."
|
|
||||||
color: theme.textAccent
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user