refactor: Change handling finished tools and thinking blocks

This commit is contained in:
Petr Mironychev
2025-11-14 01:46:36 +01:00
parent f5a445b021
commit 8570b9667a
8 changed files with 10 additions and 36 deletions

View File

@ -217,11 +217,6 @@ ChatRootView::ChatRootView(QQuickItem *parent)
&Utils::BaseAspect::changed, &Utils::BaseAspect::changed,
this, this,
&ChatRootView::isThinkingSupportChanged); &ChatRootView::isThinkingSupportChanged);
connect(
&Settings::toolsSettings().debugToolsAndThinkingComponent,
&Utils::BaseAspect::changed,
this,
&ChatRootView::isToolDebugging);
} }
ChatModel *ChatRootView::chatModel() const ChatModel *ChatRootView::chatModel() const
@ -1131,9 +1126,5 @@ bool ChatRootView::isThinkingSupport() const
return provider && provider->supportThinking(); return provider && provider->supportThinking();
} }
bool ChatRootView::isToolDebugging() const
{
return Settings::toolsSettings().debugToolsAndThinkingComponent();
}
} // namespace QodeAssist::Chat } // namespace QodeAssist::Chat

View File

@ -58,7 +58,6 @@ class ChatRootView : public QQuickItem
Q_PROPERTY(int currentMessagePendingEdits READ currentMessagePendingEdits NOTIFY currentMessageEditsStatsChanged FINAL) Q_PROPERTY(int currentMessagePendingEdits READ currentMessagePendingEdits NOTIFY currentMessageEditsStatsChanged FINAL)
Q_PROPERTY(int currentMessageRejectedEdits READ currentMessageRejectedEdits NOTIFY currentMessageEditsStatsChanged FINAL) Q_PROPERTY(int currentMessageRejectedEdits READ currentMessageRejectedEdits NOTIFY currentMessageEditsStatsChanged FINAL)
Q_PROPERTY(bool isThinkingSupport READ isThinkingSupport NOTIFY isThinkingSupportChanged FINAL) Q_PROPERTY(bool isThinkingSupport READ isThinkingSupport NOTIFY isThinkingSupportChanged FINAL)
Q_PROPERTY(bool isToolDebugging READ isToolDebugging NOTIFY isToolDebuggingChanged FINAL)
QML_ELEMENT QML_ELEMENT
@ -143,8 +142,6 @@ public:
bool isThinkingSupport() const; bool isThinkingSupport() const;
bool isToolDebugging() const;
public slots: public slots:
void sendMessage(const QString &message); void sendMessage(const QString &message);
void copyToClipboard(const QString &text); void copyToClipboard(const QString &text);
@ -180,8 +177,6 @@ signals:
void isThinkingSupportChanged(); void isThinkingSupportChanged();
void isToolDebuggingChanged();
private: private:
void updateFileEditStatus(const QString &editId, const QString &status); void updateFileEditStatus(const QString &editId, const QString &status);
QString getChatsHistoryDir() const; QString getChatsHistoryDir() const;

View File

