diff --git a/ChatView/ChatModel.cpp b/ChatView/ChatModel.cpp index 4740aa6..102095e 100644 --- a/ChatView/ChatModel.cpp +++ b/ChatView/ChatModel.cpp @@ -121,6 +121,7 @@ void ChatModel::clear() m_totalTokens = 0; endResetModel(); emit totalTokensChanged(); + emit modelReseted(); } QList ChatModel::processMessageContent(const QString &content) const diff --git a/ChatView/ChatModel.hpp b/ChatView/ChatModel.hpp index 2be2563..2bc0369 100644 --- a/ChatView/ChatModel.hpp +++ b/ChatView/ChatModel.hpp @@ -71,6 +71,7 @@ public: signals: void totalTokensChanged(); void tokensThresholdChanged(); + void modelReseted(); private: void trim(); diff --git a/ChatView/ChatRootView.cpp b/ChatView/ChatRootView.cpp index 3aac9fe..93fd2eb 100644 --- a/ChatView/ChatRootView.cpp +++ b/ChatView/ChatRootView.cpp @@ -60,6 +60,8 @@ ChatRootView::ChatRootView(QQuickItem *parent) this, &ChatRootView::autosave); + connect(m_chatModel, &ChatModel::modelReseted, [this]() { m_recentFilePath = QString(); }); + generateColors(); } @@ -251,11 +253,6 @@ QString ChatRootView::getSuggestedFileName() const { QStringList parts; - if (auto project = ProjectExplorer::ProjectManager::startupProject()) { - QString projectName = project->projectDirectory().fileName(); - parts << projectName; - } - if (m_chatModel->rowCount() > 0) { QString firstMessage = m_chatModel->data(m_chatModel->index(0), ChatModel::Content).toString(); diff --git a/settings/ProjectSettings.cpp b/settings/ProjectSettings.cpp index b5edfe0..4be7392 100644 --- a/settings/ProjectSettings.cpp +++ b/settings/ProjectSettings.cpp @@ -22,6 +22,7 @@ #include "GeneralSettings.hpp" #include "SettingsConstants.hpp" #include "SettingsTr.hpp" +#include #include namespace QodeAssist::Settings { @@ -41,8 +42,11 @@ ProjectSettings::ProjectSettings(ProjectExplorer::Project *project) chatHistoryPath.setSettingsKey(Constants::QODE_ASSIST_CHAT_HISTORY_PATH); chatHistoryPath.setExpectedKind(Utils::PathChooser::ExistingDirectory); chatHistoryPath.setLabelText(Tr::tr("Chat History Path:")); - chatHistoryPath.setDefaultValue( - project->projectDirectory().toString() + "/.qodeassist/chat_history"); + + QString projectChatHistoryPath + = QString("%1/qodeassist/chat_history").arg(Core::ICore::userResourcePath().toString()); + + chatHistoryPath.setDefaultValue(projectChatHistoryPath); Utils::Store map = Utils::storeFromVariant( project->namedSettings(Constants::QODE_ASSIST_PROJECT_SETTINGS_ID));