Fixed empty model ID handling in local transcription providers

This commit is contained in:
Thorsten Sommer 2026-01-18 16:15:48 +01:00
parent e9288f59bc
commit 6f4ca5232b
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 15 additions and 2 deletions

View File

@ -554,10 +554,22 @@ public abstract class BaseProvider : IProvider, ISecretId
await using var fileStream = File.OpenRead(audioFilePath);
using var fileContent = new StreamContent(fileStream);
// Set the content type based on the file extension:
fileContent.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
// Add the file content to the form data:
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());
request.Content = form;

View File

@ -5,4 +5,5 @@
- 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 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 wouldnt resume as expected. This behavior is now fixed.