audio transcription with buffer not work
Closed this issue · 0 comments
seanchann commented
Describe the bug
In Audio components, the transcribe API if you use the following code:
netimpl::components::Multipart form = { {"file", netimpl::components::Buffer{buffer.begin(), buffer.end(), "test.wav"}}, {"model", model}};
then in curl post a request to OpenAI server that not work. the error is a request body, not a file.
To Reproduce
- use transcribe API. but with a buffer part.
- call function send a HTTP request
Code snippets
in void liboai::netimpl::Session::SetMultipart(components::Multipart&& multipart):
`
else if (part.is_buffer) {
mimedata.push_back(curl_mime_addpart(this->mime));
e[1] = curl_mime_name(mimedata.back(), part.name.c_str());
e[2] = curl_mime_data(mimedata.back(), reinterpret_cast<const char*>(part.data), part.datalen);
}
`
not apppend `curl_mime_filename(mimedata.back(),
part.value.c_str());` caused problems
OS
linux
Library version
liboai 4.0.1