We can't return early here as nChunks > 0 (#3137)

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
AT 2024-10-28 11:42:25 -04:00 committed by GitHub
parent 57c0974f4a
commit da00527101
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 4 deletions

View File

@ -12,6 +12,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Changed
- Implement Qt 6.8 compatibility ([#3121](https://github.com/nomic-ai/gpt4all/pull/3121))
### Fixed
- Fix bug in GUI when localdocs encounters binary data ([#3137](https://github.com/nomic-ai/gpt4all/pull/3137))
## [3.4.2] - 2024-10-16
### Fixed

View File

@ -1355,7 +1355,8 @@ ChunkStreamer::Status ChunkStreamer::step()
for (;;) {
if (auto error = m_reader->getError()) {
m_docKey.reset(); // done processing
return *error;
retval = *error;
break;
}
// get a word, if needed
@ -1515,8 +1516,22 @@ void Database::handleEmbeddingsGenerated(const QVector<EmbeddingResult> &embeddi
for (const auto &[key, stat]: std::as_const(stats).asKeyValueRange()) {
if (!m_collectionMap.contains(key.folder_id)) continue;
CollectionItem item = guiCollectionItem(key.folder_id);
Q_ASSERT(item.currentEmbeddingsToIndex >= stat.nAdded + stat.nSkipped);
if (item.currentEmbeddingsToIndex < stat.nAdded + stat.nSkipped) {
qWarning() << "Database ERROR: underflow in current embeddings to index statistics";
item.currentEmbeddingsToIndex = 0;
} else {
item.currentEmbeddingsToIndex -= stat.nAdded + stat.nSkipped;
}
Q_ASSERT(item.totalEmbeddingsToIndex >= stat.nSkipped);
if (item.totalEmbeddingsToIndex < stat.nSkipped) {
qWarning() << "Database ERROR: underflow in total embeddings to index statistics";
item.totalEmbeddingsToIndex = 0;
} else {
item.totalEmbeddingsToIndex -= stat.nSkipped;
}
if (!stat.lastFile.isNull())
item.fileCurrentlyProcessing = stat.lastFile;
@ -1746,7 +1761,13 @@ void Database::scanQueue()
dequeue:
auto item = guiCollectionItem(folder_id);
Q_ASSERT(item.currentBytesToIndex >= info.file.size());
if (item.currentBytesToIndex < info.file.size()) {
qWarning() << "Database ERROR: underflow in current bytes to index statistics";
item.currentBytesToIndex = 0;
} else {
item.currentBytesToIndex -= info.file.size();
}
updateGuiForCollectionItem(item);
return updateFolderToIndex(folder_id, countForFolder);
}