Fixed
This commit is contained in:
parent
e283e65868
commit
4469788d91
3 changed files with 3 additions and 8 deletions
|
@ -102,14 +102,7 @@ func ReplicateImageGeneration(prompt string, filename string) (*bytes.Buffer, er
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save image to a temporary file
|
// Save image to a temporary file
|
||||||
var tmpfile *os.File
|
tmpfile, err := os.Create(filename)
|
||||||
var err error
|
|
||||||
|
|
||||||
if filename != "" {
|
|
||||||
tmpfile, err = os.CreateTemp("", filename)
|
|
||||||
} else {
|
|
||||||
tmpfile, err = os.CreateTemp("", "image.*.jpg")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
|
|
||||||
func UploadToS3(filePath string) (*s3manager.UploadOutput, error) {
|
func UploadToS3(filePath string) (*s3manager.UploadOutput, error) {
|
||||||
bucket := os.Getenv("BUCKET_NAME")
|
bucket := os.Getenv("BUCKET_NAME")
|
||||||
|
fmt.Println("The filepath is: ", filePath)
|
||||||
if bucket == "" {
|
if bucket == "" {
|
||||||
fmt.Println("No S3 bucket specified, skipping upload.")
|
fmt.Println("No S3 bucket specified, skipping upload.")
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
1
main.go
1
main.go
|
@ -189,6 +189,7 @@ func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.In
|
||||||
|
|
||||||
// Concatenate clean username and timestamp to form filename
|
// Concatenate clean username and timestamp to form filename
|
||||||
filename := data.Event.Sender().Username + "_" + timestamp + ".jpg"
|
filename := data.Event.Sender().Username + "_" + timestamp + ".jpg"
|
||||||
|
fmt.Println("The filename is: ", filename)
|
||||||
|
|
||||||
imageFile, err := lib.ReplicateImageGeneration(options.Prompt, filename)
|
imageFile, err := lib.ReplicateImageGeneration(options.Prompt, filename)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue