2 Commits

2 changed files with 19 additions and 7 deletions

View File

@ -15,6 +15,9 @@ You are an AI agent who's job is to describe the image you see.
You should also add any text you see in the image, if no text exists, just add a description.
Be consise and don't add too much extra information or formatting characters, simple text.
You must write this text in Markdown. You can add extra information for the user.
You must organise this text nicely, not be all over the place.
`
type DescriptionAgent struct {

View File

@ -10,6 +10,7 @@ import (
"screenmark/screenmark/agents"
"screenmark/screenmark/models"
"strconv"
"sync"
"time"
"github.com/charmbracelet/log"
@ -64,14 +65,22 @@ func ListenNewImageEvents(db *sql.DB, notifier *Notifier[Notification]) {
}
descriptionAgent := agents.NewDescriptionAgent(createLogger("Description 📝", splitWriter), imageModel)
err = descriptionAgent.Describe(createLogger("Description 📓", splitWriter), image.Image.ID, image.Image.ImageName, image.Image.Image)
if err != nil {
log.Error(err)
}
listAgent := agents.NewListAgent(createLogger("Lists 🖋️", splitWriter), listModel)
listAgent.RunAgent(image.UserID, image.ImageID, image.Image.ImageName, image.Image.Image)
var wg sync.WaitGroup
wg.Add(2)
go func() {
descriptionAgent.Describe(createLogger("Description 📓", splitWriter), image.Image.ID, image.Image.ImageName, image.Image.Image)
wg.Done()
}()
go func() {
listAgent.RunAgent(image.UserID, image.ImageID, image.Image.ImageName, image.Image.Image)
wg.Done()
}()
wg.Wait()
_, err = imageModel.FinishProcessing(ctx, image.ID)
if err != nil {