Incluida las opciones de traduccion.

This commit is contained in:
Miguel 2024-06-16 10:26:18 +02:00
parent a4629f1a3a
commit c267740923
2 changed files with 34 additions and 7 deletions

View File

@ -20,6 +20,9 @@ namespace GTPCorrgir
Corregir, Corregir,
Ortografia, Ortografia,
Chat, Chat,
Traducir_a_Ingles,
Traducir_a_Italiano,
Traducir_a_Espanol,
} }
public Dictionary<LLM_a_Usar, string> nombreLLM = new Dictionary<LLM_a_Usar, string> public Dictionary<LLM_a_Usar, string> nombreLLM = new Dictionary<LLM_a_Usar, string>
@ -56,7 +59,7 @@ namespace GTPCorrgir
private Opciones() { } private Opciones() { }
} }
public class Program public class Program
{ {
[STAThread] [STAThread]
@ -64,21 +67,30 @@ namespace GTPCorrgir
{ {
var application = new App(); var application = new App();
// Aquí puedes procesar los argumentos
foreach (var arg in args) foreach (var arg in args)
{ {
if (arg.StartsWith("--")) if (arg.StartsWith("--"))
{ {
// Procesa el argumento según tus necesidades // Procesa el argumento según tus necesidades
if (arg.StartsWith("--Ollama")) if (arg.Contains("Ollama"))
Opciones.Instance.LLM = Opciones.LLM_a_Usar.Ollama; Opciones.Instance.LLM = Opciones.LLM_a_Usar.Ollama;
else if (arg.StartsWith("--Groq")) else if (arg.Contains("Groq"))
Opciones.Instance.LLM = Opciones.LLM_a_Usar.Groq; Opciones.Instance.LLM = Opciones.LLM_a_Usar.Groq;
else if (arg.StartsWith("--Chat")) else if (arg.Contains("OpenAI"))
Opciones.Instance.LLM = Opciones.LLM_a_Usar.OpenAI;
if (arg.Contains("Chat"))
Opciones.Instance.modo = Opciones.modoDeUso.Chat; Opciones.Instance.modo = Opciones.modoDeUso.Chat;
else if (arg.StartsWith("--Ortografia")) else if (arg.Contains("Ortografia"))
Opciones.Instance.modo = Opciones.modoDeUso.Ortografia; Opciones.Instance.modo = Opciones.modoDeUso.Ortografia;
else if (arg.Contains("Corregir"))
Opciones.Instance.modo = Opciones.modoDeUso.Corregir;
else if (arg.Contains("Traducir_a_Ingles"))
Opciones.Instance.modo = Opciones.modoDeUso.Traducir_a_Ingles;
else if (arg.Contains("Traducir_a_Italiano"))
Opciones.Instance.modo = Opciones.modoDeUso.Traducir_a_Italiano;
else if (arg.Contains("Traducir_a_Espanol"))
Opciones.Instance.modo = Opciones.modoDeUso.Traducir_a_Espanol;
} }
} }
@ -86,6 +98,7 @@ namespace GTPCorrgir
application.Run(); application.Run();
} }
} }
} }

View File

@ -56,6 +56,13 @@ namespace GTPCorrgir
return "Please rewrite and improve the following text to make it clearer and more concise the words inside brackets are technical words: \"" + texto + "\""; return "Please rewrite and improve the following text to make it clearer and more concise the words inside brackets are technical words: \"" + texto + "\"";
case Opciones.modoDeUso.Ortografia: case Opciones.modoDeUso.Ortografia:
return "Please check the following text for spelling errors and provide the corrected version. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"" + texto + "\""; return "Please check the following text for spelling errors and provide the corrected version. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"" + texto + "\"";
case Opciones.modoDeUso.Traducir_a_Ingles:
return "Please check the following text for spelling errors and provide the corrected version in English. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"" + texto + "\"";
case Opciones.modoDeUso.Traducir_a_Italiano:
return "Please check the following text for spelling errors and provide the corrected version in Italian. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"" + texto + "\"";
case Opciones.modoDeUso.Traducir_a_Espanol:
return "Please check the following text for spelling errors and provide the corrected version in Spanish. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"" + texto + "\"";
default: default:
return texto; return texto;
} }
@ -64,6 +71,13 @@ namespace GTPCorrgir
private string DetectarIdioma(string TextoACorregir) private string DetectarIdioma(string TextoACorregir)
{ {
if (Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Ingles)
return languageMap["en"];
if (Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Italiano)
return languageMap["it"];
if (Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Espanol)
return languageMap["es"];
LanguageDetector detector = new LanguageDetector(); LanguageDetector detector = new LanguageDetector();
detector.AddLanguages("en", "es", "it"); detector.AddLanguages("en", "es", "it");