mirror of
https://github.com/sjzar/chatlog.git
synced 2026-06-11 21:01:01 +08:00
aitxt格式导出
This commit is contained in:
parent
8b5b7cada5
commit
7c8cb43afd
@ -962,7 +962,7 @@ func (a *App) exportChat(talker, displayName string) {
|
||||
a.mainPages.RemovePage("modal")
|
||||
a.mainPages.SwitchToPage("main")
|
||||
})
|
||||
// 为模态框添加输入处理函数,确保回车键可以关闭对话框
|
||||
|
||||
modal.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
|
||||
if event.Key() == tcell.KeyEnter {
|
||||
a.mainPages.RemovePage("modal")
|
||||
|
||||
@ -141,8 +141,15 @@ func (s *Service) GetChatlog(c *gin.Context) {
|
||||
// 添加日期分隔线
|
||||
c.Writer.WriteString("\n********************" + date + "********************\n\n")
|
||||
|
||||
// 输出该日期下的所有消息
|
||||
for _, m := range msgs {
|
||||
senderName := m.SenderName
|
||||
if m.IsSelf {
|
||||
senderName = "我"
|
||||
} else if senderName == "" {
|
||||
senderName = m.Sender
|
||||
}
|
||||
|
||||
c.Writer.WriteString(senderName + ": ")
|
||||
c.Writer.WriteString(m.PlainTextContent())
|
||||
c.Writer.WriteString("\n\n")
|
||||
}
|
||||
|
||||
@ -417,8 +417,9 @@ func (m *Manager) ExportChatlogTXT(talker string, timeRange string, outputPath s
|
||||
senderName = msg.Sender
|
||||
}
|
||||
|
||||
f.WriteString(senderName + " ")
|
||||
f.WriteString(msg.Time.Format("15:04:05") + "\n")
|
||||
//f.WriteString(senderName + " ")
|
||||
//f.WriteString(msg.Time.Format("15:04:05") + "\n")
|
||||
f.WriteString(senderName + ": ")
|
||||
|
||||
// 设置消息内容中可能需要的主机信息
|
||||
msg.SetContent("host", host)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user