更新部分功能
This commit is contained in:
parent
742a640c3f
commit
010fb8aa53
@ -146,7 +146,6 @@ void ctaiHistoryTextEdit::on_delete_slots()
|
||||
// 发送删除请求信号
|
||||
emit delete_requested(m_msg_sned_id);
|
||||
}
|
||||
|
||||
void ctaiHistoryTextEdit::on_copy_slots()
|
||||
{
|
||||
// 获取文本并复制到剪贴板
|
||||
@ -154,7 +153,6 @@ void ctaiHistoryTextEdit::on_copy_slots()
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(text);
|
||||
}
|
||||
// 保存文件
|
||||
void ctaiHistoryTextEdit::on_save_file(int index)
|
||||
{
|
||||
QString fileName;
|
||||
@ -172,26 +170,26 @@ void ctaiHistoryTextEdit::on_save_file(int index)
|
||||
return;
|
||||
}
|
||||
QTextStream out(&file);
|
||||
switch(index){
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
temp_current_content=m_msg_history->toPlainText();
|
||||
temp_current_content = m_msg_history->toPlainText();
|
||||
break;
|
||||
case 1:
|
||||
temp_current_content=m_msg_history->toHtml();
|
||||
temp_current_content = m_msg_history->toHtml();
|
||||
break;
|
||||
case 2:
|
||||
temp_current_content=m_msg_history->toMarkdown();
|
||||
temp_current_content = m_msg_history->toMarkdown();
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
if(!temp_current_content.isEmpty()){
|
||||
if (!temp_current_content.isEmpty())
|
||||
{
|
||||
out << m_current_content << "\n\n";
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
// 实现折叠功能的槽函数
|
||||
void ctaiHistoryTextEdit::on_fold_slots()
|
||||
{
|
||||
m_is_folded = !m_is_folded;
|
||||
@ -216,8 +214,6 @@ void ctaiHistoryTextEdit::on_display_changed(QString mode)
|
||||
m_msg_history->setHtml(m_math_convert->replace_tags_svg(m_current_content, m_msg_tools->getFontSize().toInt()));
|
||||
}
|
||||
}
|
||||
|
||||
// tokens按钮实现功能的槽函数
|
||||
void ctaiHistoryTextEdit::on_tokens_slots()
|
||||
{
|
||||
if (!m_msg_tokens_menu)
|
||||
@ -251,7 +247,6 @@ void ctaiHistoryTextEdit::on_tokens_slots()
|
||||
m_msg_tokens_menu->addAction(m_menu_total_tokens);
|
||||
m_msg_tokens_menu->exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ctaiHistoryTextEdit::on_sync_text_height()
|
||||
{
|
||||
// 防抖动处理:如果上次更新在100ms内,则延迟处理
|
||||
@ -264,7 +259,6 @@ void ctaiHistoryTextEdit::on_sync_text_height()
|
||||
}
|
||||
// 直接使用documentLayout获取高度,避免多次计算
|
||||
int textHeight = m_msg_history->document()->documentLayout()->documentSize().height();
|
||||
|
||||
if (textHeight > 0)
|
||||
{
|
||||
// 计算实际需要的高度 (包含边距和视口边框)
|
||||
@ -302,7 +296,7 @@ void ctaiHistoryTextEdit::add_user_message(const model_data &message)
|
||||
QString disp_data;
|
||||
disp_data = QSL(message.send_user_data);
|
||||
m_msg_sned_id = QSL(message.send_user_id);
|
||||
m_msg_history->setHtml(m_math_convert->replace_tags_svg(disp_data, m_msg_tools->getFontSize().toInt()));
|
||||
m_msg_history->setText(disp_data);
|
||||
}
|
||||
|
||||
void ctaiHistoryTextEdit::add_system_message(const model_data &message)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user