Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio format being saved as video/webm #265

Open
cheresanford opened this issue Sep 11, 2024 · 0 comments
Open

Audio format being saved as video/webm #265

cheresanford opened this issue Sep 11, 2024 · 0 comments

Comments

@cheresanford
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant