mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-16 12:04:35 -04:00
Upgrade to version 0.4.4
* feat: Add attachments for message * feat: Support QtC color palette for chat view * feat: Improve code completion from non-FIM models * refactor: Removed trimming messages * chore: Bump version to 0.4.4
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@ -75,9 +76,26 @@ QColor ChatRootView::backgroundColor() const
|
||||
return Utils::creatorColor(Utils::Theme::BackgroundColorNormal);
|
||||
}
|
||||
|
||||
void ChatRootView::sendMessage(const QString &message, bool sharingCurrentFile) const
|
||||
void ChatRootView::sendMessage(const QString &message, bool sharingCurrentFile)
|
||||
{
|
||||
m_clientInterface->sendMessage(message, sharingCurrentFile);
|
||||
if (m_chatModel->totalTokens() > m_chatModel->tokensThreshold()) {
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(
|
||||
Core::ICore::dialogParent(),
|
||||
tr("Token Limit Exceeded"),
|
||||
tr("The chat history has exceeded the token limit.\n"
|
||||
"Would you like to create new chat?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (reply == QMessageBox::Yes) {
|
||||
autosave();
|
||||
m_chatModel->clear();
|
||||
m_recentFilePath = QString{};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_clientInterface->sendMessage(message, m_attachmentFiles, sharingCurrentFile);
|
||||
clearAttachmentFiles();
|
||||
}
|
||||
|
||||
void ChatRootView::copyToClipboard(const QString &text)
|
||||
@ -90,6 +108,14 @@ void ChatRootView::cancelRequest()
|
||||
m_clientInterface->cancelRequest();
|
||||
}
|
||||
|
||||
void ChatRootView::clearAttachmentFiles()
|
||||
{
|
||||
if (!m_attachmentFiles.isEmpty()) {
|
||||
m_attachmentFiles.clear();
|
||||
emit attachmentFilesChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatRootView::generateColors()
|
||||
{
|
||||
QColor baseColor = backgroundColor();
|
||||
@ -293,4 +319,22 @@ QString ChatRootView::getAutosaveFilePath() const
|
||||
return QDir(dir).filePath(getSuggestedFileName() + ".json");
|
||||
}
|
||||
|
||||
void ChatRootView::showAttachFilesDialog()
|
||||
{
|
||||
QFileDialog dialog(nullptr, tr("Select Files to Attach"));
|
||||
dialog.setFileMode(QFileDialog::ExistingFiles);
|
||||
|
||||
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
|
||||
dialog.setDirectory(project->projectDirectory().toString());
|
||||
}
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QStringList filePaths = dialog.selectedFiles();
|
||||
if (!filePaths.isEmpty()) {
|
||||
m_attachmentFiles = filePaths;
|
||||
emit attachmentFilesChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace QodeAssist::Chat
|
||||
|
Reference in New Issue
Block a user