feat: Add chat-agent switcher in chat ui (#247)

* feat: Add chat-agent switcher in chat ui

fix: qml errors

refactor: Change top bar layout

fix: default value

* fix: update github action for qtc
This commit is contained in:
Petr Mironychev
2025-10-31 16:09:38 +01:00
committed by GitHub
parent 9117572f82
commit db82fb08e8
27 changed files with 244 additions and 140 deletions

View File

@ -49,6 +49,7 @@ ChatRootView::ChatRootView(QQuickItem *parent)
, m_promptProvider(LLMCore::PromptTemplateManager::instance())
, m_clientInterface(new ClientInterface(m_chatModel, &m_promptProvider, this))
, m_isRequestInProgress(false)
, m_isAgentMode(false)
{
m_isSyncOpenFiles = Settings::chatAssistantSettings().linkOpenFiles();
connect(
@ -142,12 +143,20 @@ ChatRootView::ChatRootView(QQuickItem *parent)
updateInputTokensCount();
refreshRules();
// Refresh rules when project changes
connect(
ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::ProjectManager::startupProjectChanged,
this,
&ChatRootView::refreshRules);
QSettings appSettings;
m_isAgentMode = appSettings.value("QodeAssist/Chat/AgentMode", true).toBool();
connect(
&Settings::generalSettings().useTools,
&Utils::BaseAspect::changed,
this,
&ChatRootView::toolsSupportEnabledChanged);
}
ChatModel *ChatRootView::chatModel() const
@ -173,7 +182,7 @@ void ChatRootView::sendMessage(const QString &message)
}
}
m_clientInterface->sendMessage(message, m_attachmentFiles, m_linkedFiles);
m_clientInterface->sendMessage(message, m_attachmentFiles, m_linkedFiles, m_isAgentMode);
clearAttachmentFiles();
setRequestProgressStatus(true);
}
@ -704,4 +713,26 @@ void ChatRootView::refreshRules()
emit activeRulesCountChanged();
}
bool ChatRootView::isAgentMode() const
{
return m_isAgentMode;
}
void ChatRootView::setIsAgentMode(bool newIsAgentMode)
{
if (m_isAgentMode != newIsAgentMode) {
m_isAgentMode = newIsAgentMode;
QSettings settings;
settings.setValue("QodeAssist/Chat/AgentMode", newIsAgentMode);
emit isAgentModeChanged();
}
}
bool ChatRootView::toolsSupportEnabled() const
{
return Settings::generalSettings().useTools();
}
} // namespace QodeAssist::Chat