Skip to content

Commit

Permalink
remove duplicated logic with different magic constant
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Van Bortel <[email protected]>
  • Loading branch information
cebtenzzre committed Nov 7, 2024
1 parent bc256ff commit 161ae9c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions gpt4all-chat/src/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,8 @@ void Chat::trySwitchContextOfLoadedModel()

void Chat::generatedNameChanged(const QString &name)
{
// Only use the first three words maximum and remove newlines and extra spaces
m_generatedName = name.simplified();
QStringList words = m_generatedName.split(' ', Qt::SkipEmptyParts);
int wordCount = qMin(7, words.size());
m_name = words.mid(0, wordCount).join(' ');
m_generatedName = name;
m_name = name;
emit nameChanged();
m_needsSave = true;
}
Expand Down

0 comments on commit 161ae9c

Please sign in to comment.