diff --git a/Logger.cs b/Logger.cs index fc5e391..e8e08ce 100644 --- a/Logger.cs +++ b/Logger.cs @@ -22,7 +22,9 @@ namespace GTPCorrgir public void Log(string message) { - Trace.WriteLine(message); + // Formato de timestamp [AAAA-MM-DD HH:mm:ss] + string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + Trace.WriteLine($"[{timestamp}] {message}"); } } diff --git a/gtpask.cs b/gtpask.cs index 591236c..8fbf834 100644 --- a/gtpask.cs +++ b/gtpask.cs @@ -70,6 +70,7 @@ namespace GTPCorrgir public async Task CorregirTexto() { + Log.Log(""); Log.Log("Texto a corregir: " + TextoACorregir); if (DetectarIdioma()) { if (IdiomaDetectado == "Desconocido" || this.TextoACorregir.Length == 0) @@ -84,10 +85,10 @@ namespace GTPCorrgir TextoACorregir = md.MarkTechnicalTerms(TextoACorregir); - Log.Log("Texto a marcado: " + TextoACorregir); + Log.Log("Texto marcado: " + TextoACorregir); - string RespuestaLLM = await CallOpenAiApi(TextoACorregir); - //string RespuestaLLM = await CallOllamaApi(TextoACorregir); + //string RespuestaLLM = await CallOpenAiApi(TextoACorregir); + string RespuestaLLM = await CallOllamaApi(TextoACorregir); Log.Log("Respuesta: " + RespuestaLLM); @@ -96,7 +97,7 @@ namespace GTPCorrgir // Elimina comillas al principio y al final si existen TextoCorregido = TextoCorregido.Trim('\"'); - Log.Log("Texto a corregido: " + TextoCorregido); + Log.Log("Texto corregido: " + TextoCorregido); } } @@ -150,7 +151,7 @@ namespace GTPCorrgir var content = new StringContent(JsonConvert.SerializeObject(requestData), Encoding.UTF8, "application/json"); try { - Log.Log("Ask Ollama: " + content.ToString()); + Log.Log("Ask Ollama: " + JsonConvert.SerializeObject(requestData)); var response = await httpClient.PostAsync("http://127.0.0.1:11434/api/chat", content); response.EnsureSuccessStatusCode(); var jsonResponse = await response.Content.ReadAsStringAsync(); @@ -198,7 +199,7 @@ namespace GTPCorrgir var content = new StringContent(JsonConvert.SerializeObject(requestData), Encoding.UTF8, "application/json"); try { - Log.Log("Ask OpenAI: " + content.ToString()); + Log.Log("Ask OpenAI: " + JsonConvert.SerializeObject(requestData)); var response = await httpClient.PostAsync("https://api.openai.com/v1/chat/completions", content); response.EnsureSuccessStatusCode(); var jsonResponse = await response.Content.ReadAsStringAsync();