Skip to content

Commit

Permalink
fix: custom target language doesn't work in llm
Browse files Browse the repository at this point in the history
  • Loading branch information
A-nony-mous committed Feb 22, 2025
1 parent 5ba3893 commit 402203f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
Expand All @@ -8,5 +8,5 @@


[assembly: AssemblyTitle("LiveCaptions Translator")]
[assembly: AssemblyVersion("1.1.1251.2215")]
[assembly: AssemblyFileVersion("1.1.1251.2215")]
[assembly: AssemblyVersion("1.1.1251.2220")]
[assembly: AssemblyFileVersion("1.1.1251.2220")]
10 changes: 6 additions & 4 deletions src/models/TranslateAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public static string Prompt
public static async Task<string> OpenAI(string text)
{
var config = App.Settings.CurrentAPIConfig as OpenAIConfig;
var language = config?.SupportedLanguages[App.Settings.TargetLanguage];

string language = config.SupportedLanguages.TryGetValue(App.Settings.TargetLanguage, out var langValue)
? langValue
: App.Settings.TargetLanguage;
var requestData = new
{
model = config?.ModelName,
Expand Down Expand Up @@ -75,8 +76,9 @@ public static async Task<string> Ollama(string text)
var apiUrl = $"http://localhost:{OLLAMA_PORT}/api/chat";

var config = App.Settings.CurrentAPIConfig as OllamaConfig;
var language = config?.SupportedLanguages[App.Settings.TargetLanguage];

string language = config.SupportedLanguages.TryGetValue(App.Settings.TargetLanguage, out var langValue)
? langValue
: App.Settings.TargetLanguage;
var requestData = new
{
model = config?.ModelName,
Expand Down

0 comments on commit 402203f

Please sign in to comment.