convert is working okay

This commit is contained in:
Jeff Carr 2025-09-02 15:18:27 -05:00
parent 81343b3b66
commit 589d50d950
2 changed files with 11 additions and 3 deletions

View File

@ -16,7 +16,7 @@ type args struct {
Interact *EmptyCmd `arg:"subcommand:interact" help:"open env EDITOR"`
Playback *PlaybackCmd `arg:"subcommand:playback" help:"dump your prior conversations to the terminal'"`
NewChat *PlaybackCmd `arg:"subcommand:newchat" help:"used by gemini-cli on startup"`
Clean *EmptyCmd `arg:"subcommand:clean" help:"cleanup the files in /tmp"`
Clean *CleanCmd `arg:"subcommand:clean" help:"cleanup the files in /tmp"`
Stats string `arg:"--stats" help:"add stats to a chat"`
Force bool `arg:"--force" help:"try to strong arm things"`
Verbose bool `arg:"--verbose" help:"show more output"`
@ -27,6 +27,10 @@ type args struct {
type EmptyCmd struct {
}
type CleanCmd struct {
Match string `arg:"positional"`
}
type PlaybackCmd struct {
Last *EmptyCmd `arg:"subcommand:last" help:"dump the last one"`
List *EmptyCmd `arg:"subcommand:list" help:"list memories"`

View File

@ -36,7 +36,7 @@ func scanTmp() {
if !strings.HasPrefix(fname, "regex.") {
return nil
}
if count > 5 {
if count > 10 {
return log.Errorf("count exceeded")
}
if strings.HasPrefix(fname, "regex.gemini-api-response") {
@ -87,6 +87,11 @@ func cleanGeminiFile(fullname string) error {
return log.Errorf("parsePB() == nil")
}
uuid := parts[1]
if argv.Clean.Match != "" {
if !strings.HasPrefix(uuid, argv.Clean.Match) {
return log.Errorf("uuid %s does not match %s", uuid, argv.Clean.Match)
}
}
if chat := me.chats.FindUuid(uuid); chat != nil {
log.Info("found uuid in chat", uuid, pb.Model, chat.Uuid)
statf, err := os.Stat(fullname)
@ -94,7 +99,6 @@ func cleanGeminiFile(fullname string) error {
age := statf.ModTime()
if chat.AddGeminiRequest(fname, age, pb) {
me.chats.ConfigSave()
okExit("")
} else {
log.Info("file was perfect. os.Remove() here", fullname)
os.Remove(fullname)