mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-15 15:41:38 +00:00
Fixed empty model ID handling in local transcription providers
This commit is contained in:
parent
e9288f59bc
commit
6f4ca5232b
@ -554,10 +554,22 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
|
|
||||||
await using var fileStream = File.OpenRead(audioFilePath);
|
await using var fileStream = File.OpenRead(audioFilePath);
|
||||||
using var fileContent = new StreamContent(fileStream);
|
using var fileContent = new StreamContent(fileStream);
|
||||||
|
|
||||||
|
// Set the content type based on the file extension:
|
||||||
fileContent.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
|
fileContent.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
|
||||||
|
|
||||||
|
// Add the file content to the form data:
|
||||||
form.Add(fileContent, "file", Path.GetFileName(audioFilePath));
|
form.Add(fileContent, "file", Path.GetFileName(audioFilePath));
|
||||||
form.Add(new StringContent(transcriptionModel.Id), "model");
|
|
||||||
|
//
|
||||||
|
// Add the model name to the form data. Ensure that a model name is always provided.
|
||||||
|
// Otherwise, the StringContent constructor will throw an exception.
|
||||||
|
//
|
||||||
|
var modelName = transcriptionModel.Id;
|
||||||
|
if (string.IsNullOrWhiteSpace(modelName))
|
||||||
|
modelName = "placeholder";
|
||||||
|
|
||||||
|
form.Add(new StringContent(modelName), "model");
|
||||||
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Post, host.TranscriptionURL());
|
using var request = new HttpRequestMessage(HttpMethod.Post, host.TranscriptionURL());
|
||||||
request.Content = form;
|
request.Content = form;
|
||||||
|
|||||||
@ -5,4 +5,5 @@
|
|||||||
- Fixed a logging bug that prevented log events from being recorded in some cases.
|
- Fixed a logging bug that prevented log events from being recorded in some cases.
|
||||||
- Fixed a bug that allowed adding a provider without selecting a model.
|
- Fixed a bug that allowed adding a provider without selecting a model.
|
||||||
- Fixed a bug with local transcription providers by handling errors correctly when the local provider is unavailable.
|
- Fixed a bug with local transcription providers by handling errors correctly when the local provider is unavailable.
|
||||||
|
- Fixed a bug with local transcription providers by correctly handling empty model IDs.
|
||||||
- Fixed a bug affecting the transcription preview: previously, when you stopped music or other media, recorded or dictated text, and then tried to resume playback, the media wouldn’t resume as expected. This behavior is now fixed.
|
- Fixed a bug affecting the transcription preview: previously, when you stopped music or other media, recorded or dictated text, and then tried to resume playback, the media wouldn’t resume as expected. This behavior is now fixed.
|
||||||
Loading…
Reference in New Issue
Block a user