-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
36 lines (29 loc) · 1018 Bytes
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "mainwindow.h"
#include "./ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QObject::connect(&m_ollamaClient, &OllamaClient::responseReceived, [](const QString &response) {
qDebug() << "Full Response:" << response;
//ui->textBrowser->insertPlainText()
});
QObject::connect(&m_ollamaClient, &OllamaClient::streamDataReceived, [this](const QString &data) {
qDebug() << "Stream Data:" << data;
ui->textBrowser->insertPlainText(data);
});
QObject::connect(&m_ollamaClient, &OllamaClient::errorOccurred, [this](const QString &error) {
ui->textBrowser->insertPlainText(error);
qDebug() << "Error:" << error;
});
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
ui->textBrowser->insertHtml("<br><hr/><br>");
m_ollamaClient.askQuestion(ui->lineEdit->text());
}