Compare commits

..

No commits in common. "3e2494b5a8790fd5622a33f62580a76459c0383d" and "971eb5537c387def33fa95a95aabfb6b6b9c7c5a" have entirely different histories.

5 changed files with 15 additions and 47 deletions

View File

@ -36,7 +36,7 @@ namespace GTPCorrgir
GTP.TextoACorregir = System.Windows.Clipboard.GetText();
}
if (Opciones.Instance.modo == Opciones.modoDeUso.Corregir || Opciones.Instance.modo == Opciones.modoDeUso.Ortografia)
if (Opciones.Instance.modo == Opciones.modoDeUso.Corregir)
{
stopwatch.Start();
@ -68,14 +68,10 @@ namespace GTPCorrgir
System.Windows.Clipboard.SetText(GTP.TextoCorregido);
ShowCustomNotification("Se puede pegar", $"Corrección en : {Math.Round(stopwatch.ElapsedMilliseconds / 1000.0, 1)} s");
if (Opciones.Instance.modo == Opciones.modoDeUso.Corregir)
{
var resultadoWindow = new VentanaResultado(GTP.TextoCorregido);
resultadoWindow.Show();
}
var resultadoWindow = new VentanaResultado(GTP.TextoCorregido);
resultadoWindow.Show();
await Task.Delay(5000); // Asíncrono espera 5 segundos
Application.Current.Shutdown();
}
else
{

View File

@ -108,22 +108,6 @@ namespace GTPCorrgir
}, RegexOptions.IgnoreCase);
}
public string RemoveTechnicalTermMarkers(string text)
{
// Utilizar Regex para encontrar y remover los dobles corchetes
return Regex.Replace(text, @"\[\[(.*?)\]\]", match =>
{
string word = match.Groups[1].Value;
// Verificar si la palabra está en el conjunto de términos técnicos, ignorando mayúsculas y minúsculas
if (technicalTerms.Contains(word))
{
return word; // Devolver la palabra sin corchetes si es técnica
}
return match.Value; // Devolver la palabra con corchetes si no es técnica
});
}
}
}

View File

@ -18,7 +18,6 @@ namespace GTPCorrgir
public enum modoDeUso
{
Corregir,
Ortografia,
Chat,
}
@ -76,9 +75,7 @@ namespace GTPCorrgir
else if (arg.StartsWith("--Groq"))
Opciones.Instance.LLM = Opciones.LLM_a_Usar.Groq;
else if (arg.StartsWith("--Chat"))
Opciones.Instance.modo = Opciones.modoDeUso.Chat;
else if (arg.StartsWith("--Ortografia"))
Opciones.Instance.modo = Opciones.modoDeUso.Ortografia;
Opciones.Instance.modo = Opciones.modoDeUso.Chat;
}
}

View File

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GTPCorrgir"
WindowStyle="None" AllowsTransparency="True" Background="White"
WindowStyle="None" AllowsTransparency="True" Background="Transparent"
Topmost="True" ShowInTaskbar="False"
MouseLeftButtonDown="Window_MouseLeftButtonDown">

View File

@ -33,32 +33,23 @@ namespace GTPCorrgir
public string TextoCorregido;
public string TextodeSistema;
private const bool Simulacion = false;
private string CrearMensajeDeSistema()
{
switch (Opciones.Instance.modo)
{
case Opciones.modoDeUso.Corregir:
return "You are an engineer working in industrial automation. Your task is to review texts and rewrite them in a simple and concise manner, making sure to preserve important technical terms and markdown language if present. Please rewrite the following text in " + IdiomaDetectado + " and respond in the following JSON format: { \"Rewritten_text\": \"Your text here\" }.";
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, making sure to preserve important technical terms and markdown language if present. Please write in " + IdiomaDetectado + " and respond in the following JSON format: { \"Rewritten_text\": \"Your text here\" }.";
default:
return "You are an engineer working specialiazed industrial automation. Please answer the following question in " + IdiomaDetectado + " and respond in the following JSON format: { \"Reply_text\": \"Your text here\" }.";
}
if (Opciones.Instance.modo == Opciones.modoDeUso.Corregir)
return "You are an engineer working in industrial automation. Your task is to review texts and rewrite them in a simple and concise manner, making sure to preserve important technical terms and markdown language if present. Please rewrite the following text in " + IdiomaDetectado + " and respond in the following JSON format: { \"Rewritten_text\": \"Your text here\" }.";
else
return "You are an engineer working specialiazed industrial automation. Please answer the following question in " + IdiomaDetectado + " and respond in the following JSON format: { \"Reply_text\": \"Your text here\" }.";
}
private string CrearMensajeDeUsuario(string texto)
{
switch (Opciones.Instance.modo)
{
case Opciones.modoDeUso.Corregir:
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:
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 + "\"";
default:
return texto;
}
if (Opciones.Instance.modo == Opciones.modoDeUso.Corregir)
return "Please rewrite and improve the following text to make it clearer and more concise the words inside brackets are technical words: \"" + texto + "\"";
else
return texto;
}
@ -130,7 +121,7 @@ namespace GTPCorrgir
TextoCorregido = "Error en la respuesta.";
// Elimina comillas al principio y al final si existen
TextoCorregido = md.RemoveTechnicalTermMarkers(TextoCorregido).Trim('\"');
TextoCorregido = TextoCorregido.Trim('\"');
Log.Log("Texto corregido: " + TextoCorregido);
}