history

package
v0.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetCurrentSessionID = session.GetCurrentSessionID

Functions

func CleanupReverse

func CleanupReverse(messages []prompt.Message) (cleaned []prompt.Message)

CleanupReverse - make the messages clean, remove the mistake message

func JudgeHistory

func JudgeHistory(messages []*prompt.Message)

JudgeHistory - Cleanup the history

func ListHistory

func ListHistory(ctx context.Context) ([]*prompt.Message, error)

ListHistory 加载指定会话的所有历史消息,按时间升序返回

func LoadHistory

func LoadHistory(ctx context.Context) ([]prompt.Message, error)

LoadHistory 加载指定会话的所有历史消息,按时间升序返回

func ShowMessage

func ShowMessage(ctx context.Context, id int64) (message *prompt.Message, err error)

func ToSQLNullString

func ToSQLNullString(tcs []prompt.ToolCall) (toolCalls sql.NullString)

func Truncate

func Truncate(content string, maxLen int) string

Truncate 截断内容用于预览

func UpdateContent

func UpdateContent(ctx context.Context, id int64, content string) (err error)

UpdateContent update message content

func UpdateHistory

func UpdateHistory(ctx context.Context, id int64) (err error)

UpdateHistory update message session_id to 0

func UpdateToolCalls

func UpdateToolCalls(ctx context.Context, id int64, tcs []prompt.ToolCall) (err error)

UpdateToolCalls update message content

Types

type Result

type Result struct {
	Message     prompt.Message
	ProjectPath string
}

Result 搜索结果

func SearchMessages

func SearchMessages(ctx context.Context, keywords []string, days int, limit int) ([]Result, error)

SearchMessages 搜索消息,支持多关键词(空格分隔),按 LIKE 匹配 只搜索 role=user 和 role=assistant(无tool_calls) 的消息 仅搜索当前 session(对应当前项目)的消息,避免跨项目回忆 days: 搜索最近N天,<=0 表示不限时间 limit: 返回结果数量上限

Source Files

  • history.go
  • recall.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL