mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-06-04 01:28:58 -04:00
fix: path to chat file without project
This commit is contained in:
parent
d04e5bc967
commit
ee2c3950e8
@ -121,6 +121,7 @@ void ChatModel::clear()
|
|||||||
m_totalTokens = 0;
|
m_totalTokens = 0;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
emit totalTokensChanged();
|
emit totalTokensChanged();
|
||||||
|
emit modelReseted();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<MessagePart> ChatModel::processMessageContent(const QString &content) const
|
QList<MessagePart> ChatModel::processMessageContent(const QString &content) const
|
||||||
|
@ -71,6 +71,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void totalTokensChanged();
|
void totalTokensChanged();
|
||||||
void tokensThresholdChanged();
|
void tokensThresholdChanged();
|
||||||
|
void modelReseted();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void trim();
|
void trim();
|
||||||
|
@ -60,6 +60,8 @@ ChatRootView::ChatRootView(QQuickItem *parent)
|
|||||||
this,
|
this,
|
||||||
&ChatRootView::autosave);
|
&ChatRootView::autosave);
|
||||||
|
|
||||||
|
connect(m_chatModel, &ChatModel::modelReseted, [this]() { m_recentFilePath = QString(); });
|
||||||
|
|
||||||
generateColors();
|
generateColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,11 +253,6 @@ QString ChatRootView::getSuggestedFileName() const
|
|||||||
{
|
{
|
||||||
QStringList parts;
|
QStringList parts;
|
||||||
|
|
||||||
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
|
|
||||||
QString projectName = project->projectDirectory().fileName();
|
|
||||||
parts << projectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_chatModel->rowCount() > 0) {
|
if (m_chatModel->rowCount() > 0) {
|
||||||
QString firstMessage
|
QString firstMessage
|
||||||
= m_chatModel->data(m_chatModel->index(0), ChatModel::Content).toString();
|
= m_chatModel->data(m_chatModel->index(0), ChatModel::Content).toString();
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "GeneralSettings.hpp"
|
#include "GeneralSettings.hpp"
|
||||||
#include "SettingsConstants.hpp"
|
#include "SettingsConstants.hpp"
|
||||||
#include "SettingsTr.hpp"
|
#include "SettingsTr.hpp"
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
|
||||||
namespace QodeAssist::Settings {
|
namespace QodeAssist::Settings {
|
||||||
@ -41,8 +42,11 @@ ProjectSettings::ProjectSettings(ProjectExplorer::Project *project)
|
|||||||
chatHistoryPath.setSettingsKey(Constants::QODE_ASSIST_CHAT_HISTORY_PATH);
|
chatHistoryPath.setSettingsKey(Constants::QODE_ASSIST_CHAT_HISTORY_PATH);
|
||||||
chatHistoryPath.setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
chatHistoryPath.setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
||||||
chatHistoryPath.setLabelText(Tr::tr("Chat History Path:"));
|
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(
|
Utils::Store map = Utils::storeFromVariant(
|
||||||
project->namedSettings(Constants::QODE_ASSIST_PROJECT_SETTINGS_ID));
|
project->namedSettings(Constants::QODE_ASSIST_PROJECT_SETTINGS_ID));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user