Compare commits
2 Commits
706d562e3e
...
13170a33e8
Author | SHA1 | Date | |
---|---|---|---|
13170a33e8 | |||
5024933852 |
@ -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.
|
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.
|
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 {
|
type DescriptionAgent struct {
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"screenmark/screenmark/agents"
|
"screenmark/screenmark/agents"
|
||||||
"screenmark/screenmark/models"
|
"screenmark/screenmark/models"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
@ -64,14 +65,22 @@ func ListenNewImageEvents(db *sql.DB, notifier *Notifier[Notification]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
descriptionAgent := agents.NewDescriptionAgent(createLogger("Description 📝", splitWriter), imageModel)
|
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 := 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)
|
_, err = imageModel.FinishProcessing(ctx, image.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user