Fix ChatGTP translate - thx longhoang1993 :)

Related to #7850
This commit is contained in:
Nikolaj Olsson 2024-03-28 09:04:00 +01:00
parent 69a71c82ab
commit 2fd8ee3041
4 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
Subtitle Edit Changelog
4.0.5 (xth May 2024) BETA
4.0.5 (xth April 2024) BETA
* NEW:
* Add "Open video" toolbar button/image - thx jmaraujouy/Cyberyoda1411
* Add support for S_HDMV/TEXTST in MKV in batch/cmd-line - thx ipsi
@ -17,7 +17,8 @@
* FIXED:
* Fix for Whisper post-processing - thx Purfview/cvrle77
* Fix crash in "Fix common errors" - thx Joe
* Fix issue with NikseCombobox and ContextMenuStrip - thx ivandrofly
* Fix issue with Combobox and ContextMenuStrip - thx ivandrofly
* Fix ChatGTP translate - thx longhoang1993
4.0.4 (17th March 2024)

View File

@ -502,6 +502,11 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
return Path.Combine(GetWhisperModel().ModelFolder, model + ModelExtension());
}
if (Configuration.Settings.Tools.WhisperChoice == WhisperChoice.WhisperX && model == "large-v3")
{
return "large";
}
return model;
}

View File

@ -47,11 +47,11 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
public async Task<string> Translate(string text, string sourceLanguageCode, string targetLanguageCode, CancellationToken cancellationToken)
{
var model = Configuration.Settings.Tools.ChatGptApiKey;
var model = Configuration.Settings.Tools.ChatGptModel;
if (string.IsNullOrEmpty(model))
{
model = "gpt-3.5-turbo";
Configuration.Settings.Tools.ChatGptApiKey = model;
Configuration.Settings.Tools.ChatGptModel = model;
}
var input = "{\"model\": \"" + model + "\",\"messages\": [{ \"role\": \"user\", \"content\": \"Please translate the following text from " + sourceLanguageCode + " to " + targetLanguageCode + ", only write the result: \\n\\n" + Json.EncodeJsonText(text.Trim()) + "\" }]}";

View File

@ -166,7 +166,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
}
engines.Add(WhisperChoice.CTranslate2);
engines.Add(WhisperChoice.StableTs);
//engines.Add(WhisperChoice.WhisperX); -- impossible to install...
engines.Add(WhisperChoice.WhisperX);
foreach (var engine in engines)
{