@ -135,7 +135,7 @@ ChatRootView {
} }
onLoaded: { onLoaded: {
if (componentLoader.sourceComponent == chatItemComponent && !root.isToolDebugging) { if (componentLoader.sourceComponent == chatItemComponent) {
chatListView.hideServiceComponents(index) chatListView.hideServiceComponents(index)
} }
} }
@ -194,15 +194,11 @@ ChatRootView {
width: parent.width width: parent.width
toolContent: model.content toolContent: model.content
FadeListItemAnimation{
id: toolFadeAnimation
}
Connections { Connections {
target: chatListView target: chatListView
function onHideServiceComponents(itemIndex) { function onHideServiceComponents(itemIndex) {
if (index !== itemIndex) { if (index !== itemIndex) {
toolFadeAnimation.start() toolsItem.headerOpacity = 0.5
} }
} }
} }
@ -238,6 +234,8 @@ ChatRootView {
id: thinkingMessageComponent id: thinkingMessageComponent
ThinkingStatusItem { ThinkingStatusItem {
id: thinking
width: parent.width width: parent.width
thinkingContent: { thinkingContent: {
let content = model.content let content = model.content
@ -249,15 +247,11 @@ ChatRootView {
} }
isRedacted: model.isRedacted !== undefined ? model.isRedacted : false isRedacted: model.isRedacted !== undefined ? model.isRedacted : false
FadeListItemAnimation{
id: thinkingFadeAnimation
}
Connections { Connections {
target: chatListView target: chatListView
function onHideServiceComponents(itemIndex) { function onHideServiceComponents(itemIndex) {
if (index !== itemIndex) { if (index !== itemIndex) {
thinkingFadeAnimation.start() thinking.headerOpacity = 0.5
} }
} }
} }

View File

@ -28,6 +28,8 @@ Rectangle {
property bool isRedacted: false property bool isRedacted: false
property bool expanded: false property bool expanded: false
property alias headerOpacity: headerRow.opacity
radius: 6 radius: 6
color: palette.base color: palette.base
clip: true clip: true

View File

@ -26,6 +26,8 @@ Rectangle {
property string toolContent: "" property string toolContent: ""
property bool expanded: false property bool expanded: false
property alias headerOpacity: headerRow.opacity
readonly property int firstNewline: toolContent.indexOf('\n') readonly property int firstNewline: toolContent.indexOf('\n')
readonly property string toolName: firstNewline > 0 ? toolContent.substring(0, firstNewline) : toolContent readonly property string toolName: firstNewline > 0 ? toolContent.substring(0, firstNewline) : toolContent
readonly property string toolResult: firstNewline > 0 ? toolContent.substring(firstNewline + 1) : "" readonly property string toolResult: firstNewline > 0 ? toolContent.substring(firstNewline + 1) : ""

View File

@ -91,7 +91,6 @@ const char CA_ALLOW_FILE_SYSTEM_WRITE[] = "QodeAssist.caAllowFileSystemWrite";
const char CA_ALLOW_ACCESS_OUTSIDE_PROJECT[] = "QodeAssist.caAllowAccessOutsideProject"; const char CA_ALLOW_ACCESS_OUTSIDE_PROJECT[] = "QodeAssist.caAllowAccessOutsideProject";
const char CA_ENABLE_EDIT_FILE_TOOL[] = "QodeAssist.caEnableEditFileTool"; const char CA_ENABLE_EDIT_FILE_TOOL[] = "QodeAssist.caEnableEditFileTool";
const char CA_ENABLE_BUILD_PROJECT_TOOL[] = "QodeAssist.caEnableBuildProjectTool"; const char CA_ENABLE_BUILD_PROJECT_TOOL[] = "QodeAssist.caEnableBuildProjectTool";
const char CA_DEBUG_TOOLS_AND_THINKING_COMPONENT[] = "QodeAssist.caDebugToolsAndThinkingComponent";
const char QODE_ASSIST_GENERAL_OPTIONS_ID[] = "QodeAssist.GeneralOptions"; const char QODE_ASSIST_GENERAL_OPTIONS_ID[] = "QodeAssist.GeneralOptions";
const char QODE_ASSIST_GENERAL_SETTINGS_PAGE_ID[] = "QodeAssist.1GeneralSettingsPageId"; const char QODE_ASSIST_GENERAL_SETTINGS_PAGE_ID[] = "QodeAssist.1GeneralSettingsPageId";

View File

@ -89,12 +89,6 @@ ToolsSettings::ToolsSettings()
"project. This feature is under testing and may have unexpected behavior.")); "project. This feature is under testing and may have unexpected behavior."));
enableBuildProjectTool.setDefaultValue(false); enableBuildProjectTool.setDefaultValue(false);
debugToolsAndThinkingComponent.setSettingsKey(Constants::CA_DEBUG_TOOLS_AND_THINKING_COMPONENT);
debugToolsAndThinkingComponent.setLabelText(Tr::tr("Always show Tools and Thinking Components in chat"));
debugToolsAndThinkingComponent.setToolTip(
Tr::tr("Disable disapearing tools and thinking component from chat"));
debugToolsAndThinkingComponent.setDefaultValue(false);
resetToDefaults.m_buttonText = Tr::tr("Reset Page to Defaults"); resetToDefaults.m_buttonText = Tr::tr("Reset Page to Defaults");
readSettings(); readSettings();
@ -114,8 +108,7 @@ ToolsSettings::ToolsSettings()
Space{8}, Space{8},
allowFileSystemRead, allowFileSystemRead,
allowFileSystemWrite, allowFileSystemWrite,
allowAccessOutsideProject, allowAccessOutsideProject
debugToolsAndThinkingComponent
}}, }},
Space{8}, Space{8},
Group{ Group{
@ -151,7 +144,6 @@ void ToolsSettings::resetSettingsToDefaults()
resetAspect(autoApplyFileEdits); resetAspect(autoApplyFileEdits);
resetAspect(enableEditFileTool); resetAspect(enableEditFileTool);
resetAspect(enableBuildProjectTool); resetAspect(enableBuildProjectTool);
resetAspect(debugToolsAndThinkingComponent);
writeSettings(); writeSettings();
} }
} }

View File

@ -36,7 +36,6 @@ public:
Utils::BoolAspect allowFileSystemRead{this}; Utils::BoolAspect allowFileSystemRead{this};
Utils::BoolAspect allowFileSystemWrite{this}; Utils::BoolAspect allowFileSystemWrite{this};
Utils::BoolAspect allowAccessOutsideProject{this}; Utils::BoolAspect allowAccessOutsideProject{this};
Utils::BoolAspect debugToolsAndThinkingComponent{this};
// Experimental features // Experimental features
Utils::BoolAspect enableEditFileTool{this}; Utils::BoolAspect enableEditFileTool{this};