mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-08-13 13:46:08 +00:00
Remove unused state from chatitems. (#3170)
I've verified that the code code compiles and I can't see any errors in runtime QML generation nor can I see any references to this in QML. Jared has also done a git search and can find no evidence this was ever used. Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
parent
46cb6b0523
commit
3320094d29
@ -60,7 +60,6 @@ Q_DECLARE_METATYPE(PromptAttachment)
|
|||||||
struct ChatItem
|
struct ChatItem
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_PROPERTY(int id MEMBER id)
|
|
||||||
Q_PROPERTY(QString name MEMBER name)
|
Q_PROPERTY(QString name MEMBER name)
|
||||||
Q_PROPERTY(QString value MEMBER value)
|
Q_PROPERTY(QString value MEMBER value)
|
||||||
Q_PROPERTY(QString newResponse MEMBER newResponse)
|
Q_PROPERTY(QString newResponse MEMBER newResponse)
|
||||||
@ -87,7 +86,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Maybe we should include the model name here as well as timestamp?
|
// TODO: Maybe we should include the model name here as well as timestamp?
|
||||||
int id = 0;
|
|
||||||
QString name;
|
QString name;
|
||||||
QString value;
|
QString value;
|
||||||
QString newResponse;
|
QString newResponse;
|
||||||
@ -112,8 +110,7 @@ public:
|
|||||||
explicit ChatModel(QObject *parent = nullptr) : QAbstractListModel(parent) {}
|
explicit ChatModel(QObject *parent = nullptr) : QAbstractListModel(parent) {}
|
||||||
|
|
||||||
enum Roles {
|
enum Roles {
|
||||||
IdRole = Qt::UserRole + 1,
|
NameRole = Qt::UserRole + 1,
|
||||||
NameRole,
|
|
||||||
ValueRole,
|
ValueRole,
|
||||||
NewResponseRole,
|
NewResponseRole,
|
||||||
CurrentResponseRole,
|
CurrentResponseRole,
|
||||||
@ -140,8 +137,6 @@ public:
|
|||||||
|
|
||||||
const ChatItem &item = m_chatItems.at(index.row());
|
const ChatItem &item = m_chatItems.at(index.row());
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case IdRole:
|
|
||||||
return item.id;
|
|
||||||
case NameRole:
|
case NameRole:
|
||||||
return item.name;
|
return item.name;
|
||||||
case ValueRole:
|
case ValueRole:
|
||||||
@ -170,7 +165,6 @@ public:
|
|||||||
QHash<int, QByteArray> roleNames() const override
|
QHash<int, QByteArray> roleNames() const override
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
roles[IdRole] = "id";
|
|
||||||
roles[NameRole] = "name";
|
roles[NameRole] = "name";
|
||||||
roles[ValueRole] = "value";
|
roles[ValueRole] = "value";
|
||||||
roles[NewResponseRole] = "newResponse";
|
roles[NewResponseRole] = "newResponse";
|
||||||
@ -209,7 +203,6 @@ public:
|
|||||||
const int count = m_chatItems.count();
|
const int count = m_chatItems.count();
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
ChatItem item;
|
ChatItem item;
|
||||||
item.id = count; // This is only relevant for responses
|
|
||||||
item.name = name;
|
item.name = name;
|
||||||
item.currentResponse = true;
|
item.currentResponse = true;
|
||||||
beginInsertRows(QModelIndex(), count, count);
|
beginInsertRows(QModelIndex(), count, count);
|
||||||
@ -383,7 +376,10 @@ public:
|
|||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
stream << int(m_chatItems.size());
|
stream << int(m_chatItems.size());
|
||||||
for (const auto &c : m_chatItems) {
|
for (const auto &c : m_chatItems) {
|
||||||
stream << c.id;
|
// FIXME: This 'id' should be eliminated the next time we bump serialization version.
|
||||||
|
// (Jared) This was apparently never used.
|
||||||
|
int id = 0;
|
||||||
|
stream << id;
|
||||||
stream << c.name;
|
stream << c.name;
|
||||||
stream << c.value;
|
stream << c.value;
|
||||||
stream << c.newResponse;
|
stream << c.newResponse;
|
||||||
@ -460,7 +456,9 @@ public:
|
|||||||
stream >> size;
|
stream >> size;
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
ChatItem c;
|
ChatItem c;
|
||||||
stream >> c.id;
|
// FIXME: see comment in serialization about id
|
||||||
|
int id;
|
||||||
|
stream >> id;
|
||||||
stream >> c.name;
|
stream >> c.name;
|
||||||
stream >> c.value;
|
stream >> c.value;
|
||||||
if (version < 10) {
|
if (version < 10) {
|
||||||
|
Loading…
Reference in New Issue
Block a user