main
朱子楚\zhuzi 2023-03-18 22:52:24 +08:00
parent a447b260e7
commit 9545175445
3 changed files with 7 additions and 34 deletions

View File

@ -43,14 +43,14 @@ void ChatController::sendMessage(const QString& text){
} }
QJsonObject ChatController::createMessage(const QString& role,const QString& content){ QJsonObject ChatController::createMessage(const QString& role,const QString& content){
QJsonObject message; QJsonObject message;
message.insert("role",role); message.insert("role",role);
message.insert("content",content); message.insert("content",content);
return message; return message;
} }
void ChatController::clipText(const QString& text){ void ChatController::clipText(const QString& text){
qDebug()<<text; qDebug()<<text;
QClipboard *clipboard = QGuiApplication::clipboard(); QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setText(text); clipboard->setText(text);
} }

View File

@ -10,6 +10,7 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QClipboard> #include <QClipboard>
#include <QByteArray> #include <QByteArray>
#include <QFile>
#include "stdafx.h" #include "stdafx.h"
class ChatController : public QObject class ChatController : public QObject

View File

@ -50,7 +50,6 @@ FluWindow {
selectByMouse: true selectByMouse: true
selectByKeyboard: true selectByKeyboard: true
selectedTextColor: Qt.rgba(51,153,255,1) selectedTextColor: Qt.rgba(51,153,255,1)
textFormat:TextEdit.MarkdownText
color:FluColors.Black color:FluColors.Black
selectionColor: { selectionColor: {
if(FluTheme.isDark){ if(FluTheme.isDark){
@ -79,13 +78,6 @@ FluWindow {
margins: 10 margins: 10
} }
color: FluTheme.isDark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(245/255,245/255,245/255,1) color: FluTheme.isDark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(245/255,245/255,245/255,1)
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
menu_pannel.popup()
}
}
ListView{ ListView{
id:list_message id:list_message
anchors.fill: parent anchors.fill: parent
@ -253,26 +245,6 @@ FluWindow {
} }
} }
FluMenu{
id:menu_pannel
focus: false
FluMenuItem{
text:"导出消息"
onClicked: {
file_dialog.open()
}
}
}
FileDialog{
id:file_dialog
folder: shortcuts.home
selectFolder : true
onAccepted: {
console.log("You chose: " + file_dialog.fileUrl)
}
}
function appendMessage(isMy,text){ function appendMessage(isMy,text){
model_message.append({isMy:isMy,text:text}) model_message.append({isMy:isMy,text:text})
list_message.positionViewAtEnd() list_message.positionViewAtEnd()