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
|
||||
var tmpfile *os.File
|
||||
var err error
|
||||
|
||||
if filename != "" {
|
||||
tmpfile, err = os.CreateTemp("", filename)
|
||||
} else {
|
||||
tmpfile, err = os.CreateTemp("", "image.*.jpg")
|
||||
}
|
||||
tmpfile, err := os.Create(filename)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
func UploadToS3(filePath string) (*s3manager.UploadOutput, error) {
|
||||
bucket := os.Getenv("BUCKET_NAME")
|
||||
fmt.Println("The filepath is: ", filePath)
|
||||
if bucket == "" {
|
||||
fmt.Println("No S3 bucket specified, skipping upload.")
|
||||
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
|
||||
filename := data.Event.Sender().Username + "_" + timestamp + ".jpg"
|
||||
fmt.Println("The filename is: ", filename)
|
||||
|
||||
imageFile, err := lib.ReplicateImageGeneration(options.Prompt, filename)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue