This commit is contained in:
2025-04-14 11:37:34 +02:00
5 changed files with 38 additions and 13 deletions

View File

@ -20,8 +20,11 @@ You can use tools to achieve your task.
You should use listContacts to make sure that you don't create duplicate contacts. You should use listContacts to make sure that you don't create duplicate contacts.
Call createContact when you see there is a new contact on this image. Do not create duplicate contacts. Call createContact when you see there is a new contact on this image.
Or call linkContact when you think this image contains an existing contact.
Call linkContact when you think this image contains an existing contact.
Links an image to a contact. Only call this when you know theres a very close match from listContacts.
Otherwise create a new contact.
Call finish if you dont think theres anything else to do. Call finish if you dont think theres anything else to do.
` `

View File

@ -22,13 +22,14 @@ This could be a friend suggesting to meet, a conference, or anything that looks
There are various tools you can use to perform this task. There are various tools you can use to perform this task.
listEvents listEvents
Lists the users already existing events, you should do this before using createEvents to avoid creating duplicates. Lists the users already existing events.
createEvent createEvent
Use this to create a new events. Use this to create a new events.
linkEvent linkEvent
Links an image to a events. Links an image to an event. Only call this when you know theres a very close match from listEvents.
Otherwise create a new event.
finish finish
Call when there is nothing else to do. Call when there is nothing else to do.

View File

@ -16,18 +16,20 @@ import (
const locationPrompt = ` const locationPrompt = `
You are an agent. You are an agent.
The user will send you images and you have to identify if they have any location or a place. This could a picture of a real place, an address, or it's name. The user will send you images and you have to identify if they have any location or a place.
This could a picture of a real place, an address, or it's name.
There are various tools you can use to perform this task. There are various tools you can use to perform this task.
listLocations listLocations
Lists the users already existing locations, you should do this before using createLocation to avoid creating duplicates. Lists the users already existing locations.
createLocation createLocation
Use this to create a new location. Avoid making duplicates and only create a new location if listLocations doesnt contain the location on the image. Use this to create a new location.
linkLocation linkLocation
Links an image to a location. Links an image to a location. Only call this when you know theres a very close match from listLocation.
Otherwise create a new location.
finish finish
Call when there is nothing else to do. Call when there is nothing else to do.

View File

@ -85,27 +85,42 @@ func main() {
return return
} }
fmt.Printf("Returned from DB: %+x\n", images)
type DataType struct { type DataType struct {
Type string `json:"type"` Type string `json:"type"`
Data any `json:"data"` Data any `json:"data"`
} }
dataTypes := make([]DataType, 0) dataTypes := make([]DataType, 0)
// lord
// forgive me
idMap := make(map[uuid.UUID]bool)
for _, image := range images { for _, image := range images {
for _, location := range image.Locations { for _, location := range image.Locations {
_, exists := idMap[location.ID]
if exists {
continue
}
dataTypes = append(dataTypes, DataType{ dataTypes = append(dataTypes, DataType{
Type: "location", Type: "location",
Data: location, Data: location,
}) })
idMap[location.ID] = true
} }
for _, event := range image.Events { for _, event := range image.Events {
_, exists := idMap[event.ID]
if exists {
continue
}
dataTypes = append(dataTypes, DataType{ dataTypes = append(dataTypes, DataType{
Type: "event", Type: "event",
Data: event, Data: event,
}) })
idMap[event.ID] = true
} }
for _, note := range image.Notes { for _, note := range image.Notes {
@ -113,13 +128,20 @@ func main() {
Type: "note", Type: "note",
Data: note, Data: note,
}) })
idMap[note.ID] = true
} }
for _, contact := range image.Contacts { for _, contact := range image.Contacts {
_, exists := idMap[contact.ID]
if exists {
continue
}
dataTypes = append(dataTypes, DataType{ dataTypes = append(dataTypes, DataType{
Type: "contact", Type: "contact",
Data: contact, Data: contact,
}) })
idMap[contact.ID] = true
} }
} }

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt"
"log" "log"
"screenmark/screenmark/.gen/haystack/haystack/model" "screenmark/screenmark/.gen/haystack/haystack/model"
. "screenmark/screenmark/.gen/haystack/haystack/table" . "screenmark/screenmark/.gen/haystack/haystack/table"
@ -89,10 +88,8 @@ func (m UserModel) ListWithProperties(ctx context.Context, userId uuid.UUID) ([]
WHERE(UserImages.UserID.EQ(UUID(userId))) WHERE(UserImages.UserID.EQ(UUID(userId)))
images := []ImageWithProperties{} images := []ImageWithProperties{}
err := listWithPropertiesStmt.QueryContext(ctx, m.dbPool, &images) err := listWithPropertiesStmt.QueryContext(ctx, m.dbPool, &images)
fmt.Println(images)
if err != nil { if err != nil {
return images, err return images, err
} }