From 615257c5b881332d9c604f8c4c34b2180d21d971 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 13:06:17 -0300 Subject: [PATCH 01/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Cs?= =?UTF-8?q?vClient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improving chunk reports csv creation --- src/Clients/CsvClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Clients/CsvClient.cs b/src/Clients/CsvClient.cs index 096dddb..705d375 100644 --- a/src/Clients/CsvClient.cs +++ b/src/Clients/CsvClient.cs @@ -18,7 +18,8 @@ public static async Task CreateAsync( foreach (var reports in chunkReports) { - await CreateAsync(reports, logger, appSettings, ct); + if (!await CreateAsync(reports, logger, appSettings, ct)) + return false; } return true; From a547501399123abc90d32496653acf78fccf734e Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 15:50:02 -0300 Subject: [PATCH 02/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20ap?= =?UTF-8?q?psettings.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating fields values to generic --- appsettings.json | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/appsettings.json b/appsettings.json index 687f16e..7b6bd5d 100644 --- a/appsettings.json +++ b/appsettings.json @@ -1,28 +1,11 @@ { - // The path to the repository to be analyzed. - "RepositoryPath": "C:\\Users\\eduar\\Desktop\\DoroTech\\Nice Acesso\\Work\\nice-acesso-api", - - // The email associated with Git. - "OwnerEmail": "dudumoises2005@gmail.com", - - // Who is responsible for the commits. - "OwnerName": "Eduardo Rezende", - - // The culture of reporting. - "Culture": "pt-BR", - - // The path where CSVs should be generated. + "RepositoryPath": "C:\\Path\\To\\Your\\Repository", + "OwnerEmail": "example@email.com", + "OwnerName": "Your Name", + "Culture": "en-US", "OutputPath": "Datas", - - // Represents the request address to talk to the Model. "CompletionsUri": "http://localhost:1234/v1/chat/completions", - - // For each request to the model, how long is it necessary to wait (Good for not overloading the RAM memory). "DelayMilliseconds": 20000, - - // Varies between 0 and 1 (The closer to zero the Model is, the less creative it is). "ModelTemperature": 0.5, - - // How many times should the process repeat if there is a failure. "MaxRetries": 2 } \ No newline at end of file From 53e341a9165d8e851a5d4fa412ef5c39f04d237c Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 15:50:30 -0300 Subject: [PATCH 03/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?ntext.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating content to generic --- Context.txt | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Context.txt b/Context.txt index e9f81a6..8573e00 100644 --- a/Context.txt +++ b/Context.txt @@ -1,24 +1,26 @@ -Você é um assistente especializado em converter mensagens de commits em relatórios técnicos organizados. -O projeto se chama 'Nice Acesso', um sistema de controle de acesso com equipamentos como Guarita (MG3000), Controladora Ethernet, Facial, Biometria, Relês e Acionadores. -O Nice Acesso tem funcionalidades como Usuários, Tipos de Usuários, Pessoas, Pessoas Veículo, Pessoas Acionadores, Equipamentos, Relês, Receptores, Tipo de Pessoa, Rotas de Acesso e etc. -Os commits são referentes ao back-end da API, desenvolvida em C# (.NET), Visual Studio, usando PostgreSQL como banco de dados e Entity Framework. -Você receberá um JSON de entrada com vários commits, contendo os campos `title`,`message` e 'createdAt' . Seu trabalho é analisar cada commit e gerar uma estrutura JSON correspondente contendo: +You are an assistant specializing in converting commit messages into organized technical reports. + +The project is called [Your Project Name], an [Your Project description].[Your Project features]. +The commits refer to [Your Project Name], developed in/with: [Your Project languages and tools]. + +You will receive an input JSON with several commits, containing the fields `title`,`message`, and ‘createdAt’. +Your job is to analyze each commit and generate a corresponding JSON structure containing: [ { "date": "2025-08-01T14:05:00", - "step": "Desenvolvimento", - "activity": "Título resumido da atividade realizada", - "description": "Descrição técnica clara da atividade realizada", - "motivation": "Motivo pelo qual a tarefa foi executada", - "process": "Ferramentas ou tecnologias utilizadas para realizar a tarefa", - "result": "Resultado prático alcançado com essa implementação" + "step": "Development", + "activity": "Summary title of the activity performed", + "description": "Clear technical description of the activity performed", + "motivation": "Reason why the task was performed", + "process": "Tools or technologies used to perform the task", + "result": "Practical result achieved with this implementation" } ] -Regras importantes: -- Use o máximo de contexto técnico possível ao preencher os campos. -- Se um commit for muito raso ou irrelevante, ignore-o. -- Retorne **apenas um array JSON válido**, sem qualquer explicação ou texto adicional. -- Use seu conhecimento de sistemas back-end para preencher com coerência quando o commit estiver incompleto. -Você pode ignorar commits que não fornecem informações suficientes. Seja objetivo, técnico e organizado. \ No newline at end of file +Important rules: +- Use as much technical context as possible when filling in the fields. +- If a commit is too shallow or irrelevant, ignore it. +- Return **only a valid JSON array**, without any additional explanation or text. +- Use your knowledge of back-end systems to fill in coherently when the commit is incomplete. +You can ignore commits that do not provide enough information. Be objective, technical, and organized. \ No newline at end of file From a02cc208bc475b022c33b0e09376feda25f14492 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 15:50:57 -0300 Subject: [PATCH 04/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?nstants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating InputError message --- src/Constants.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Constants.cs b/src/Constants.cs index 4bdb4bc..41f32ee 100644 --- a/src/Constants.cs +++ b/src/Constants.cs @@ -5,7 +5,7 @@ internal static class Constants public const string InputError = @"Please enter the correct arguments. Option 1: [StartDate] [EndDate] | Example: 2025-01-01 2025-02-01 | Explanation: Will generate 1 month of reports. - Option 2: [Days] | Example: 7 | Explanation: Will generate 1 week of reports from the current date."; + Option 2: [Days] | Example: 7 | Explanation: Will generate 1 week of reports from the current day."; public const string ModelMessage = @"Now, using the instructions above, generate the list of technical reports based on the following JSON commits: From 2fcb43eb238b06dffad6e3da06b4054b655dc139 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 16:05:16 -0300 Subject: [PATCH 05/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?ntext.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing important rules and expected results from user control, and leaving only the project context --- Context.txt | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/Context.txt b/Context.txt index 8573e00..7ddd00e 100644 --- a/Context.txt +++ b/Context.txt @@ -1,26 +1,2 @@ -You are an assistant specializing in converting commit messages into organized technical reports. - -The project is called [Your Project Name], an [Your Project description].[Your Project features]. +The project is called [Your Project Name], an [Your Project description].[Your Project features]. The commits refer to [Your Project Name], developed in/with: [Your Project languages and tools]. - -You will receive an input JSON with several commits, containing the fields `title`,`message`, and ‘createdAt’. -Your job is to analyze each commit and generate a corresponding JSON structure containing: - -[ - { - "date": "2025-08-01T14:05:00", - "step": "Development", - "activity": "Summary title of the activity performed", - "description": "Clear technical description of the activity performed", - "motivation": "Reason why the task was performed", - "process": "Tools or technologies used to perform the task", - "result": "Practical result achieved with this implementation" - } -] - -Important rules: -- Use as much technical context as possible when filling in the fields. -- If a commit is too shallow or irrelevant, ignore it. -- Return **only a valid JSON array**, without any additional explanation or text. -- Use your knowledge of back-end systems to fill in coherently when the commit is incomplete. -You can ignore commits that do not provide enough information. Be objective, technical, and organized. \ No newline at end of file From 53f083ae38cd781cd4580432341dec3b392094ba Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 16:06:05 -0300 Subject: [PATCH 06/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?nstants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding ModelContext with important rules and expected results --- src/Constants.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Constants.cs b/src/Constants.cs index 41f32ee..d8aff29 100644 --- a/src/Constants.cs +++ b/src/Constants.cs @@ -7,6 +7,31 @@ internal static class Constants Option 1: [StartDate] [EndDate] | Example: 2025-01-01 2025-02-01 | Explanation: Will generate 1 month of reports. Option 2: [Days] | Example: 7 | Explanation: Will generate 1 week of reports from the current day."; + public const string ModelContext = + @"You are an assistant specializing in converting commit messages into organized technical reports. + + You will receive an input JSON with several commits, containing the fields `title`,`message` and `createdAt`. + Your job is to analyze each commit and generate a corresponding JSON structure containing: + + [ + { + ""date"": ""2025-08-01T14:05:00"", + ""step"": ""Development"", + ""activity"": ""Summary title of the activity performed"", + ""description"": ""Clear technical description of the activity performed"", + ""motivation"": ""Reason why the task was performed"", + ""process"": ""Tools or technologies used to perform the task"", + ""result"": ""Practical result achieved with this implementation"" + } + ] + + Important rules: + - Use as much technical context as possible when filling in the fields. + - If a commit is too shallow or irrelevant, ignore it. + - Return **only a valid JSON array**, without any additional explanation or text. + - Use your knowledge of back-end systems to fill in coherently when the commit is incomplete. + You can ignore commits that do not provide enough information. Be objective, technical, and organized."; + public const string ModelMessage = @"Now, using the instructions above, generate the list of technical reports based on the following JSON commits: {0} From c66382da7edc278d826cf74e401be5364973230d Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 16:26:18 -0300 Subject: [PATCH 07/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?ntext.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improving template context --- Context.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Context.txt b/Context.txt index 7ddd00e..2546d7a 100644 --- a/Context.txt +++ b/Context.txt @@ -1,2 +1,5 @@ -The project is called [Your Project Name], an [Your Project description].[Your Project features]. -The commits refer to [Your Project Name], developed in/with: [Your Project languages and tools]. +The project is called [Your Project Name], an [Your Project description]. + +[Talk about Your Project features]... + +The project is developed in/with: [Your Project languages and tools]. From 540f10523a0f22f7c6fb792b58db7002835a07fe Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 16:27:54 -0300 Subject: [PATCH 08/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?nstants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improving ModelContext message --- src/Constants.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Constants.cs b/src/Constants.cs index d8aff29..fa0d1e6 100644 --- a/src/Constants.cs +++ b/src/Constants.cs @@ -30,11 +30,13 @@ internal static class Constants - If a commit is too shallow or irrelevant, ignore it. - Return **only a valid JSON array**, without any additional explanation or text. - Use your knowledge of back-end systems to fill in coherently when the commit is incomplete. - You can ignore commits that do not provide enough information. Be objective, technical, and organized."; + You can ignore commits that do not provide enough information. Be objective, technical, and organized. + + The commits refer to:"; public const string ModelMessage = - @"Now, using the instructions above, generate the list of technical reports based on the following JSON commits: - {0} - Please just return only the complete, valid JSON array, without any other text. The results must be in the language: {1}."; + @"Now, using the instructions above, generate the list of technical reports based on the following JSON commits: + {0} + Please just return only the complete, valid JSON array, without any other text. The results must be in the language: {1}."; } } From b5286a59a23bfd2b70ff4a1eb32c4f7f153180f6 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 16:29:05 -0300 Subject: [PATCH 09/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Pr?= =?UTF-8?q?ogram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding ModelContext to GetModelContext method --- src/Program.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Program.cs b/src/Program.cs index 76f75c1..8bef581 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -41,7 +41,10 @@ static async Task GetModelContextAsync(CancellationToken ct) { const string FileName = "Context.txt"; - return await File.ReadAllTextAsync(FileName, Encoding.UTF8, ct); + var userContext = await File.ReadAllTextAsync(FileName, Encoding.UTF8, ct); + ArgumentException.ThrowIfNullOrWhiteSpace(userContext); + + return string.Concat(Constants.ModelContext, Environment.NewLine, userContext).Trim(); } static ILogger GetLogger() From ceb7b185a25cbca8afcf6d66765d6b5af9fc8905 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 21:50:38 -0300 Subject: [PATCH 10/11] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20LM?= =?UTF-8?q?Client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding GetModelContext method --- src/Clients/LMClient.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Clients/LMClient.cs b/src/Clients/LMClient.cs index 0419520..688fdd7 100644 --- a/src/Clients/LMClient.cs +++ b/src/Clients/LMClient.cs @@ -20,14 +20,15 @@ internal static class LMClient public static async Task>> GenerateReportsAsync( IEnumerable commits, - string modelContext, ILogger? logger, AppSettings appSettings, CancellationToken ct) { - if (commits is null || !commits.Any() || string.IsNullOrWhiteSpace(modelContext)) + if (commits is null || !commits.Any()) return []; + var modelContext = await GetModelContextAsync(ct); + var chunkReports = new List>(); var dates = commits.Select(c => c.CreatedAt.Date).Distinct(); @@ -50,7 +51,7 @@ private static async Task> GetReportsByDateAsync( AppSettings appSettings, CancellationToken ct) { - if (commits is null || !commits.Any() || string.IsNullOrWhiteSpace(modelContext)) + if (commits is null || !commits.Any()) return []; IEnumerable reportsByDate = []; @@ -81,7 +82,7 @@ private static async Task> CallModelAsync( AppSettings appSettings, CancellationToken ct = default) { - if (commits is null || !commits.Any() || string.IsNullOrWhiteSpace(modelContext)) + if (commits is null || !commits.Any()) return []; var retriesCount = 1; @@ -132,7 +133,7 @@ private static StringContent BuildRequestBody( string modelContext, AppSettings appSettings) { - if (commits is null || !commits.Any() || string.IsNullOrWhiteSpace(modelContext)) + if (commits is null || !commits.Any()) return new StringContent(string.Empty); var inputJson = JsonSerializer.Serialize(commits); @@ -150,5 +151,15 @@ private static StringContent BuildRequestBody( var json = JsonSerializer.Serialize(requestBody); return new StringContent(json, Encoding.UTF8, "application/json"); } + + private static async Task GetModelContextAsync(CancellationToken ct) + { + const string FileName = "Context.txt"; + + var userContext = await File.ReadAllTextAsync(FileName, Encoding.UTF8, ct); + ArgumentException.ThrowIfNullOrWhiteSpace(userContext); + + return string.Concat(Constants.ModelContext, Environment.NewLine, userContext).Trim(); + } } } From b749e6390d69e9a7b0010c855ef30569cae63955 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 16 Aug 2025 21:51:03 -0300 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=A7=B9cleanup:=20Update=20Program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing GetModelContext method --- src/Program.cs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index 8bef581..188867f 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,5 +1,4 @@ -using System.Text; -using AutoDoc.Models; +using AutoDoc.Models; using AutoDoc.Clients; using AutoDoc.Validators; using Microsoft.Extensions.Logging; @@ -18,11 +17,10 @@ static async Task Main(string[] args) var logger = GetLogger(); var appSettings = GetAppSettings(); - var modelContext = await GetModelContextAsync(ct); var myCommits = GitClient.GetCommits(start, end, appSettings); - await LMClient.GenerateReportsAsync(myCommits, modelContext, logger, appSettings, ct); + await LMClient.GenerateReportsAsync(myCommits, logger, appSettings, ct); logger?.LogInformation("Finished :) Please look at {OutputPath}", appSettings.OutputPath); } @@ -35,17 +33,7 @@ static AppSettings GetAppSettings() .AddJsonFile(AppSettingsName) .Build() .Get()!; - } - - static async Task GetModelContextAsync(CancellationToken ct) - { - const string FileName = "Context.txt"; - - var userContext = await File.ReadAllTextAsync(FileName, Encoding.UTF8, ct); - ArgumentException.ThrowIfNullOrWhiteSpace(userContext); - - return string.Concat(Constants.ModelContext, Environment.NewLine, userContext).Trim(); - } + } static ILogger GetLogger() {