首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

2222222222222222222222222222222222222

行业研究 2.04MB 22 需要积分: 1
立即下载

资源介绍:

222222222222222222222222222
#include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include #include #include #include #include #include #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->mode->setView(new QListView()); bgistran =true; choose_mode_index =2; allwordcount=0; danOrshuang=0; answer=""; contentstart=0; manager = new QNetworkAccessManager(this); hintdata="以下内容由小熠为你呈现:\n"; addstrList.append(QStringLiteral("(9682)")); addstrList.append(QStringLiteral("(3477)")); addstrList.append(QStringLiteral("(5510)")); modeList.append(QStringLiteral("深入分析1")); modeList.append(QStringLiteral("深入分析2")); modeList.append(QStringLiteral("深入分析3")); ui->label_1->setStyleSheet("background-color: rgba(255, 255, 255, 80);border-radius:18px;color:rgba(221, 121, 180, 140)"); for(int i=0;i<3;i++) { ui->mode->addItem(modeList[i]); } themealter(0); QTimer *mytimer=new QTimer(this); QObject::connect(mytimer, SIGNAL(timeout()), this, SLOT(dealisrunning())); mytimer->start(1000); } void MainWindow::themealter(int index) { QString style_music = QString("QPushButton{ background-color: rgba(255, 255, 255, 0);border-radius:24px;}" "QPushButton:hover{background-color: rgba(245, 189, 200, 50);border-radius:24px;}" ); ui->ICON->setStyleSheet(style_music); ui->Btn_music->setStyleSheet(style_music); QString styleSheet = QString("QPushButton{ background-color: rgba(255, 255, 255, 80);border-radius:24px;}" "QPushButton:hover{background-color: rgba(245, 189, 200, 80);border-radius:24px;}" ); ui->Btn_send->setStyleSheet(styleSheet); ui->Btn_clear->setStyleSheet(styleSheet); ui->Btn_word->setStyleSheet(styleSheet); ui->Btn_pdf->setStyleSheet(styleSheet); ui->Btn_txt->setStyleSheet(styleSheet); ui->Btn_ppt->setStyleSheet(styleSheet); ui->Btn_setting->setStyleSheet(styleSheet); ui->Btn_history->setStyleSheet(styleSheet); ui->mode->setStyleSheet("QComboBox {border-image: url(:/images/bg1.png);font: italic 13pt \"Mongolian Baiti\";}" "QComboBox QAbstractItemView{border-image: url(:/images/bg2.png);font: italic 13pt \"Mongolian Baiti\";}" ); } MainWindow::~MainWindow() { delete ui; } QString MainWindow::Format(QString str) { QString return_data; return_data=str.simplified(); return_data = return_data.replace("\"","\\\""); return_data+=","; return_data+=addstrList[choose_mode_index]; qDebug()<< return_data; return return_data; } void MainWindow::httpPost_meta() { QUrl url("https://api.atomecho.cn/v1/chat/completions"); // QUrl url("https://cn.bing.com/search?q=qt"); QNetworkRequest request(url); // 设置已知头信息 request.setRawHeader("Content-Type","application/json"); request.setRawHeader("Authorization","Bearer sk-b5b60e14906899821189a325a0ad6662"); QByteArray questionstr= Format(ui->question->toPlainText()).toUtf8(); QByteArray postdata; postdata.append("{\"model\":\"Atom-13B-Chat\",\"messages\": [{\"role\": \"user\",\"content\":\""); postdata.append(questionstr); postdata.append("\"}],\"stream\": true}"); reply = manager->post(request,postdata);//发起post请求 QString str =QStringLiteral("正在生成中,请稍后……"); ui->allcount->setText(QString::number(0)); ui->textEdit_2->setText(str); QObject::connect(reply, &QNetworkReply::finished, this, &MainWindow::dealhttp); } void MainWindow::httpPost_doubao() { setlength(0); answer=""; allwordcount=0; contentstart=0; QUrl url("https://ark.cn-beijing.volces.com/api/v3/bots/chat/completions"); QNetworkRequest request(url); // 设置已知头信息 request.setRawHeader("Content-Type","application/json"); request.setRawHeader("Authorization","Bearer 11e92871-bb77-41bd-bb99-e094c6ae6c42"); QByteArray questionstr= Format(ui->question->toPlainText()).toUtf8(); QByteArray postdata; postdata.append("{\"model\":\"bot-20240924221914-v9ck8\",\"messages\": [{\"role\": \"user\",\"content\":[{\"type\":\"text\",\"text\":\""); postdata.append(questionstr); postdata.append("\"}]}],\"stream\": true}"); reply_db = manager->post(request,postdata);//发起post请求 QString str =QStringLiteral("以下内容由奴才为娘娘精心呈现"); ui->allcount->setText(QString::number(0)); ui->textEdit_2->setText(str); // 连接信号和槽 QObject::connect(reply_db, &QNetworkReply::readyRead, this, &MainWindow::onDataReceived); QObject::connect(reply_db, &QNetworkReply::finished, this, &MainWindow::onFinished); //QObject::connect(reply_db, &QNetworkReply::finished, this, &MainWindow::dealhttp_doubao); } void MainWindow::dealhttp_doubao() { QByteArray data = reply_db->readAll();//读出数据 QString _data =data; reply_db->deleteLater(); int end = _data.indexOf("role"); int start =_data.indexOf("content"); int length = end -start; QString answerstr = _data.mid(start+10,length-13); answerstr=answerstr.replace("\\n","\n"); allwordcount =answerstr.length(); ui->allcount->setText(QString::number(allwordcount)); ui->textEdit_2->setText(answerstr); } void MainWindow::httpPost_xf_s35() { QUrl url("https://spark-api-open.xf-yun.com/v1/chat/completions"); QNetworkRequest request(url); // 设置已知头信息 request.setRawHeader("Content-Type","application/json"); request.setRawHeader("Authorization","Bearer 232330e73bb6e5e3026dc56a7a430e63:2ec41f45a2e1cebded99f26e0ec5e1ca"); QByteArray questionstr= Format(ui->question->toPlainText()).toUtf8(); QByteArray postdata; postdata.append("{\"model\":\"general\",\"messages\": [{\"role\": \"user\",\"content\":\""); postdata.append(questionstr); postdata.append("\"}],\"stream\": true}"); reply_xf = manager->post(request,postdata);//发起post请求 QString str =QStringLiteral("正在生成中,请稍后……"); ui->allcount->setText(QString::number(0)); ui->textEdit_2->setText(str); QObject::connect(reply_xf, &QNetworkReply::finished, this, &MainWindow::dealhttp_xf); } //key:80522e23159d2497c2a72a43525b895f //sec:NDJkYTViZTJiMTdjZjllMjNlYmNhODU2 void MainWindow::dealhttp_xf() { QByteArray data = reply_xf->readAll();//读出数据 QString _data =data; reply_xf->deleteLater(); int end = _data.indexOf("index"); int start =_data.indexOf("content"); int length = end -start; QString answerstr = _data.mid(start+10,length-15); answerstr=answerstr.replace("\\n","\n"); allwordcount =answerstr.length(); ui->allcount->setText(QString::number(allwordcount)); ui->textEdit_2->setText(answerstr); } void MainWindow::dealhttp() { QByteArray data = reply->readAll();//读出数据 QString _data =data; reply->deleteLater(); int end = _data.indexOf("model"); int start =_data.indexOf("content"); int length = end -start; QString answerstr = _data.mid(start+10,length-16); answerstr=answerstr.replace("\\n","\n"); qDebug()<< answerstr; allwordcount =answerstr.length(); ui->allcount->setText(QString::number(allwordcount)); ui->textEdit_2->setText(answerstr); } void MainWindow::setlength(int length) { ui->allcount->setText(QString::number(length)); } void MainWindow::setanswer(QString answer) { ui->textEdit_2

