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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Riber - Changelog

## v4.3.1 - 09/12/2025
**REFATOÇÃO**: Remove o método de busca por id da entidade nos IAiModelService
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'REFATOÇÃO' to 'REFATORAÇÃO'.

Suggested change
**REFATOÇÃO**: Remove o método de busca por id da entidade nos IAiModelService
**REFATORAÇÃO**: Remove o método de busca por id da entidade nos IAiModelService

Copilot uses AI. Check for mistakes.
Adiciona relationacimento entre entidade `ProductEmbeddings` e `Company` para uma melhor busca
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'relationacimento' to 'relacionamento'.

Suggested change
Adiciona relationacimento entre entidade `ProductEmbeddings` e `Company` para uma melhor busca
Adiciona relacionamento entre entidade `ProductEmbeddings` e `Company` para uma melhor busca

Copilot uses AI. Check for mistakes.

---

## v4.3.0 - 08/11/2025
- **NOVO**: Novas entidades par uso de chat e agendes de IA
- Adiciona entidade `Chat` para o usuário armazenar conversas com IA
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Companies>Samuel Zedec</Companies>
<Copyright>Copyright © $([System.DateTime]::Now.Year)</Copyright>
<Description>Sistema de gestão financeira para um lanchonete local</Description>
<Version>4.3.0</Version>
<Version>4.3.1</Version>
</PropertyGroup>

<!-- Repositório e Documentação -->
Expand Down
13 changes: 3 additions & 10 deletions src/Riber.Application/Abstractions/Services/AI/IAiModelService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Riber.Application.Abstractions.Services.AI;

public interface IAiModelService<TInput, TOutput>
public interface IAiModelService<in TInput, TOutput>
where TInput : class
where TOutput : class
{
Expand All @@ -23,17 +23,10 @@ public interface IAiModelService<TInput, TOutput>
/// <summary>
/// Encontra itens semelhantes com base no vetor de consulta fornecido.
/// </summary>
/// <param name="companyId">O identificador único da empresa a ser consultada.</param>
/// <param name="query">Um array de números de ponto flutuante representando o vetor de consulta para a operação de similaridade.</param>
/// <param name="cancellationToken">Um token para monitorar solicitações de cancelamento.</param>
/// <typeparam name="TOutput">O tipo de item que será retornado como resultado da operação.</typeparam>
/// <returns>Uma tarefa que representa a operação assíncrona, contendo uma memória somente leitura de itens semelhantes do tipo especificado.</returns>
Task<ReadOnlyMemory<TOutput>> FindSimilarAsync(float[] query, CancellationToken cancellationToken = default);

/// <summary>
/// Obtém um recurso ou dado com base no identificador da entidade especificado.
/// </summary>
/// <param name="entityId">O identificador único da entidade a ser recuperada.</param>
/// <param name="cancellationToken">Um token para monitorar solicitações de cancelamento.</param>
/// <returns>Uma tarefa que representa a operação assíncrona, contendo o recurso ou dado encontrado, ou null se não encontrado.</returns>
Task<TInput?> GetByEntityIdAsync(Guid entityId, CancellationToken cancellationToken = default);
Task<ReadOnlyMemory<TOutput>> FindSimilarAsync(Guid companyId, float[] query, CancellationToken cancellationToken = default);
}
1 change: 0 additions & 1 deletion src/Riber.Domain/Enums/AssistantType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ public enum AssistantType
{
SalesAnalysis = 1,
ProductAnalysis = 2,
MonthlyReport = 3
}
5 changes: 4 additions & 1 deletion src/Riber.Infrastructure/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ private static void AddPersistence(this IServiceCollection services, string defa
b.MigrationsAssembly(typeof(AppDbContext).Assembly.FullName)
.MigrationsHistoryTable("__EFMigrationsHistory");
})
.AddInterceptors(new CaseInsensitiveInterceptor(), new AuditInterceptor()));
.AddInterceptors(new CaseInsensitiveInterceptor(), new AuditInterceptor())
.EnableDetailedErrors()
.EnableServiceProviderCaching()
);
}

private static void AddRepositories(this IServiceCollection services)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public static class AssistantTypeExtension
public static string GetModel(this AssistantType assistantType)
=> assistantType switch
{
AssistantType.SalesAnalysis or AssistantType.MonthlyReport => "claude-sonnet-4-20250514",
AssistantType.SalesAnalysis => "claude-sonnet-4-20250514",
AssistantType.ProductAnalysis => "claude-haiku-4-5-20251001",
_ => throw new ArgumentOutOfRangeException(nameof(assistantType), assistantType, null)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public async Task Consume(ConsumeContext<GenerateProductEmbeddingsMessage> conte
logger.LogInformation("Embeddings do produto {ProductId} gerados.", productId);
var productEmbeddingsModel = new ProductEmbeddingsModel
{
ProductId = productId,
Embeddings = new Vector(embeddings)
ProductId = productId, CompanyId = product.CompanyId, Embeddings = new Vector(embeddings)
};

await modelService.CreateAsync(productEmbeddingsModel, context.CancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public AppDbContext CreateDbContext(string[] args)
b.MigrationsAssembly(typeof(AppDbContext).Assembly.FullName)
.MigrationsHistoryTable("__EFMigrationsHistory");
})
.AddInterceptors(
new CaseInsensitiveInterceptor(),
new AuditInterceptor());
.AddInterceptors(new CaseInsensitiveInterceptor(), new AuditInterceptor())
.EnableSensitiveDataLogging()
.EnableServiceProviderCaching();

return new AppDbContext(optionsBuilder.Options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,18 @@ protected override void Mapping(EntityTypeBuilder<ProductEmbeddingsModel> builde
.HasForeignKey(p => p.ProductId)
.HasConstraintName("fk_product_embeddings_product_id")
.OnDelete(DeleteBehavior.NoAction);

builder
.Property(p => p.CompanyId)
.HasColumnName("company_id")
.HasColumnType("uuid")
.IsRequired();

builder
.HasOne(p => p.Company)
.WithMany()
.HasForeignKey(p => p.CompanyId)
.HasConstraintName("fk_product_embeddings_company_id")
.OnDelete(DeleteBehavior.NoAction);
}
}
Loading
Loading