mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-07 19:40:21 +00:00
localdocs: small but important fixes to local docs (#2236)
* chat: use .rmodel extension for Nomic Embed Signed-off-by: Jared Van Bortel <jared@nomic.ai> * database: fix order of SQL arguments in updateDocument Signed-off-by: Jared Van Bortel <jared@nomic.ai> --------- Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
@@ -42,12 +42,17 @@ bool EmbeddingLLMWorker::loadModel()
|
||||
}
|
||||
|
||||
auto filename = fileInfo.fileName();
|
||||
bool isNomic = filename.startsWith("nomic-") && filename.endsWith(".txt");
|
||||
bool isNomic = filename.startsWith("gpt4all-nomic-") && filename.endsWith(".rmodel");
|
||||
if (isNomic) {
|
||||
QFile file(filePath);
|
||||
file.open(QIODeviceBase::ReadOnly | QIODeviceBase::Text);
|
||||
QTextStream stream(&file);
|
||||
m_nomicAPIKey = stream.readAll();
|
||||
if (!file.open(QIODeviceBase::ReadOnly)) {
|
||||
qWarning() << "failed to open" << filePath << ":" << file.errorString();
|
||||
m_model = nullptr;
|
||||
return false;
|
||||
}
|
||||
QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
|
||||
QJsonObject obj = doc.object();
|
||||
m_nomicAPIKey = obj["apiKey"].toString();
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user