37 lines
916 B
Go
37 lines
916 B
Go
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
|
|
|
package chatpb
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
// returns true if the pb was added
|
|
// to indicate that ConfigSave() should be run to write it out to disk
|
|
func (c *Chat) AddGeminiRequest(fname string, age time.Time, pb *GeminiRequest) bool {
|
|
for _, e := range c.GetEntries() {
|
|
if e.GetContentFile() == fname {
|
|
log.Info("fname already here", fname)
|
|
if iContent, iParts, ok := e.VerifyGeminiRequest(pb); ok {
|
|
log.Info("pb is already here with same size", iContent, iParts)
|
|
return false
|
|
} else {
|
|
log.Info("pb is already here but things don't match", iContent, iParts)
|
|
}
|
|
return false
|
|
}
|
|
}
|
|
log.Info("not sure if c.Entries == pb for real. need to read Content & Parts")
|
|
/*
|
|
e := new(ChatEntry)
|
|
e.Ctime = timestamppb.New(age)
|
|
e.From = Who_USER
|
|
e.ContentFile = fname
|
|
e.GeminiRequest = pb
|
|
c.AppendEntry(e)
|
|
*/
|
|
return true
|
|
}
|