资源文件列表:

AI20242.zip 大约有18个文件
  1. AI20242/
  2. AI20242/AI2024.pro 453B
  3. AI20242/AI2024.pro.user 23.44KB
  4. AI20242/images/
  5. AI20242/images/bg1.png 216.08KB
  6. AI20242/images/bg2.png 207.66KB
  7. AI20242/images/close.png 15.19KB
  8. AI20242/images/hide.png 3.81KB
  9. AI20242/images/icon.png 1.5KB
  10. AI20242/images/icon1.png 8.42KB
  11. AI20242/images/music.png 9.52KB
  12. AI20242/images/pig.mp3 1.66MB
  13. AI20242/main.cpp 265B
  14. AI20242/mainwindow.cpp 11.75KB
  15. AI20242/mainwindow.h 3.97KB
  16. AI20242/mainwindow.ui 14.65KB
  17. AI20242/qrc.qrc 326B
  18. AI20242/wordengine.h 1.94KB
0评论
提交 加载更多评论
其他资源 数字媒体技术课终作业,基于HTML,css,JavaScript开发的打飞机小游戏
数字媒体技术课终作业,基于HTML,css,JavaScript开发的打飞机小游戏。可以流畅运行,涵盖背景音乐和分数系统,适合当作小作业提交。
content_1727226732355.zip
content_1727226732355.zip
JavaScript玩转机器学习-Tensorflow.js项目实战
JavaScript玩转机器学习-Tensorflow.js项目实战
JavaScript玩转机器学习-Tensorflow.js项目实战 JavaScript玩转机器学习-Tensorflow.js项目实战 JavaScript玩转机器学习-Tensorflow.js项目实战
Vue核心技术 Vue+Vue-Router+Vuex+SSR实战精讲
Vue核心技术 Vue+Vue-Router+Vuex+SSR实战精讲
63685deb92d7a352fbc2bae374d805c5.zip
63685deb92d7a352fbc2bae374d805c5.zip
数字图像处理MATLAB编程课件.zip
数字图像处理MATLAB编程课件.zip
什么语言--长尾词_1704535596_p网站行业关键字7.zip
什么语言--长尾词_1704535596_p网站行业关键字7.zip
说阿拉伯语--长尾词_1704536014_p网站行业关键字8.zip
说阿拉伯语--长尾词_1704536014_p网站行业关键字8.zip