починил нейроконструктор, исправил распознавание сообщений из чата
This commit is contained in:
+109
-19
@@ -36,12 +36,13 @@ uGeneral::uGeneral(QWidget *parent)
|
||||
, m_authStreamer(nullptr)
|
||||
, m_authDA(nullptr)
|
||||
, fLinkForm(nullptr)
|
||||
, m_randomManager(nullptr)
|
||||
, m_neuralTemplateManager(nullptr)
|
||||
, m_isTwitchConnected(false)
|
||||
, m_notificationServers()
|
||||
, m_chatServers()
|
||||
, m_createNotifyDialog(nullptr)
|
||||
, m_createChatDialog(nullptr)
|
||||
, m_randomManager(nullptr)
|
||||
{
|
||||
// ============================================================================
|
||||
// ИНИЦИАЛИЗАЦИЯ ИНТЕРФЕЙСА
|
||||
@@ -86,7 +87,7 @@ uGeneral::uGeneral(QWidget *parent)
|
||||
|
||||
// Инициализируем структуру папок
|
||||
FileManager::instance().initializeFolderStructure();
|
||||
FileManager::instance().copyDefaultFiles();
|
||||
|
||||
// Получаем пути через FileManager
|
||||
QString sysPath = FileManager::instance().systemPath();
|
||||
|
||||
@@ -181,10 +182,7 @@ uGeneral::uGeneral(QWidget *parent)
|
||||
// Добавьте эту строку в конец метода:
|
||||
initializeNotificationSounds();
|
||||
|
||||
if (db) {
|
||||
m_randomManager = new RandomManager(this);
|
||||
m_randomManager->initialize(db);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -394,6 +392,8 @@ void uGeneral::setupTables()
|
||||
this, &uGeneral::onFilesGridDoubleClicked);
|
||||
connect(ui->widget_3->tableWidget(), &QTableWidget::cellDoubleClicked,
|
||||
this, &uGeneral::onNeiroGridDoubleClicked);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,12 +416,40 @@ void uGeneral::initializeManagers()
|
||||
|
||||
// Менеджер случайных ответов (групп)
|
||||
m_randomResponses = new RandomResponses(this);
|
||||
|
||||
m_neuralTemplateManager = new NeuralTemplateManager(this);
|
||||
QTableWidget* table = ui->widget_3->tableWidget();
|
||||
m_neuralTemplateManager->loadFromTableWidget(table);
|
||||
// Менеджер нейросети (если есть)
|
||||
nnManager = new NeuralNetworkManager(this);
|
||||
// Настройка нейросети (пример)
|
||||
// nnManager->setApiKey(NeuralNetworkManager::DeepSeek, "ваш_api_ключ");
|
||||
// nnManager->setModel(NeuralNetworkManager::DeepSeek, "deepseek-chat");
|
||||
nnManager->setPrefix(ui->edtGPTPrefix->text());
|
||||
if (ui->rbGC->isChecked()) {
|
||||
// GigaChat
|
||||
nnManager->setCurrentNetworkType(NeuralNetworkManager::GigaChat);
|
||||
nnManager->setGigaChatCredentials(ui->edtAIP1->text(), ui->edtAIP2->text());
|
||||
qDebug() << "GigaChat";
|
||||
}
|
||||
else if (ui->rbDS->isChecked()) {
|
||||
// DeepSeek
|
||||
nnManager->setCurrentNetworkType(NeuralNetworkManager::DeepSeek);
|
||||
nnManager->setApiKey(NeuralNetworkManager::DeepSeek, ui->edtAIP1->text());
|
||||
|
||||
qDebug() << "DeepSeek";
|
||||
}
|
||||
else if (ui->rbCG->isChecked()) {
|
||||
// ChatGPT
|
||||
nnManager->setCurrentNetworkType(NeuralNetworkManager::ChatGPT);
|
||||
nnManager->setApiKey(NeuralNetworkManager::ChatGPT, ui->edtAIP1->text());
|
||||
qDebug() << "ChatGPT";
|
||||
}
|
||||
else if (ui->RBCustom->isChecked()) {
|
||||
// Ollama
|
||||
nnManager->setCurrentNetworkType(NeuralNetworkManager::Ollama);
|
||||
nnManager->setApiKey(NeuralNetworkManager::Ollama, ui->edtAIP1->text());
|
||||
nnManager->setOllamaUrl(ui->edtAIP2->text());
|
||||
qDebug() << "Ollama";
|
||||
}
|
||||
|
||||
|
||||
m_SoundFiles = new MediaFileManager();
|
||||
|
||||
@@ -450,6 +478,7 @@ void uGeneral::initializeManagers()
|
||||
context.soundManager = soundManager;
|
||||
context.neuralManager = nnManager;
|
||||
context.randomManager = m_randomManager;
|
||||
context.neuralTemplateManager = m_neuralTemplateManager;
|
||||
context.randomResponses = m_randomResponses;
|
||||
context.mediaFileManager = m_SoundFiles;
|
||||
context.channel = ui->edtChannel->text();
|
||||
@@ -805,7 +834,10 @@ uGeneral::~uGeneral()
|
||||
m_randomManager = nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (m_neuralTemplateManager) {
|
||||
delete m_neuralTemplateManager;
|
||||
m_neuralTemplateManager = nullptr;
|
||||
}
|
||||
delete m_createNotifyDialog;
|
||||
delete m_createChatDialog;
|
||||
delete ui;
|
||||
@@ -1755,7 +1787,15 @@ void uGeneral::on_btnNotifyCheckSub_clicked()
|
||||
|
||||
void uGeneral::on_btnNotifyOpen_clicked()
|
||||
{
|
||||
QString sourceFile = QFileDialog::getOpenFileName(this,
|
||||
"Выберите файл для уведомлений",
|
||||
QDir::homePath(),
|
||||
"Звуковой файл (*.mp3);;Все файлы (*.*)");
|
||||
|
||||
if (sourceFile.isEmpty()) {
|
||||
return; // Пользователь отменил выбор
|
||||
}
|
||||
ui->edtNotifyFileName->setText(sourceFile);
|
||||
}
|
||||
|
||||
void uGeneral::on_btnNotifyOpenMod_clicked()
|
||||
@@ -1946,7 +1986,7 @@ void uGeneral::on_btnNotifyOpenSub_clicked()
|
||||
|
||||
// Проверяем и регистрируем пользователя
|
||||
QString userId = m_userManager->checkUser(msg.displayName, msg);
|
||||
|
||||
LogManager::instance()->debug("uGeneral", "handleNewMessage", message);
|
||||
m_userManager->m_totalMessages++;
|
||||
|
||||
// Обновляем статистику и воспроизводим уведомление
|
||||
@@ -2338,14 +2378,6 @@ void uGeneral::on_btnRmGroup_clicked()
|
||||
db->LoadRandomGroups(ui->lbRandomGroup);
|
||||
}
|
||||
|
||||
|
||||
void uGeneral::on_btnAddUserName_clicked()
|
||||
{
|
||||
QTextCursor cursor = ui->textBrowser->textCursor();
|
||||
cursor.insertText("[USERNAME]");
|
||||
}
|
||||
|
||||
|
||||
void uGeneral::on_btnGetDateFollow_clicked()
|
||||
{
|
||||
QTextCursor cursor = ui->textBrowser->textCursor();
|
||||
@@ -2465,9 +2497,52 @@ void uGeneral::on_btnEdtCommand_clicked()
|
||||
|
||||
void uGeneral::loadQssFiles()
|
||||
{
|
||||
// Очищаем ComboBox
|
||||
ui->cbTheme->clear();
|
||||
|
||||
// Добавляем опцию "Без темы"
|
||||
ui->cbTheme->addItem("Без темы", "");
|
||||
// 1. Загружаем системные стили (из папки приложения)
|
||||
QString systemStylesPath = FileManager::instance().getPath(FileManager::SystemStyles);
|
||||
QDir systemStylesDir(systemStylesPath);
|
||||
|
||||
if (systemStylesDir.exists()) {
|
||||
qDebug() << "Системные стили из:" << systemStylesPath;
|
||||
loadStylesFromDirectory(systemStylesDir, "Системные");
|
||||
} else {
|
||||
qWarning() << "Папка системных стилей не найдена:" << systemStylesPath;
|
||||
|
||||
// Создаем папку, если ее нет
|
||||
systemStylesDir.mkpath(".");
|
||||
}
|
||||
|
||||
// 2. Загружаем пользовательские стили (из папки данных пользователя)
|
||||
QString userStylesPath = FileManager::instance().getPath(FileManager::Styles);
|
||||
QDir userStylesDir(userStylesPath);
|
||||
|
||||
if (userStylesDir.exists()) {
|
||||
qDebug() << "Пользовательские стили из:" << userStylesPath;
|
||||
loadStylesFromDirectory(userStylesDir, "Пользовательские");
|
||||
} else {
|
||||
qWarning() << "Папка пользовательских стилей не найдена:" << userStylesPath;
|
||||
|
||||
// Создаем папку
|
||||
userStylesDir.mkpath(".");
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Проверяем, есть ли темы
|
||||
if (ui->cbTheme->count() <= 1) { // Только "Без темы"
|
||||
qWarning() << "Темы не найдены, создаем базовые";
|
||||
|
||||
}
|
||||
|
||||
qDebug() << "Загружено тем:" << ui->cbTheme->count() - 1; // Минус "Без темы"
|
||||
}
|
||||
|
||||
|
||||
|
||||
void uGeneral::loadStylesFromDirectory(const QDir &stylesDir, const QString &category)
|
||||
{
|
||||
if (!stylesDir.exists()) {
|
||||
@@ -3231,6 +3306,8 @@ void uGeneral::on_cbNotifyFileAgain3_stateChanged(int arg1)
|
||||
|
||||
void uGeneral::on_btnThemesFolder_clicked()
|
||||
{
|
||||
QString userThemesPath = FileManager::instance().getPath(FileManager::Styles);
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(userThemesPath));
|
||||
|
||||
}
|
||||
|
||||
@@ -3281,3 +3358,16 @@ void uGeneral::loadSavedChats()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void uGeneral::on_btnOpenStream_clicked()
|
||||
{
|
||||
QDesktopServices::openUrl("https://www.twitch.tv/" + ui->edtChannel->text());
|
||||
}
|
||||
|
||||
|
||||
void uGeneral::on_btnAUserName_clicked()
|
||||
{
|
||||
QTextCursor cursor = ui->textBrowser->textCursor();
|
||||
cursor.insertText("[USERNAME]");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user