feat: Add disappearing tools and thinking component from chat

This commit is contained in:
Petr Mironychev
2025-11-13 02:19:49 +01:00
parent 75cbc46808
commit c302138568
8 changed files with 87 additions and 1 deletions

View File

@ -217,6 +217,11 @@ 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
@ -1126,4 +1131,9 @@ 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,6 +58,7 @@ 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
@ -142,6 +143,8 @@ 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);
@ -177,6 +180,8 @@ 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

@ -103,16 +103,20 @@ ChatRootView {
ListView { ListView {
id: chatListView id: chatListView
signal hideServiceComponents(int itemIndex)
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
leftMargin: 5 leftMargin: 5
model: root.chatModel model: root.chatModel
clip: true clip: true
spacing: 10 spacing: 0
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
cacheBuffer: 2000 cacheBuffer: 2000
delegate: Loader { delegate: Loader {
id: componentLoader
required property var model required property var model
required property int index required property int index
@ -129,6 +133,12 @@ ChatRootView {
return chatItemComponent return chatItemComponent
} }
} }
onLoaded: {
if (componentLoader.sourceComponent == chatItemComponent && !root.isToolDebugging) {
chatListView.hideServiceComponents(index)
}
}
} }
header: Item { header: Item {
@ -179,8 +189,23 @@ ChatRootView {
id: toolMessageComponent id: toolMessageComponent
ToolStatusItem { ToolStatusItem {
id: toolsItem
width: parent.width width: parent.width
toolContent: model.content toolContent: model.content
FadeListItemAnimation{
id: toolFadeAnimation
}
Connections {
target: chatListView
function onHideServiceComponents(itemIndex) {
if (index !== itemIndex) {
toolFadeAnimation.start()
}
}
}
} }
} }
@ -223,6 +248,19 @@ ChatRootView {
return content return content
} }
isRedacted: model.isRedacted !== undefined ? model.isRedacted : false isRedacted: model.isRedacted !== undefined ? model.isRedacted : false
FadeListItemAnimation{
id: thinkingFadeAnimation
}
Connections {
target: chatListView
function onHideServiceComponents(itemIndex) {
if (index !== itemIndex) {
thinkingFadeAnimation.start()
}
}
}
} }
} }
} }

View File

@ -11,6 +11,7 @@ qt_add_qml_module(QodeAssistUIControls
qml/Badge.qml qml/Badge.qml
qml/QoAButton.qml qml/QoAButton.qml
qml/QoATextSlider.qml qml/QoATextSlider.qml
qml/FadeListItemAnimation.qml
) )
target_link_libraries(QodeAssistUIControls target_link_libraries(QodeAssistUIControls

View File

@ -0,0 +1,22 @@
import QtQuick
ParallelAnimation {
id: root
property Item targetObject: parent
NumberAnimation {
target: root.targetObject
property: "opacity"
to: 0
duration: 200
easing.type: Easing.InQuad
}
NumberAnimation {
target: root.targetObject
property: "height"
to: 0
duration: 250
easing.type: Easing.InQuad
}
}

View File

@ -91,6 +91,7 @@ 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,6 +89,12 @@ 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();
@ -109,6 +115,7 @@ ToolsSettings::ToolsSettings()
allowFileSystemRead, allowFileSystemRead,
allowFileSystemWrite, allowFileSystemWrite,
allowAccessOutsideProject, allowAccessOutsideProject,
debugToolsAndThinkingComponent
}}, }},
Space{8}, Space{8},
Group{ Group{
@ -144,6 +151,7 @@ void ToolsSettings::resetSettingsToDefaults()
resetAspect(autoApplyFileEdits); resetAspect(autoApplyFileEdits);
resetAspect(enableEditFileTool); resetAspect(enableEditFileTool);
resetAspect(enableBuildProjectTool); resetAspect(enableBuildProjectTool);
resetAspect(debugToolsAndThinkingComponent);
writeSettings(); writeSettings();
} }
} }

View File

@ -36,6 +36,7 @@ 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};