Agregadas opciones de traducción a portugués en la aplicación, incluyendo ajustes en el menú y la lógica de procesamiento de texto.
This commit is contained in:
parent
28e7df02ae
commit
e9102f7e1e
13
App.xaml.cs
13
App.xaml.cs
|
@ -20,16 +20,15 @@ namespace GTPCorrgir
|
|||
bool CorreccionFinalizada = false;
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
private notificacion notificationWindow;
|
||||
private readonly int TimeoutSeconds = 60; // Timeout máximo para esperar la respuesta
|
||||
private readonly int TimeoutSeconds = 60;
|
||||
private CancellationTokenSource _cancellationTokenSource;
|
||||
private Window _mainWindow;
|
||||
|
||||
KeyboardHelper pasteLogic = new KeyboardHelper();
|
||||
|
||||
private Window _mainWindow;
|
||||
|
||||
protected override async void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
ShutdownMode = ShutdownMode.OnExplicitShutdown; // Añade esta línea
|
||||
ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||
base.OnStartup(e);
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
|
@ -84,6 +83,7 @@ namespace GTPCorrgir
|
|||
case Opciones.modoDeUso.Traducir_a_Espanol:
|
||||
case Opciones.modoDeUso.Traducir_a_Ingles:
|
||||
case Opciones.modoDeUso.Traducir_a_Italiano:
|
||||
case Opciones.modoDeUso.Traducir_a_Portugues:
|
||||
await HandleTextCorrection();
|
||||
return;
|
||||
}
|
||||
|
@ -107,6 +107,9 @@ namespace GTPCorrgir
|
|||
}
|
||||
|
||||
GTP.TextoACorregir = await ClipboardHelper.GetText();
|
||||
stopwatch.Start();
|
||||
ShowCustomNotification("Espera", $"Procesando texto con {Opciones.Instance.nombreDeLLM()}...");
|
||||
IniciarCronometro();
|
||||
await ProcessCorreccionWithTimeout();
|
||||
}
|
||||
|
||||
|
@ -152,7 +155,7 @@ namespace GTPCorrgir
|
|||
|
||||
if (Opciones.Instance.modo == Opciones.modoDeUso.Corregir || Opciones.Instance.modo == Opciones.modoDeUso.Ortografia ||
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Espanol || Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Ingles ||
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Italiano)
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Italiano || Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Portugues)
|
||||
{
|
||||
if (Opciones.Instance.FuncionesOpcionales == Opciones.funcionesOpcionales.MostrarPopUp)
|
||||
{
|
||||
|
|
|
@ -43,9 +43,11 @@ namespace GTPCorrgir
|
|||
new MenuOption { DisplayName = "Corregir texto", Value = Opciones.modoDeUso.Corregir },
|
||||
new MenuOption { DisplayName = "Revisar ortografía", Value = Opciones.modoDeUso.Ortografia },
|
||||
new MenuOption { DisplayName = "Chat", Value = Opciones.modoDeUso.Chat },
|
||||
new MenuOption { DisplayName = "Pregunta-Respuesta", Value = Opciones.modoDeUso.PreguntaRespuesta },
|
||||
new MenuOption { DisplayName = "Traducir a inglés", Value = Opciones.modoDeUso.Traducir_a_Ingles },
|
||||
new MenuOption { DisplayName = "Traducir a italiano", Value = Opciones.modoDeUso.Traducir_a_Italiano },
|
||||
new MenuOption { DisplayName = "Traducir a español", Value = Opciones.modoDeUso.Traducir_a_Espanol },
|
||||
new MenuOption { DisplayName = "Traducir a portugués", Value = Opciones.modoDeUso.Traducir_a_Portugues },
|
||||
new MenuOption { DisplayName = "OCR a texto", Value = Opciones.modoDeUso.OCRaTexto }
|
||||
};
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace GTPCorrgir
|
|||
Traducir_a_Ingles,
|
||||
Traducir_a_Italiano,
|
||||
Traducir_a_Espanol,
|
||||
Traducir_a_Portugues,
|
||||
OCRaTexto,
|
||||
Menu,
|
||||
}
|
||||
|
@ -118,6 +119,8 @@ namespace GTPCorrgir
|
|||
Opciones.Instance.modo = Opciones.modoDeUso.Traducir_a_Italiano;
|
||||
if (arg.Contains("Traducir_a_Espanol"))
|
||||
Opciones.Instance.modo = Opciones.modoDeUso.Traducir_a_Espanol;
|
||||
if (arg.Contains("Traducir_a_Portugues"))
|
||||
Opciones.Instance.modo = Opciones.modoDeUso.Traducir_a_Portugues;
|
||||
if (arg.Contains("OCRaTexto"))
|
||||
Opciones.Instance.modo = Opciones.modoDeUso.OCRaTexto;
|
||||
if (arg.Contains("AutoCopy"))
|
||||
|
|
|
@ -13,4 +13,11 @@ Los parametros son:
|
|||
### Modo de funcionamiento
|
||||
***********************
|
||||
* `--Chat` : Para crear una mini ventana que permite hacer chat con los modelos sellecionados.
|
||||
* `--Correccion` (default ) : Correccion desde el portapapeles y hacia el portapapeles
|
||||
* `--Corregir` (default) : Corrección desde el portapapeles y hacia el portapapeles
|
||||
* `--Ortografia` : Revisar ortografía del texto en el portapapeles
|
||||
* `--Traducir_a_Ingles` : Traducir texto al inglés
|
||||
* `--Traducir_a_Italiano` : Traducir texto al italiano
|
||||
* `--Traducir_a_Espanol` : Traducir texto al español
|
||||
* `--Traducir_a_Portugues` : Traducir texto al portugués
|
||||
* `--OCRaTexto` : Capturar pantalla y convertir imagen a texto
|
||||
* `--Menu` : Mostrar menú de selección de opciones
|
10
gtpask.cs
10
gtpask.cs
|
@ -189,7 +189,8 @@ namespace GTPCorrgir
|
|||
{
|
||||
return Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Ingles ||
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Italiano ||
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Espanol;
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Espanol ||
|
||||
Opciones.Instance.modo == Opciones.modoDeUso.Traducir_a_Portugues;
|
||||
}
|
||||
|
||||
private string ObtenerIdiomaObjetivo()
|
||||
|
@ -199,6 +200,7 @@ namespace GTPCorrgir
|
|||
Opciones.modoDeUso.Traducir_a_Ingles => _languageMap["en"],
|
||||
Opciones.modoDeUso.Traducir_a_Italiano => _languageMap["it"],
|
||||
Opciones.modoDeUso.Traducir_a_Espanol => _languageMap["es"],
|
||||
Opciones.modoDeUso.Traducir_a_Portugues => _languageMap["pt"],
|
||||
_ => throw new ArgumentException("Modo de traducción no válido")
|
||||
};
|
||||
}
|
||||
|
@ -262,6 +264,7 @@ namespace GTPCorrgir
|
|||
throw new ApplicationException("Error al extraer el texto corregido de la respuesta JSON");
|
||||
}
|
||||
|
||||
TextoCorregido = System.Text.RegularExpressions.Regex.Replace(TextoCorregido, @"\*\*(.*?)\*\*", "$1");
|
||||
TextoCorregido = _markdownProcessor.RemoveTechnicalTermMarkers_IgnoreCase(TextoCorregido).Trim('"');
|
||||
TextoCorregido = _markdownProcessor.RemoveDoubleBrackets(TextoCorregido);
|
||||
}
|
||||
|
@ -307,7 +310,7 @@ namespace GTPCorrgir
|
|||
"You are an engineer working in industrial automation. Your task is to review texts and rewrite them in a simple and concise manner. If you find words enclosed in double brackets [[like this]], preserve them exactly as they appear without any modifications. For all other technical terms, write them normally without adding any brackets or special formatting. Preserve any existing markdown language if present. Please rewrite the following text in " + IdiomaDetectado + " and respond in the following JSON format: { \"Rewritten_text\": \"Your text here\" }. Important: Do not add any new brackets to words that aren't already enclosed in double brackets.",
|
||||
|
||||
Opciones.modoDeUso.Ortografia =>
|
||||
"Please check the following text for spelling errors and provide the corrected version. Do not change the meaning or structure of the sentences. If you find words enclosed in double brackets [[like this]], preserve them exactly as they appear. For all other words, only correct spelling mistakes while preserving technical terms and any markdown language if present. Please write in " + IdiomaDetectado + " and respond in the following JSON format: { \"Rewritten_text\": \"Your text here\" }.",
|
||||
"Please check the following text for spelling errors and provide the corrected version. Do not change the meaning or structure of the sentences. If you find words enclosed in double brackets [[like this]], preserve them exactly as they appear. For all other words, only correct spelling mistakes while preserving technical terms. Preserve any existing markdown language if present, but do not introduce new markdown styling (such as bold or italics) for emphasis unless it was part of the original input. Please write in " + IdiomaDetectado + " and respond in the following JSON format: { \"Rewritten_text\": \"Your text here\" }.",
|
||||
|
||||
_ => "You are an engineer working specialized in industrial automation. If the question contains words in double brackets [[like this]], preserve them exactly as they appear. Please answer the following question in " + IdiomaDetectado + " and respond in the following JSON format: { \"Reply_text\": \"Your text here\" }."
|
||||
};
|
||||
|
@ -331,6 +334,9 @@ namespace GTPCorrgir
|
|||
Opciones.modoDeUso.Traducir_a_Espanol =>
|
||||
$"Please check the following text for spelling errors and provide the corrected version tranlated to Spanish. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"{texto}\"",
|
||||
|
||||
Opciones.modoDeUso.Traducir_a_Portugues =>
|
||||
$"Please check the following text for spelling errors and provide the corrected version tranlated to Portuguese. Do not change the meaning or structure of the sentences. Only correct any spelling mistakes you find on: \"{texto}\"",
|
||||
|
||||
_ => texto
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue