feat(location): working e2e with tool calling
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user