@@ -258,6 +258,7 @@ bool ChatMessage::eventFilter(QObject *obj, QEvent *event)
258258void ChatMessage::renderMarkdown (const QString &text)
259259{
260260 if (m_thoughtToggle) {
261+ bool isThinking = false ;
261262 if (m_thoughtToggle->isChecked ()) {
262263 QString message = text;
263264 message.replace (thinkingToken, " >" );
@@ -269,6 +270,7 @@ void ChatMessage::renderMarkdown(const QString &text)
269270 newLineIdx = message.indexOf (" \n " , newLineIdx + 2 );
270271 }
271272 } else {
273+ isThinking = true ;
272274 message.replace (" \n " , " \n >" );
273275 }
274276 message.replace (endToken, " \n\n " );
@@ -278,13 +280,18 @@ void ChatMessage::renderMarkdown(const QString &text)
278280 if (endIdx != notfound) {
279281 m_markdownLabel->setMarkdown (text.mid (endIdx + endToken.size ()));
280282 } else {
281- static QVector<QChar>
282- chars{u' ⠋' , u' ⠙' , u' ⠹' , u' ⠸' , u' ⠼' , u' ⠴' , u' ⠦' , u' ⠧' , u' ⠇' , u' ⠏' };
283- // Dividing with 33ms results in 30fps
284- m_markdownLabel->setMarkdown (QString (" %1" ).arg (
285- chars[(QDateTime::currentMSecsSinceEpoch () / 33 ) % chars.size ()]));
283+ isThinking = true ;
284+ m_markdownLabel->setMarkdown (" " );
286285 }
287286 }
287+
288+ static QVector<QChar> chars{u' ⠋' , u' ⠙' , u' ⠹' , u' ⠸' , u' ⠼' , u' ⠴' , u' ⠦' , u' ⠧' , u' ⠇' , u' ⠏' };
289+ // Dividing with 33ms results in 30fps
290+ m_thoughtToggle->setText (
291+ isThinking ? Tr::tr (" Thinking %1" )
292+ .arg (chars[(QDateTime::currentMSecsSinceEpoch () / 33 ) % chars.size ()])
293+ : Tr::tr (" Thought Process" ));
294+
288295 } else {
289296 m_markdownLabel->setMarkdown (text);
290297 }
0 commit comments