Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions Context.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
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:
The project is called [Your Project Name], an [Your Project description].

[
{
"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"
}
]
[Talk about Your Project features]...

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.
The project is developed in/with: [Your Project languages and tools].
25 changes: 4 additions & 21 deletions appsettings.json
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 2 additions & 1 deletion src/Clients/CsvClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public static async Task<bool> CreateAsync(

foreach (var reports in chunkReports)
{
await CreateAsync(reports, logger, appSettings, ct);
if (!await CreateAsync(reports, logger, appSettings, ct))
return false;
}

return true;
Expand Down
21 changes: 16 additions & 5 deletions src/Clients/LMClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ internal static class LMClient

public static async Task<IEnumerable<IEnumerable<Report>>> GenerateReportsAsync(
IEnumerable<MyCommit> commits,
string modelContext,
ILogger<Program>? 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<IEnumerable<Report>>();
var dates = commits.Select(c => c.CreatedAt.Date).Distinct();

Expand All @@ -50,7 +51,7 @@ private static async Task<IEnumerable<Report>> GetReportsByDateAsync(
AppSettings appSettings,
CancellationToken ct)
{
if (commits is null || !commits.Any() || string.IsNullOrWhiteSpace(modelContext))
if (commits is null || !commits.Any())
return [];

IEnumerable<Report> reportsByDate = [];
Expand Down Expand Up @@ -81,7 +82,7 @@ private static async Task<IEnumerable<Report>> 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;
Expand Down Expand Up @@ -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);
Expand All @@ -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<string> 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();
}
}
}
35 changes: 31 additions & 4 deletions src/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,38 @@ 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 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.

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}.";
}
}
15 changes: 3 additions & 12 deletions src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text;
using AutoDoc.Models;
using AutoDoc.Models;
using AutoDoc.Clients;
using AutoDoc.Validators;
using Microsoft.Extensions.Logging;
Expand All @@ -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);
}
Expand All @@ -35,14 +33,7 @@ static AppSettings GetAppSettings()
.AddJsonFile(AppSettingsName)
.Build()
.Get<AppSettings>()!;
}

static async Task<string> GetModelContextAsync(CancellationToken ct)
{
const string FileName = "Context.txt";

return await File.ReadAllTextAsync(FileName, Encoding.UTF8, ct);
}
}

static ILogger<Program> GetLogger()
{
Expand Down