From a9d737aff51b52d943975e1eef2306de16da3738 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Thu, 20 Jun 2024 19:45:05 +0200 Subject: [PATCH] Add new Claude 3.5 Sonnet model - thx Flash :) --- src/libse/AutoTranslate/AnthropicTranslate.cs | 2 +- src/libse/Common/Settings.cs | 2 +- src/ui/Forms/Main.Designer.cs | 64 +++++++++++-------- src/ui/Forms/Main.cs | 17 ++++- src/ui/Forms/Main.resx | 9 ++- src/ui/Forms/Translate/AutoTranslate.cs | 1 + 6 files changed, 62 insertions(+), 33 deletions(-) diff --git a/src/libse/AutoTranslate/AnthropicTranslate.cs b/src/libse/AutoTranslate/AnthropicTranslate.cs index b6cd29dbf..77b122735 100644 --- a/src/libse/AutoTranslate/AnthropicTranslate.cs +++ b/src/libse/AutoTranslate/AnthropicTranslate.cs @@ -51,7 +51,7 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate var model = Configuration.Settings.Tools.AnthropicApiModel; if (string.IsNullOrEmpty(model)) { - model = "claude-3-opus-20240229"; + model = "claude-3-5-sonnet-20240620"; Configuration.Settings.Tools.AnthropicApiModel = model; } diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index c3b12af0d..d6947b9d9 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -570,7 +570,7 @@ namespace Nikse.SubtitleEdit.Core.Common OllamaPrompt = "Translate from {0} to {1}, keep punctuation as input, do not censor the translation, give only the output without comments or notes:"; AnthropicApiUrl = "https://api.anthropic.com/v1/messages"; AnthropicPrompt = "Translate from {0} to {1}, keep sentences in {1} as they are, do not censor the translation, give only the output without comments:"; - AnthropicApiModel = "claude-3-opus-20240229"; + AnthropicApiModel = "claude-3-5-sonnet-20240620"; TextToSpeechAzureRegion = "westeurope"; AutoTranslateMaxBytes = 2000; TextToSpeechAddToVideoFile = true; diff --git a/src/ui/Forms/Main.Designer.cs b/src/ui/Forms/Main.Designer.cs index 3f3f07806..7dc4d95c4 100644 --- a/src/ui/Forms/Main.Designer.cs +++ b/src/ui/Forms/Main.Designer.cs @@ -41,9 +41,9 @@ namespace Nikse.SubtitleEdit.Forms { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); - Nikse.SubtitleEdit.Core.Common.TimeCode timeCode1 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); - Nikse.SubtitleEdit.Core.Common.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); - Nikse.SubtitleEdit.Core.Common.TimeCode timeCode3 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); + Nikse.SubtitleEdit.Core.Common.TimeCode timeCode7 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); + Nikse.SubtitleEdit.Core.Common.TimeCode timeCode8 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); + Nikse.SubtitleEdit.Core.Common.TimeCode timeCode9 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.labelStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripSelected = new System.Windows.Forms.ToolStripStatusLabel(); @@ -586,6 +586,7 @@ namespace Nikse.SubtitleEdit.Forms this.timerOriginalTextUndo = new System.Windows.Forms.Timer(this.components); this.contextMenuStripShowVideoControls = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItemShowVideoControls = new System.Windows.Forms.ToolStripMenuItem(); + this.generaeTransparentVideoWithSubtitleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -2302,6 +2303,7 @@ namespace Nikse.SubtitleEdit.Forms this.generateBlankVideoToolStripMenuItem, this.generateVideoWithSoftcodedSubtitlesToolStripMenuItem, this.generateVideoWithHardcodedSubtitleToolStripMenuItem, + this.generaeTransparentVideoWithSubtitleToolStripMenuItem, this.audioToTextWhisperTolStripMenuItem, this.videoaudioToTextToolStripMenuItem, this.textToSpeechAndAddToVideoToolStripMenuItem, @@ -3914,14 +3916,14 @@ namespace Nikse.SubtitleEdit.Forms this.timeUpDownVideoPosition.Size = new System.Drawing.Size(113, 23); this.timeUpDownVideoPosition.TabIndex = 12; this.timeUpDownVideoPosition.TabStop = false; - timeCode1.Hours = 0; - timeCode1.Milliseconds = 0; - timeCode1.Minutes = 0; - timeCode1.Seconds = 0; - timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode1.TotalMilliseconds = 0D; - timeCode1.TotalSeconds = 0D; - this.timeUpDownVideoPosition.TimeCode = timeCode1; + timeCode7.Hours = 0; + timeCode7.Milliseconds = 0; + timeCode7.Minutes = 0; + timeCode7.Seconds = 0; + timeCode7.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode7.TotalMilliseconds = 0D; + timeCode7.TotalSeconds = 0D; + this.timeUpDownVideoPosition.TimeCode = timeCode7; this.timeUpDownVideoPosition.UseVideoOffset = false; // // buttonGotoSub @@ -4194,14 +4196,14 @@ namespace Nikse.SubtitleEdit.Forms this.timeUpDownVideoPositionAdjust.Size = new System.Drawing.Size(113, 23); this.timeUpDownVideoPositionAdjust.TabIndex = 13; this.timeUpDownVideoPositionAdjust.TabStop = false; - timeCode2.Hours = 0; - timeCode2.Milliseconds = 0; - timeCode2.Minutes = 0; - timeCode2.Seconds = 0; - timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode2.TotalMilliseconds = 0D; - timeCode2.TotalSeconds = 0D; - this.timeUpDownVideoPositionAdjust.TimeCode = timeCode2; + timeCode8.Hours = 0; + timeCode8.Milliseconds = 0; + timeCode8.Minutes = 0; + timeCode8.Seconds = 0; + timeCode8.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode8.TotalMilliseconds = 0D; + timeCode8.TotalSeconds = 0D; + this.timeUpDownVideoPositionAdjust.TimeCode = timeCode8; this.timeUpDownVideoPositionAdjust.UseVideoOffset = false; // // buttonAdjustSetEndTime @@ -5558,14 +5560,14 @@ namespace Nikse.SubtitleEdit.Forms this.timeUpDownStartTime.Size = new System.Drawing.Size(113, 23); this.timeUpDownStartTime.TabIndex = 0; this.timeUpDownStartTime.TabStop = false; - timeCode3.Hours = 0; - timeCode3.Milliseconds = 0; - timeCode3.Minutes = 0; - timeCode3.Seconds = 0; - timeCode3.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode3.TotalMilliseconds = 0D; - timeCode3.TotalSeconds = 0D; - this.timeUpDownStartTime.TimeCode = timeCode3; + timeCode9.Hours = 0; + timeCode9.Milliseconds = 0; + timeCode9.Minutes = 0; + timeCode9.Seconds = 0; + timeCode9.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode9.TotalMilliseconds = 0D; + timeCode9.TotalSeconds = 0D; + this.timeUpDownStartTime.TimeCode = timeCode9; this.timeUpDownStartTime.UseVideoOffset = false; // // numericUpDownDuration @@ -5919,6 +5921,13 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemShowVideoControls.Text = "Show video controls"; this.toolStripMenuItemShowVideoControls.Click += new System.EventHandler(this.ToolStripMenuItemShowVideoControlsClick); // + // generaeTransparentVideoWithSubtitleToolStripMenuItem + // + this.generaeTransparentVideoWithSubtitleToolStripMenuItem.Name = "generaeTransparentVideoWithSubtitleToolStripMenuItem"; + this.generaeTransparentVideoWithSubtitleToolStripMenuItem.Size = new System.Drawing.Size(295, 22); + this.generaeTransparentVideoWithSubtitleToolStripMenuItem.Text = "Generae transparent video with subtitle"; + this.generaeTransparentVideoWithSubtitleToolStripMenuItem.Click += new System.EventHandler(this.generaeTransparentVideoWithSubtitleToolStripMenuItem_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -6545,5 +6554,6 @@ namespace Nikse.SubtitleEdit.Forms private ToolStripMenuItem videoInfoToolStripMenuItem; private ToolStripMenuItem openContainingFolderToolStripMenuItem; private ToolStripMenuItem insertNewSubtitleHereToolStripMenuItem; + private ToolStripMenuItem generaeTransparentVideoWithSubtitleToolStripMenuItem; } } \ No newline at end of file diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 694ec8e56..e6d9da106 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -36898,5 +36898,20 @@ namespace Nikse.SubtitleEdit.Forms ShowStatus(string.Format(_language.VideoControls.NewTextInsertAtX, newParagraph.StartTime.ToShortString())); } + + private void generaeTransparentVideoWithSubtitleToolStripMenuItem_Click(object sender, EventArgs e) + { + using (var saveDialog = new SaveFileDialog + { + FileName = string.Empty, + Filter = "mkv|*.mkv|mp4|*.mp4|mov|*.mov" + }) + { + if (saveDialog.ShowDialog(this) != DialogResult.OK) + { + return; + } + } + } } -} \ No newline at end of file +} diff --git a/src/ui/Forms/Main.resx b/src/ui/Forms/Main.resx index 34a87c2c9..c577e339f 100644 --- a/src/ui/Forms/Main.resx +++ b/src/ui/Forms/Main.resx @@ -690,6 +690,9 @@ 652, 56 + + 652, 56 + iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 @@ -772,12 +775,12 @@ 981, 56 - - 668, 17 - 193, 17 + + 668, 17 + 17, 95 diff --git a/src/ui/Forms/Translate/AutoTranslate.cs b/src/ui/Forms/Translate/AutoTranslate.cs index e961246bb..d083cde92 100644 --- a/src/ui/Forms/Translate/AutoTranslate.cs +++ b/src/ui/Forms/Translate/AutoTranslate.cs @@ -384,6 +384,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate comboBoxFormality.Visible = true; comboBoxFormality.DropDownStyle = ComboBoxStyle.DropDown; comboBoxFormality.Items.Clear(); + comboBoxFormality.Items.Add("claude-3-5-sonnet-20240620"); comboBoxFormality.Items.Add("claude-3-opus-20240229"); comboBoxFormality.Items.Add("claude-3-sonnet-20240229"); comboBoxFormality.Items.Add("claude-3-haiku-20240307");