deep-chat icon indicating copy to clipboard operation
deep-chat copied to clipboard

Audio format being saved as video/webm

Open cheresanford opened this issue 1 year ago • 0 comments

Hello @OvidijusParsiunas ! First off thanks for the great package! I'm running on a little issue though. I've implemented the deep-chat component on my Vue 3 app, as follows:

<deep-chat ref="deepChat" style="width: 100%; height: 100%" :audio=true :connect="chatConnection" :avatars="avatars" :textInput="textInputStyle" :submitButtonStyles="submitButtonStyles" :messageStyles="messageStyles" :requestInterceptor="requestInterceptor" :microphone="microphoneStyles" :history="chatHistory" @message="formatSpecificMessage" >

imagem_2024-09-10_214300691

On my frontend request it seems like the audio format is fine, but when I save it on my back-end (running locally) even though the extension shows as .mp3, if I upload the downloaded file into a file type checking website, it shows video/webm: imagem_2024-09-10_214528886 Which is also why my request to transcribe the audio file to ChatGPT isn't working with the downloaded file.

On my server side, utilizing Golang, nothing seems odd and I'm testing it pretty straightforward:

func GenerateChatCompletion(c *gin.Context) { isAudioMessage := false audioTranscription := "" // try to get formData files from the request files, header, _ := c.Request.FormFile("files") // if has files, save it and return the path if files != nil { isAudioMessage = true fileName := header.Filename

	// print header content-type
	print("Content-Type: ", header.Header.Get("Content-Type"), "\n")

	// File path
	var filePath string
	if os.Getenv("AWS_LAMBDA_RUNTIME_API") == "" {
		// Save the file to ./files directory
		filePath = filepath.Join("./files", fileName)
		destFile, err := os.Create(filePath)
		if err != nil {
			c.JSON(500, gin.H{
				"error":   true,
				"data":    nil,
				"message": "Failed to create file: " + err.Error(),
				"code":    500,
			})
			return
		}
		defer destFile.Close()
		}

Program ends after that with the file saved, but with video/webm MIME type though.

cheresanford avatar Sep 11 '24 00:09 cheresanford