mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-05 02:20:28 +00:00
Start working on more thread safety and model load error handling.
This commit is contained in:
@@ -100,9 +100,9 @@ public:
|
||||
bool deserialize(QDataStream &stream, int version);
|
||||
|
||||
public Q_SLOTS:
|
||||
bool prompt(const QString &prompt, const QString &prompt_template, int32_t n_predict,
|
||||
int32_t top_k, float top_p, float temp, int32_t n_batch, float repeat_penalty, int32_t repeat_penalty_tokens,
|
||||
int32_t n_threads);
|
||||
bool prompt(const QList<QString> &collectionList, const QString &prompt, const QString &prompt_template,
|
||||
int32_t n_predict, int32_t top_k, float top_p, float temp, int32_t n_batch, float repeat_penalty,
|
||||
int32_t repeat_penalty_tokens, int32_t n_threads);
|
||||
bool loadDefaultModel();
|
||||
bool loadModel(const QString &modelName);
|
||||
void modelNameChangeRequested(const QString &modelName);
|
||||
@@ -110,7 +110,8 @@ public Q_SLOTS:
|
||||
void unloadModel();
|
||||
void reloadModel();
|
||||
void generateName();
|
||||
void handleChatIdChanged();
|
||||
void handleChatIdChanged(const QString &id);
|
||||
void handleDefaultModelChanged(const QString &defaultModel);
|
||||
void handleShouldBeLoadedChanged();
|
||||
void handleThreadStarted();
|
||||
|
||||
@@ -143,15 +144,24 @@ protected:
|
||||
void restoreState();
|
||||
|
||||
protected:
|
||||
// The following are all accessed by multiple threads and are thus guarded with thread protection
|
||||
// mechanisms
|
||||
LLModel::PromptContext m_ctx;
|
||||
quint32 m_promptTokens;
|
||||
quint32 m_promptResponseTokens;
|
||||
LLModelInfo m_modelInfo;
|
||||
LLModelType m_modelType;
|
||||
|
||||
private:
|
||||
// The following are all accessed by multiple threads and are thus guarded with thread protection
|
||||
// mechanisms
|
||||
std::string m_response;
|
||||
std::string m_nameResponse;
|
||||
LLModelInfo m_modelInfo;
|
||||
LLModelType m_modelType;
|
||||
QString m_modelName;
|
||||
Chat *m_chat;
|
||||
bool m_isChatGPT;
|
||||
|
||||
// The following are only accessed by this thread
|
||||
QString m_defaultModel;
|
||||
TokenTimer *m_timer;
|
||||
QByteArray m_state;
|
||||
QThread m_llmThread;
|
||||
@@ -159,7 +169,6 @@ protected:
|
||||
std::atomic<bool> m_shouldBeLoaded;
|
||||
std::atomic<bool> m_isRecalc;
|
||||
bool m_isServer;
|
||||
bool m_isChatGPT;
|
||||
};
|
||||
|
||||
#endif // CHATLLM_H
|
||||
|
Reference in New Issue
Block a user