mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-10 01:10:35 +00:00
localdocs: fail fast on bad path, more detailed 'invalid' error (#2679)
Signed-off-by: Cosmic Snow <cosmic-snow@mailfence.com>
This commit is contained in:
parent
88a206ab93
commit
e2ebd1ff04
@ -844,6 +844,10 @@ bool Database::hasContent()
|
||||
|
||||
int Database::openDatabase(const QString &modelPath, bool create, int ver)
|
||||
{
|
||||
if (!QFileInfo(modelPath).isDir()) {
|
||||
qWarning() << "ERROR: invalid download path" << modelPath;
|
||||
return -1;
|
||||
}
|
||||
if (m_db.isOpen())
|
||||
m_db.close();
|
||||
auto dbPath = u"%1/localdocs_v%2.db"_s.arg(modelPath).arg(ver);
|
||||
@ -851,7 +855,7 @@ int Database::openDatabase(const QString &modelPath, bool create, int ver)
|
||||
return 0;
|
||||
m_db.setDatabaseName(dbPath);
|
||||
if (!m_db.open()) {
|
||||
qWarning() << "ERROR: opening db" << m_db.lastError();
|
||||
qWarning() << "ERROR: opening db" << dbPath << m_db.lastError();
|
||||
return -1;
|
||||
}
|
||||
return hasContent();
|
||||
|
@ -82,11 +82,16 @@ Rectangle {
|
||||
visible: !LocalDocs.databaseValid
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
text: qsTr("ERROR: The LocalDocs database is not valid.")
|
||||
text: qsTr("<h3>ERROR: The LocalDocs database cannot be accessed or is not valid.</h3><br>"
|
||||
+ "<i>Note: You will need to restart after trying any of the following suggested fixes.</i><br>"
|
||||
+ "<ul><li>Make sure that the folder set as <b>Download Path</b> exists on the file system.</li>"
|
||||
+ "<li>Check ownership as well as read and write permissions of the <b>Download Path</b>.</li>"
|
||||
+ "<li>If there is a <b>localdocs_v2.db</b> file, check its ownership and read/write "
|
||||
+ "permissions, too.</li></ul><br>"
|
||||
+ "If the problem persists and there are any 'localdocs_v*.db' files present, as a last resort you can<br>"
|
||||
+ "try backing them up and removing them. You will have to recreate your collections, however.")
|
||||
color: theme.textErrorColor
|
||||
font.bold: true
|
||||
font.pixelSize: theme.fontSizeLargest
|
||||
font.pixelSize: theme.fontSizeLarger
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user