Files
chatlog/internal/ui/help/help.go
Shen Junzheng 78cce92ce3 x
2025-03-19 13:11:09 +08:00

88 lines
2.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package help
import (
"fmt"
"github.com/sjzar/chatlog/internal/ui/style"
"github.com/rivo/tview"
)
const (
Title = "help"
ShowTitle = "帮助"
Content = `[yellow]Chatlog 使用指南[white]
[green]基本操作:[white]
• 使用 [yellow]←→[white] 键在主菜单和帮助页面之间切换
• 使用 [yellow]↑↓[white] 键在菜单项之间移动
• 按 [yellow]Enter[white] 选择菜单项
• 按 [yellow]Esc[white] 返回上一级菜单
• 按 [yellow]Ctrl+C[white] 退出程序
[green]使用步骤:[white]
[yellow]1. 获取数据密钥[white]
选择"获取数据密钥"菜单项,程序会自动从运行中的微信进程获取密钥。
如果有多个微信进程,会自动选择当前账号的进程。
确保微信正在运行,否则无法获取密钥。
[yellow]2. 解密数据[white]
选择"解密数据"菜单项,程序会使用获取的密钥解密微信数据库文件。
解密后的文件会保存到工作目录中(可在设置中修改)。
[yellow]3. 启动 HTTP 服务[white]
选择"启动 HTTP 服务"菜单项,启动 HTTP 和 MCP 服务。
启动后可以通过浏览器访问 http://localhost:5030 查看聊天记录。
[yellow]4. 设置选项[white]
选择"设置"菜单项,可以配置:
• HTTP 服务端口 - 更改 HTTP 服务的监听端口
• 工作目录 - 更改解密数据的存储位置
[green]HTTP API 使用:[white]
• 聊天记录: [yellow]GET http://localhost:5030/api/v1/chatlog?time=2023-01-01&talker=wxid_xxx[white]
• 联系人列表: [yellow]GET http://localhost:5030/api/v1/contact[white]
• 群聊列表: [yellow]GET http://localhost:5030/api/v1/chatroom[white]
• 会话列表: [yellow]GET http://localhost:5030/api/v1/session[white]
[green]MCP 集成:[white]
Chatlog 支持 Model Context Protocol可与支持 MCP 的 AI 助手集成。
通过 MCPAI 助手可以直接查询您的聊天记录、联系人和群聊信息。
[green]常见问题:[white]
• 如果获取密钥失败,请确保微信程序正在运行
• 如果解密失败,请检查密钥是否正确获取
• 如果 HTTP 服务启动失败,请检查端口是否被占用
• 数据目录和工作目录会自动保存,下次启动时自动加载
[green]数据安全:[white]
• 所有数据处理均在本地完成,不会上传到任何外部服务器
• 请妥善保管解密后的数据,避免隐私泄露
`
)
type Help struct {
*tview.TextView
title string
}
func New() *Help {
help := &Help{
TextView: tview.NewTextView(),
title: Title,
}
help.SetDynamicColors(true)
help.SetRegions(true)
help.SetWrap(true)
help.SetTextAlign(tview.AlignLeft)
help.SetBorder(true)
help.SetBorderColor(style.BorderColor)
help.SetTitle(ShowTitle)
fmt.Fprint(help, Content)
return help
}