mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-14 05:52:50 -05:00
feat: Add disappearing tools and thinking component from chat
This commit is contained in:
@ -217,6 +217,11 @@ ChatRootView::ChatRootView(QQuickItem *parent)
|
||||
&Utils::BaseAspect::changed,
|
||||
this,
|
||||
&ChatRootView::isThinkingSupportChanged);
|
||||
connect(
|
||||
&Settings::toolsSettings().debugToolsAndThinkingComponent,
|
||||
&Utils::BaseAspect::changed,
|
||||
this,
|
||||
&ChatRootView::isToolDebugging);
|
||||
}
|
||||
|
||||
ChatModel *ChatRootView::chatModel() const
|
||||
@ -1126,4 +1131,9 @@ bool ChatRootView::isThinkingSupport() const
|
||||
return provider && provider->supportThinking();
|
||||
}
|
||||
|
||||
bool ChatRootView::isToolDebugging() const
|
||||
{
|
||||
return Settings::toolsSettings().debugToolsAndThinkingComponent();
|
||||
}
|
||||
|
||||
} // namespace QodeAssist::Chat
|
||||
|
||||
@ -58,6 +58,7 @@ class ChatRootView : public QQuickItem
|
||||
Q_PROPERTY(int currentMessagePendingEdits READ currentMessagePendingEdits NOTIFY currentMessageEditsStatsChanged FINAL)
|
||||
Q_PROPERTY(int currentMessageRejectedEdits READ currentMessageRejectedEdits NOTIFY currentMessageEditsStatsChanged FINAL)
|
||||
Q_PROPERTY(bool isThinkingSupport READ isThinkingSupport NOTIFY isThinkingSupportChanged FINAL)
|
||||
Q_PROPERTY(bool isToolDebugging READ isToolDebugging NOTIFY isToolDebuggingChanged FINAL)
|
||||
|
||||
QML_ELEMENT
|
||||
|
||||
@ -142,6 +143,8 @@ public:
|
||||
|
||||
bool isThinkingSupport() const;
|
||||
|
||||
bool isToolDebugging() const;
|
||||
|
||||
public slots:
|
||||
void sendMessage(const QString &message);
|
||||
void copyToClipboard(const QString &text);
|
||||
@ -177,6 +180,8 @@ signals:
|
||||
|
||||
void isThinkingSupportChanged();
|
||||
|
||||
void isToolDebuggingChanged();
|
||||
|
||||
private:
|
||||
void updateFileEditStatus(const QString &editId, const QString &status);
|
||||
QString getChatsHistoryDir() const;
|
||||
|
||||
@ -103,16 +103,20 @@ ChatRootView {
|
||||
ListView {
|
||||
id: chatListView
|
||||
|
||||
signal hideServiceComponents(int itemIndex)
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
leftMargin: 5
|
||||
model: root.chatModel
|
||||
clip: true
|
||||
spacing: 10
|
||||
spacing: 0
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
cacheBuffer: 2000
|
||||
|
||||
delegate: Loader {
|
||||
id: componentLoader
|
||||
|
||||
required property var model
|
||||
required property int index
|
||||
|
||||
@ -129,6 +133,12 @@ ChatRootView {
|
||||
return chatItemComponent
|
||||
}
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
if (componentLoader.sourceComponent == chatItemComponent && !root.isToolDebugging) {
|
||||
chatListView.hideServiceComponents(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header: Item {
|
||||
@ -179,8 +189,23 @@ ChatRootView {
|
||||
id: toolMessageComponent
|
||||
|
||||
ToolStatusItem {
|
||||
id: toolsItem
|
||||
|
||||
width: parent.width
|
||||
toolContent: model.content
|
||||
|
||||
FadeListItemAnimation{
|
||||
id: toolFadeAnimation
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: chatListView
|
||||
function onHideServiceComponents(itemIndex) {
|
||||
if (index !== itemIndex) {
|
||||
toolFadeAnimation.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +248,19 @@ ChatRootView {
|
||||
return content
|
||||
}
|
||||
isRedacted: model.isRedacted !== undefined ? model.isRedacted : false
|
||||
|
||||
FadeListItemAnimation{
|
||||
id: thinkingFadeAnimation
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: chatListView
|
||||
function onHideServiceComponents(itemIndex) {
|
||||
if (index !== itemIndex) {
|
||||
thinkingFadeAnimation.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user