Bump the version and save up to an order of magnitude of disk space for chat files.

This commit is contained in:
Adam Treat 2023-05-05 20:11:24 -04:00
parent 8d2c8c8cb0
commit e397fda250
2 changed files with 6 additions and 3 deletions

View File

@ -14,7 +14,7 @@ endif()
set(APP_VERSION_MAJOR 2) set(APP_VERSION_MAJOR 2)
set(APP_VERSION_MINOR 4) set(APP_VERSION_MINOR 4)
set(APP_VERSION_PATCH 0) set(APP_VERSION_PATCH 1)
set(APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}") set(APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}")
# Generate a header file with the version number # Generate a header file with the version number

View File

@ -365,7 +365,8 @@ bool ChatLLM::serialize(QDataStream &stream)
stream << quint64(m_ctx.tokens.size()); stream << quint64(m_ctx.tokens.size());
stream.writeRawData(reinterpret_cast<const char*>(m_ctx.tokens.data()), m_ctx.tokens.size() * sizeof(int)); stream.writeRawData(reinterpret_cast<const char*>(m_ctx.tokens.data()), m_ctx.tokens.size() * sizeof(int));
saveState(); saveState();
stream << m_state; QByteArray compressed = qCompress(m_state);
stream << compressed;
return stream.status() == QDataStream::Ok; return stream.status() == QDataStream::Ok;
} }
@ -388,7 +389,9 @@ bool ChatLLM::deserialize(QDataStream &stream)
stream >> tokensSize; stream >> tokensSize;
m_ctx.tokens.resize(tokensSize); m_ctx.tokens.resize(tokensSize);
stream.readRawData(reinterpret_cast<char*>(m_ctx.tokens.data()), tokensSize * sizeof(int)); stream.readRawData(reinterpret_cast<char*>(m_ctx.tokens.data()), tokensSize * sizeof(int));
stream >> m_state; QByteArray compressed;
stream >> compressed;
m_state = qUncompress(compressed);
return stream.status() == QDataStream::Ok; return stream.status() == QDataStream::Ok;
} }