add retry block support: Retry type, header color, expanded default
This commit is contained in:
parent
80b5b1dd5d
commit
3a33c4e42a
|
|
@ -44,7 +44,7 @@ private:
|
|||
// --- Block Parsing ---
|
||||
|
||||
const QRegularExpression ChatBlockModel::s_headerRe(
|
||||
R"(^\[(user|assistant|reasoning|call|tool|error|info)(?::([^\]]*))?\]$)");
|
||||
R"(^\[(user|assistant|reasoning|call|tool|error|info|retry)(?::([^\]]*))?\]$)");
|
||||
|
||||
ChatBlockModel::ChatBlockModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
|
|
@ -73,6 +73,7 @@ QVariant ChatBlockModel::data(const QModelIndex &index, int role) const
|
|||
case ChatBlock::Tool: return QStringLiteral("tool");
|
||||
case ChatBlock::Error: return QStringLiteral("error");
|
||||
case ChatBlock::Info: return QStringLiteral("info");
|
||||
case ChatBlock::Retry: return QStringLiteral("retry");
|
||||
case ChatBlock::Default: return QStringLiteral("default");
|
||||
}
|
||||
return {};
|
||||
|
|
@ -257,6 +258,7 @@ void ChatBlockModel::processLine(const QString &line)
|
|||
else if (typeStr == "tool") type = ChatBlock::Tool;
|
||||
else if (typeStr == "error") type = ChatBlock::Error;
|
||||
else if (typeStr == "info") type = ChatBlock::Info;
|
||||
else if (typeStr == "retry") type = ChatBlock::Retry;
|
||||
else type = ChatBlock::Default;
|
||||
|
||||
beginInsertRows(QModelIndex(), m_blocks.size(), m_blocks.size());
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ struct ChatBlock {
|
|||
Tool,
|
||||
Error,
|
||||
Info,
|
||||
Retry,
|
||||
Default
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -616,6 +616,7 @@ ApplicationWindow {
|
|||
case "assistant": return true
|
||||
case "tool": return true
|
||||
case "info": return true
|
||||
case "retry": return true
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
|
|
@ -636,6 +637,7 @@ ApplicationWindow {
|
|||
case "tool": return Qt.lighter(bg, 1.2)
|
||||
case "error": return Qt.rgba(0.6, 0.15, 0.15, 0.7)
|
||||
case "info": return Qt.lighter(bg, 1.4)
|
||||
case "retry": return Qt.rgba(0.6, 0.5, 0.0, 0.5)
|
||||
default: return bg
|
||||
}
|
||||
} else {
|
||||
|
|
@ -647,6 +649,7 @@ ApplicationWindow {
|
|||
case "tool": return Qt.darker(bg, 1.04)
|
||||
case "error": return Qt.rgba(1.0, 0.8, 0.8, 0.7)
|
||||
case "info": return Qt.darker(bg, 1.02)
|
||||
case "retry": return Qt.rgba(1.0, 0.9, 0.6, 0.5)
|
||||
default: return bg
|
||||
}
|
||||
}
|
||||
|
|
@ -680,6 +683,7 @@ ApplicationWindow {
|
|||
case "tool": return "Tool: " + blockName
|
||||
case "error": return "Error"
|
||||
case "info": return "Info"
|
||||
case "retry": return "Retry"
|
||||
default: return ""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue