From 6f4ca5232bd1b5286d09975745b3118d00cf2a7b Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 18 Jan 2026 16:15:48 +0100 Subject: [PATCH] Fixed empty model ID handling in local transcription providers --- app/MindWork AI Studio/Provider/BaseProvider.cs | 16 ++++++++++++++-- .../wwwroot/changelog/v26.1.2.md | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/MindWork AI Studio/Provider/BaseProvider.cs b/app/MindWork AI Studio/Provider/BaseProvider.cs index 3e207da5..4dd27763 100644 --- a/app/MindWork AI Studio/Provider/BaseProvider.cs +++ b/app/MindWork AI Studio/Provider/BaseProvider.cs @@ -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; diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.1.2.md b/app/MindWork AI Studio/wwwroot/changelog/v26.1.2.md index f42a224e..e4a5f874 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.1.2.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.1.2.md @@ -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 wouldn’t resume as expected. This behavior is now fixed. \ No newline at end of file