feat(location): working e2e with tool calling

This commit is contained in:
2025-03-22 12:22:31 +00:00
parent 7b6c7090f8
commit dfb4b34de3
5 changed files with 170 additions and 76 deletions

View File

@@ -55,7 +55,7 @@ func (m LocationModel) List(ctx context.Context, userId uuid.UUID) ([]model.Loca
return locations, err
}
func (m LocationModel) Save(ctx context.Context, locations []model.Locations) (model.Locations, error) {
func (m LocationModel) Save(ctx context.Context, locations []model.Locations) ([]model.Locations, error) {
insertLocationStmt := Locations.
INSERT(Locations.Name, Locations.Address, Locations.Coordinates, Locations.Description)
@@ -67,7 +67,7 @@ func (m LocationModel) Save(ctx context.Context, locations []model.Locations) (m
log.Println(insertLocationStmt.DebugSql())
insertedLocation := model.Locations{}
insertedLocation := []model.Locations{}
err := insertLocationStmt.QueryContext(ctx, m.dbPool, &insertedLocation)
return insertedLocation, err
@@ -84,9 +84,11 @@ func (m LocationModel) SaveToImage(ctx context.Context, imageId uuid.UUID, locat
return err
}
// TODO: doesnt work if array is more than 1. BIG TODO
insertImageLocationStmt := ImageLocations.
INSERT(ImageLocations.ImageID, ImageLocations.LocationID).
VALUES(imageId, location.ID)
VALUES(imageId, location[0].ID)
_, err = insertImageLocationStmt.ExecContext(ctx, m.dbPool)