更新部分按钮ico图标
7
.vscode/settings.json
vendored
@ -95,7 +95,12 @@
|
|||||||
"set": "cpp",
|
"set": "cpp",
|
||||||
"qmenu": "cpp",
|
"qmenu": "cpp",
|
||||||
"qstandarditemmodel": "cpp",
|
"qstandarditemmodel": "cpp",
|
||||||
"qscrollbar": "cpp"
|
"qscrollbar": "cpp",
|
||||||
|
"qtmath": "cpp",
|
||||||
|
"qclipboard": "cpp",
|
||||||
|
"qfiledialog": "cpp",
|
||||||
|
"qtimer": "cpp",
|
||||||
|
"qstring": "cpp"
|
||||||
},
|
},
|
||||||
"editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition",
|
"editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition",
|
||||||
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDefinition",
|
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDefinition",
|
||||||
|
|||||||
1
3rdparty/cmark-gfm
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 587a12bb54d95ac37241377e6ddc93ea0e45439b
|
|
||||||
1
3rdparty/md4qt
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit ef2c5e745c66c3e1b2b170a4f33de4891e1a5a7a
|
|
||||||
@ -135,7 +135,12 @@ configure_file (version.h.in version.h @ONLY)
|
|||||||
SET(CMAKE_EXE_LINKER_FLAGS -static)
|
SET(CMAKE_EXE_LINKER_FLAGS -static)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets CURL::libcurl cmark::cmark
|
${PROJECT_NAME} PRIVATE
|
||||||
|
Qt6::Core
|
||||||
|
Qt6::Gui
|
||||||
|
Qt6::Widgets
|
||||||
|
cmark::cmark
|
||||||
|
CURL::libcurl
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
res.qrc
@ -21,8 +21,10 @@
|
|||||||
<file>res/img/btn/btn_info_down.png</file>
|
<file>res/img/btn/btn_info_down.png</file>
|
||||||
<file>res/img/btn/btn_info_save.png</file>
|
<file>res/img/btn/btn_info_save.png</file>
|
||||||
<file>res/img/btn/btn_info_up.png</file>
|
<file>res/img/btn/btn_info_up.png</file>
|
||||||
<file>res/img/btn/btn_info_tokens.png</file>
|
<file>res/img/btn/btn_info_tokens.png</file>
|
||||||
|
<file>res/img/btn/btn_history_to_send.png</file>
|
||||||
|
<file>res/img/btn/btn_restart_to_send.png</file>
|
||||||
|
|
||||||
<file>res/img/btn/btn_update.png</file>
|
<file>res/img/btn/btn_update.png</file>
|
||||||
<file>res/img/btn/btn_download.png</file>
|
<file>res/img/btn/btn_download.png</file>
|
||||||
<file>res/img/btn/net_ok.png</file>
|
<file>res/img/btn/net_ok.png</file>
|
||||||
|
|||||||
BIN
res/img/btn/btn_history_to_send.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 906 B |
|
Before Width: | Height: | Size: 831 B After Width: | Height: | Size: 981 B |
BIN
res/img/btn/btn_restart_to_send.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
@ -64,6 +64,7 @@ QTableWidget::item:focus#m_session_systeam_info
|
|||||||
|
|
||||||
QLineEdit#m_msg_header{
|
QLineEdit#m_msg_header{
|
||||||
height:25px;
|
height:25px;
|
||||||
|
width:25px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
}
|
}
|
||||||
@ -72,36 +73,71 @@ QTextEdit#m_msg_history{
|
|||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton#m_msg_header_ico{
|
QPushButton#m_msg_system_header_ico,
|
||||||
|
QPushButton#m_msg_user_header_ico{
|
||||||
|
height:50px;
|
||||||
|
width:50px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
image:url(":/res/img/btn/default_header.png");
|
image:url(":/res/img/btn/default_header.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton#m_msg_user_del,
|
QPushButton#m_msg_user_del,
|
||||||
QPushButton#m_msg_system_del{
|
QPushButton#m_msg_system_del{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
image:url(":/res/img/btn/btn_info_delete.png");
|
image:url(":/res/img/btn/btn_info_delete.png");
|
||||||
}
|
}
|
||||||
QPushButton#m_msg_copy{
|
QPushButton#m_msg_copy{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
image:url(":/res/img/btn/btn_info_copy.png");
|
image:url(":/res/img/btn/btn_info_copy.png");
|
||||||
}
|
}
|
||||||
QPushButton#m_msg_save{
|
QPushButton#m_msg_save{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
image:url(":/res/img/btn/btn_info_save.png");
|
image:url(":/res/img/btn/btn_info_save.png");
|
||||||
}
|
}
|
||||||
QPushButton#m_msg_menu{
|
QPushButton#m_msg_menu{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
image:url(":/res/img/btn/btn_msg_menu.png");
|
image:url(":/res/img/btn/btn_msg_menu.png");
|
||||||
}
|
}
|
||||||
QPushButton#m_msg_fold,QPushButton#m_msg_tokens{
|
QPushButton#m_msg_fold{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
border:none;
|
border:none;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
QPushButton#m_msg_tokens{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
|
border:none;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
image:url(":res/img/btn/btn_info_tokens.png");
|
||||||
|
}
|
||||||
|
QPushButton#m_history_to_send{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
|
border:none;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
image:url(":res/img/btn/btn_history_to_send.png");
|
||||||
|
}
|
||||||
|
QPushButton#m_restart_to_send{
|
||||||
|
height:25px;
|
||||||
|
width:25px;
|
||||||
|
border:none;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
image:url(":res/img/btn/btn_restart_to_send.png");
|
||||||
|
}
|
||||||
|
|
||||||
QPushButton#BTN_DOWNLOAD{
|
QPushButton#BTN_DOWNLOAD{
|
||||||
width:25px;
|
width:25px;
|
||||||
|
|||||||
@ -13,23 +13,25 @@ void ctai_history_textedit::init_layout(msg_type msg_type_mode)
|
|||||||
mainLayout = new QVBoxLayout();
|
mainLayout = new QVBoxLayout();
|
||||||
// 1. 消息头垂直
|
// 1. 消息头垂直
|
||||||
headerLayout = new QVBoxLayout();
|
headerLayout = new QVBoxLayout();
|
||||||
// 消息头水平
|
|
||||||
header_info_Layout = new QHBoxLayout();
|
header_info_Layout = new QHBoxLayout();
|
||||||
m_msg_header_ico = new QPushButton();
|
|
||||||
m_msg_header_ico->setObjectName("m_msg_header_ico");
|
|
||||||
m_msg_header = new QLineEdit();
|
m_msg_header = new QLineEdit();
|
||||||
m_msg_header->setObjectName("m_msg_header");
|
m_msg_header->setObjectName("m_msg_header");
|
||||||
m_msg_header->setReadOnly(true);
|
m_msg_header->setReadOnly(true);
|
||||||
header_info_Layout->addWidget(m_msg_header_ico);
|
|
||||||
header_info_Layout->addWidget(m_msg_header);
|
|
||||||
header_info_Layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
headerLayout->addLayout(header_info_Layout);
|
|
||||||
|
|
||||||
if (msg_type_mode == SYSTEM)
|
if (msg_type_mode == SYSTEM)
|
||||||
{
|
{
|
||||||
|
//SYSTEM消息头水平
|
||||||
|
m_msg_system_header_ico = new QPushButton();
|
||||||
|
m_msg_system_header_ico->setObjectName("m_msg_system_header_ico");
|
||||||
|
header_info_Layout->addWidget(m_msg_system_header_ico);
|
||||||
|
header_info_Layout->addWidget(m_msg_header);
|
||||||
|
header_info_Layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
headerLayout->addLayout(header_info_Layout);
|
||||||
// 2.tokens功能按钮
|
// 2.tokens功能按钮
|
||||||
m_msg_tokens = new QPushButton(QIcon(":res/img/btn/btn_info_tokens.png"), NULL);
|
m_msg_tokens = new QPushButton();
|
||||||
m_msg_tokens->setObjectName("m_msg_tokens");
|
m_msg_tokens->setObjectName("m_msg_tokens");
|
||||||
|
m_history_to_send=new QPushButton();
|
||||||
|
m_history_to_send->setObjectName("m_history_to_send");
|
||||||
|
header_info_Layout->addWidget(m_history_to_send);
|
||||||
header_info_Layout->addWidget(m_msg_tokens);
|
header_info_Layout->addWidget(m_msg_tokens);
|
||||||
// 3.消息功能区
|
// 3.消息功能区
|
||||||
|
|
||||||
@ -39,13 +41,17 @@ void ctai_history_textedit::init_layout(msg_type msg_type_mode)
|
|||||||
m_msg_save = new QPushButton();
|
m_msg_save = new QPushButton();
|
||||||
m_msg_menu = new QPushButton();
|
m_msg_menu = new QPushButton();
|
||||||
m_msg_fold = new QPushButton();
|
m_msg_fold = new QPushButton();
|
||||||
|
m_restart_to_send= new QPushButton();
|
||||||
m_msg_system_del->setObjectName("m_msg_system_del");
|
m_msg_system_del->setObjectName("m_msg_system_del");
|
||||||
|
m_restart_to_send->setObjectName("m_restart_to_send");
|
||||||
m_msg_copy->setObjectName("m_msg_copy");
|
m_msg_copy->setObjectName("m_msg_copy");
|
||||||
m_msg_save->setObjectName("m_msg_save");
|
m_msg_save->setObjectName("m_msg_save");
|
||||||
m_msg_menu->setObjectName("m_msg_menu");
|
m_msg_menu->setObjectName("m_msg_menu");
|
||||||
m_msg_fold->setObjectName("m_msg_fold");
|
m_msg_fold->setObjectName("m_msg_fold");
|
||||||
m_msg_fold->setIcon(QIcon(":res/img/btn/btn_info_up.png"));
|
m_msg_fold->setIcon(QIcon(":res/img/btn/btn_info_up.png"));
|
||||||
header_opts_Layout->addItem(sparcer_item);
|
m_msg_fold->setMinimumSize(QSize(25,25));
|
||||||
|
header_opts_Layout->addItem(sparcer_item);
|
||||||
|
header_opts_Layout->addWidget(m_restart_to_send);
|
||||||
header_opts_Layout->addWidget(m_msg_system_del);
|
header_opts_Layout->addWidget(m_msg_system_del);
|
||||||
header_opts_Layout->addWidget(m_msg_copy);
|
header_opts_Layout->addWidget(m_msg_copy);
|
||||||
header_opts_Layout->addWidget(m_msg_save);
|
header_opts_Layout->addWidget(m_msg_save);
|
||||||
@ -57,14 +63,29 @@ void ctai_history_textedit::init_layout(msg_type msg_type_mode)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//SYSTEM MSG ICO
|
||||||
|
m_msg_user_header_ico = new QPushButton();
|
||||||
|
m_msg_user_header_ico->setObjectName("m_msg_system_header_ico");
|
||||||
|
header_info_Layout->addWidget(m_msg_user_header_ico);
|
||||||
|
header_info_Layout->addWidget(m_msg_header);
|
||||||
|
header_info_Layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
headerLayout->addLayout(header_info_Layout);
|
||||||
|
//USER DELETE BUTTON
|
||||||
m_msg_user_del = new QPushButton();
|
m_msg_user_del = new QPushButton();
|
||||||
m_msg_user_del->setObjectName("m_msg_user_del");
|
m_msg_user_del->setObjectName("m_msg_user_del");
|
||||||
|
m_history_to_send=new QPushButton();
|
||||||
|
m_history_to_send->setObjectName("m_history_to_send");
|
||||||
|
m_restart_to_send= new QPushButton();
|
||||||
|
m_restart_to_send->setObjectName("m_restart_to_send");
|
||||||
|
header_info_Layout->addWidget(m_restart_to_send);
|
||||||
|
header_info_Layout->addWidget(m_history_to_send);
|
||||||
header_info_Layout->addWidget(m_msg_user_del);
|
header_info_Layout->addWidget(m_msg_user_del);
|
||||||
}
|
}
|
||||||
// 4.分割线区域
|
// 4.分割线区域
|
||||||
hLine = new QFrame;
|
hLine = new QFrame;
|
||||||
hLine->setFrameShape(QFrame::HLine); // 关键属性
|
hLine->setFrameShape(QFrame::HLine); // 关键属性
|
||||||
hLine->setLineWidth(1); // 线宽
|
hLine->setFrameShadow(QFrame::Sunken); // 凹陷效果
|
||||||
|
hLine->setLineWidth(2); // 线宽
|
||||||
// 5. 历史信息QTextEdit
|
// 5. 历史信息QTextEdit
|
||||||
historyLayout = new QVBoxLayout();
|
historyLayout = new QVBoxLayout();
|
||||||
m_msg_history = new QTextEdit();
|
m_msg_history = new QTextEdit();
|
||||||
@ -72,7 +93,7 @@ void ctai_history_textedit::init_layout(msg_type msg_type_mode)
|
|||||||
m_msg_history->setLineWrapMode(QTextEdit::WidgetWidth);
|
m_msg_history->setLineWrapMode(QTextEdit::WidgetWidth);
|
||||||
m_msg_history->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
m_msg_history->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
// 添加性能优化设置
|
// 添加性能优化设置
|
||||||
m_msg_history->setUndoRedoEnabled(false); // 禁用撤销重做
|
m_msg_history->setUndoRedoEnabled(false); // 禁用撤销重做
|
||||||
m_msg_history->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
m_msg_history->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
m_msg_history->setObjectName("m_msg_history");
|
m_msg_history->setObjectName("m_msg_history");
|
||||||
m_msg_history->setReadOnly(true);
|
m_msg_history->setReadOnly(true);
|
||||||
@ -90,6 +111,7 @@ void ctai_history_textedit::init_layout(msg_type msg_type_mode)
|
|||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
connect_signals(msg_type_mode);
|
connect_signals(msg_type_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctai_history_textedit::connect_signals(msg_type msg_type_mode)
|
void ctai_history_textedit::connect_signals(msg_type msg_type_mode)
|
||||||
{
|
{
|
||||||
if (msg_type_mode == SYSTEM)
|
if (msg_type_mode == SYSTEM)
|
||||||
|
|||||||
@ -71,7 +71,8 @@ private:
|
|||||||
QVBoxLayout *historyLayout={};
|
QVBoxLayout *historyLayout={};
|
||||||
QHBoxLayout *header_opts_Layout={};
|
QHBoxLayout *header_opts_Layout={};
|
||||||
|
|
||||||
QPushButton *m_msg_header_ico={};
|
QPushButton *m_msg_system_header_ico={};
|
||||||
|
QPushButton *m_msg_user_header_ico={};
|
||||||
QLineEdit *m_msg_header={};
|
QLineEdit *m_msg_header={};
|
||||||
QTextEdit *m_msg_history={};
|
QTextEdit *m_msg_history={};
|
||||||
QPushButton *m_msg_user_del={};
|
QPushButton *m_msg_user_del={};
|
||||||
@ -81,6 +82,8 @@ private:
|
|||||||
QPushButton *m_msg_menu={};
|
QPushButton *m_msg_menu={};
|
||||||
QPushButton *m_msg_fold={}; // 折叠按钮
|
QPushButton *m_msg_fold={}; // 折叠按钮
|
||||||
QPushButton *m_msg_tokens={};
|
QPushButton *m_msg_tokens={};
|
||||||
|
QPushButton *m_history_to_send={};
|
||||||
|
QPushButton *m_restart_to_send={};
|
||||||
//tokens消耗显示
|
//tokens消耗显示
|
||||||
QMenu *m_msg_tokens_menu={};
|
QMenu *m_msg_tokens_menu={};
|
||||||
QAction *m_menu_prompt_tokens={};
|
QAction *m_menu_prompt_tokens={};
|
||||||
|
|||||||
@ -16,8 +16,7 @@ QString markdown_to_html(const QString& text) {
|
|||||||
// 转换回QString并处理代码块
|
// 转换回QString并处理代码块
|
||||||
QString result = QString::fromUtf8(html);
|
QString result = QString::fromUtf8(html);
|
||||||
free(html);
|
free(html);
|
||||||
|
return process_code_blocks(result.toUtf8());
|
||||||
return process_code_blocks(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString escape_html(const QString& text) {
|
QString escape_html(const QString& text) {
|
||||||
|
|||||||