Skip to content
Extraits de code Groupes Projets
Valider ce06c8b4 rédigé par brahim.elfahim's avatar brahim.elfahim
Parcourir les fichiers

Merge branch feature/IA into 'develop' of...

Merge branch feature/IA into  'develop' of http://mc-git.com/marketing-confort/brainboost/brainboost-common
parents a403f531 a8ea4cbe
Branches
Étiquettes
1 requête de fusion!32Add AssistantManager model for the assistant devoir service
Pipeline #20188 en échec avec les étapes
in 2 minutes et 47 secondes
Affichage de
avec 505 ajouts et 12 suppressions
## [0.0.27-RELEASE]
## [0.0.31-RELEASE]
### Added
- Added AssistantManager model for the assistant devoir service.
### Changed
- Changes in existing functionality.
- updated AssistantManager and BaseEntity Model.
### Deprecated
- Soon-to-be removed features.
......@@ -16,7 +16,34 @@
### Security
- Any security improvements.
## [0.0.26-RELEASE]
## [0.0.31-RELEASE]
## Added
- Add AssitantType enums to gestion-modeles.
## [0.0.30-RELEASE]
### Added
-add entites assitant devoir
- Add models and enums to subject management
- add new attribut openai_api_key and openai_model and api_key_configured
## [0.0.29-RELEASE]
### Added
- Add gestion-modeles-service entities.
## [0.0.28-RELEASE]
### Added
- Add feild for phone country code to User.
## [0.0.27-RELEASE]
### Added
- modified nexus config
### Fixed
- Any bug fixes.
### Security
- Any security improvements.
## [0.0.26-RELEASE]
### Added
- Added assistant devoir model and enum for the assistant devoir service.
......@@ -56,7 +83,7 @@
### Security
- Any security improvements.
## [0.0.24-RELEASE]
## [0.0.24-RELEASE]
### Added
- Added AssistantManager model for the assistant management service.
......@@ -74,7 +101,7 @@
### Security
- Any security improvements.
## [0.0.23-RELEASE]
## [0.0.23-RELEASE]
### Added
- New features that have been added.
......@@ -92,7 +119,7 @@
### Security
- Any security improvements.
## [0.0.22-RELEASE]
## [0.0.22-RELEASE]
### Added
- Added multimedia processing models (ConfigAudio, FichierAudio, ResultatTranscription, SegmentTranscription, TraitementParole)
- Added audio compression type enum (NONE, LOSSLESS, LOSSY)
......@@ -112,14 +139,14 @@
### Security
- Any security improvements.
## [0.0.21-RELEASE]
## [0.0.21-RELEASE]
### Added
- Add Stripe models.
### Changed
- Update models in Payment, Subscriptions and UserManagement.
## [0.0.20-RELEASE]
## [0.0.20-RELEASE]
### Added
- Added models and enums for the subject management service.
......
......@@ -11,7 +11,7 @@
<groupId>com.marketingconfort</groupId>
<artifactId>brainboost-common</artifactId>
<version>0.0.26-RELEASE</version>
<version>0.0.31-SNAPSHOT</version>
<name>brainboost-common</name>
<description>Brain Boost common project </description>
<url/>
......
// src/main/java/com/marketingconfort/brainboost_common/assistant_devoir/enums/FilterSeverity.java
package com.marketingconfort.brainboost_common.assistant_devoir.enums;
import lombok.Getter;
/**
* Niveaux de sévérité pour le filtrage de contenu
*/
@Getter
public enum FilterSeverity {
/**
* Faible - Simple avertissement, contenu autorisé
*/
LOW("Low - Warning only", "Attention au vocabulaire"),
/**
* Moyen - Demande confirmation à l'utilisateur
*/
MEDIUM("Medium - Require confirmation", "Peux-tu reformuler ?"),
/**
* Élevé - Bloque le contenu, message éducatif
*/
HIGH("High - Block content", "Contenu non autorisé"),
/**
* Critique - Bloque et signale, alerte système
*/
CRITICAL("Critical - Block and report", "Contenu strictement interdit");
private final String displayName;
private final String defaultMessage;
FilterSeverity(String displayName, String defaultMessage) {
this.displayName = displayName;
this.defaultMessage = defaultMessage;
}
/**
* Obtenir un message adapté au niveau éducatif
*/
public String getEducationalMessage(String educationalLevel) {
if (educationalLevel == null) educationalLevel = "CP";
return switch (educationalLevel.toUpperCase()) {
case "CP", "CE1" -> switch (this) {
case LOW -> "Fais attention aux mots que tu utilises !";
case MEDIUM -> "Peux-tu dire ça autrement ?";
case HIGH -> "Je ne peux pas t'aider avec ça. Pose-moi une autre question !";
case CRITICAL -> "Ces mots ne sont pas autorisés. Parlons de tes devoirs !";
};
case "CE2", "CM1" -> switch (this) {
case LOW -> "Attention au vocabulaire utilisé.";
case MEDIUM -> "Peux-tu reformuler ta question ?";
case HIGH -> "Je ne peux pas traiter ce type de contenu.";
case CRITICAL -> "Contenu non autorisé. Parlons plutôt de tes études !";
};
case "CM2", "SIXIEME", "CINQUIEME", "QUATRIEME", "TROISIEME" -> switch (this) {
case LOW -> "Merci de faire attention au vocabulaire.";
case MEDIUM -> "Pourrais-tu reformuler de manière plus appropriée ?";
case HIGH -> "Je ne peux pas t'aider avec ce type de contenu.";
case CRITICAL -> "Ce contenu n'est pas autorisé. Concentrons-nous sur tes devoirs.";
};
default -> defaultMessage;
};
}
/**
* Vérifie si cette sévérité autorise le contenu
*/
public boolean allowsContent() {
return this == LOW;
}
/**
* Vérifie si cette sévérité nécessite une confirmation
*/
public boolean requiresConfirmation() {
return this == MEDIUM;
}
/**
* Vérifie si cette sévérité bloque le contenu
*/
public boolean blocksContent() {
return this == HIGH || this == CRITICAL;
}
/**
* Vérifie si cette sévérité nécessite un signalement
*/
public boolean requiresReporting() {
return this == CRITICAL;
}
}
\ No newline at end of file
package com.marketingconfort.brainboost_common.assistant_devoir.enums;
import lombok.Getter;
/**
* Types de filtres de contenu
*/
@Getter
public enum FilterType {
/**
* Filtre global - appliqué à tous les utilisateurs et assistants
*/
GLOBAL("Global filter", "Appliqué à tous"),
/**
* Filtre spécifique à un type d'assistant
*/
ASSISTANT_SPECIFIC("Assistant specific", "Spécifique à un assistant"),
/**
* Filtre spécifique à un utilisateur
*/
USER_SPECIFIC("User specific", "Spécifique à un utilisateur"),
/**
* Filtre basé sur le niveau éducatif
*/
EDUCATIONAL_LEVEL("Educational level based", "Basé sur le niveau scolaire"),
/**
* Filtre spécifique à une matière
*/
SUBJECT_SPECIFIC("Subject specific", "Spécifique à une matière"),
/**
* Filtre de contenu éducatif
*/
EDUCATIONAL_CONTENT("Educational content", "Contenu éducatif"),
/**
* Filtre de sécurité (mots dangereux/inappropriés)
*/
SAFETY("Safety filter", "Filtre de sécurité"),
/**
* Filtre parental (restrictions demandées par les parents)
*/
PARENTAL("Parental control", "Contrôle parental");
private final String displayName;
private final String description;
FilterType(String displayName, String description) {
this.displayName = displayName;
this.description = description;
}
/**
* Vérifier si ce type de filtre s'applique globalement
*/
public boolean isGlobal() {
return this == GLOBAL || this == SAFETY || this == EDUCATIONAL_CONTENT;
}
/**
* Vérifier si ce type de filtre est spécifique à un utilisateur
*/
public boolean isUserSpecific() {
return this == USER_SPECIFIC || this == PARENTAL;
}
/**
* Vérifier si ce type de filtre est spécifique à un assistant
*/
public boolean isAssistantSpecific() {
return this == ASSISTANT_SPECIFIC || this == EDUCATIONAL_LEVEL || this == SUBJECT_SPECIFIC;
}
/**
* Obtenir la priorité du filtre (plus haut = plus prioritaire)
*/
public int getPriority() {
return switch (this) {
case SAFETY -> 100; // Priorité maximale
case GLOBAL -> 90;
case PARENTAL -> 80;
case USER_SPECIFIC -> 70;
case EDUCATIONAL_LEVEL -> 60;
case ASSISTANT_SPECIFIC -> 50;
case SUBJECT_SPECIFIC -> 40;
case EDUCATIONAL_CONTENT -> 30;
};
}
/**
* Obtenir un message d'explication pour ce type de filtre
*/
public String getExplanationMessage() {
return switch (this) {
case GLOBAL -> "Ce filtre s'applique à tous les utilisateurs et assistants.";
case ASSISTANT_SPECIFIC -> "Ce filtre s'applique spécifiquement à cet assistant.";
case USER_SPECIFIC -> "Ce filtre s'applique spécifiquement à cet utilisateur.";
case EDUCATIONAL_LEVEL -> "Ce filtre s'applique selon le niveau scolaire.";
case SUBJECT_SPECIFIC -> "Ce filtre s'applique à cette matière spécifique.";
case EDUCATIONAL_CONTENT -> "Ce filtre concerne le contenu pédagogique.";
case SAFETY -> "Ce filtre protège contre les contenus dangereux.";
case PARENTAL -> "Ce filtre a été configuré par les parents.";
};
}
}
\ No newline at end of file
......@@ -23,12 +23,21 @@ public class ChildHomeworkAssistant extends BaseEntity {
@Column(name = "status", nullable = false)
private AssistantStatus status = AssistantStatus.ACTIVE;
@Column(name = "description", columnDefinition = "TEXT")
private String description;
@Column(name = "forbidden_words", columnDefinition = "TEXT")
private String forbiddenWords;
@Column(name = "forbidden_response_words", columnDefinition = "TEXT")
private String forbiddenResponseWords;
@Enumerated(EnumType.STRING)
@Column(name = "education_level", nullable = false)
private EducationLevel educationLevel;
@Column(name = "isActive ", nullable = false)
private Boolean isActive = true;
@Column(name = "is_active", nullable = false)
private Boolean isActive = true;
@ElementCollection
@CollectionTable(
......@@ -37,4 +46,17 @@ public class ChildHomeworkAssistant extends BaseEntity {
)
@Column(name = "input_type")
private List<String> supportedInputTypes;
}
\ No newline at end of file
@Column(name = "openai_api_key", length = 255)
private String openaiApiKey;
@Column(name = "openai_model", length = 100)
private String openaiModel = "gpt-3.5-turbo";
@Column(name = "api_key_configured", nullable = false)
private Boolean apiKeyConfigured = false;
public void setOpenaiApiKey(String openaiApiKey) {
this.openaiApiKey = openaiApiKey;
this.apiKeyConfigured = (openaiApiKey != null && !openaiApiKey.trim().isEmpty());
}}
\ No newline at end of file
......@@ -22,7 +22,11 @@ public class MediaConfig extends BaseEntity {
@Column(name = "ocr_enabled", nullable = false)
private Boolean ocrEnabled = false;
@Column(name = "audio_response_enabled", nullable = false)
private Boolean audioResponseEnabled = false;
@Column(name = "pdf_enabled", nullable = false)
private Boolean pdfEnabled = false;
@Column(name = "voice_transcription_enabled", nullable = false)
private Boolean voiceTranscriptionEnabled = false;
......
package com.marketingconfort.brainboost_common.assistant_devoir.models;
import com.marketingconfort.brainboost_common.assistantmanagement.models.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
@Entity
@Table(name = "user_content_restriction",
uniqueConstraints = {
@UniqueConstraint(name = "unique_user_assistant",
columnNames = {"user_id", "assistant_id"})
},
indexes = {
@Index(name = "idx_user_restriction", columnList = "user_id"),
@Index(name = "idx_assistant_restriction", columnList = "assistant_id"),
@Index(name = "idx_active_restrictions", columnList = "is_active")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class UserContentRestriction extends BaseEntity {
@Column(name = "user_id", nullable = false)
private Long userId;
@Column(name = "assistant_id", nullable = false)
private Long assistantId;
@Column(name = "forbidden_input_words", columnDefinition = "TEXT")
private String forbiddenInputWords; // "pokemon,jeux,dessins animés"
@Column(name = "restriction_reason")
private String restrictionReason; // "Demande des parents"
@Column(name = "is_active", nullable = false)
private Boolean isActive = true;
}
\ No newline at end of file
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum AssitantType {
DEVOIR,
APPRENTISSAGE,
RECHERCHE
}
\ No newline at end of file
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum DeploymentStatus {
PENDING,
SUCCESSFUL,
FAILED,
ROLLEDBACK
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum EnvironmentType {
DEV,
TEST,
PROD
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum GpuType {
NONE,
T4,
A100,
A10,
V100,
H100
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum ModelStatus {
DRAFT,
ACTIVE,
INACTIVE,
ARCHIVED
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum ModelType {
RAG,
EMBEDDING,
OCR,
GENERATION,
TTS,
CLASSIFICATION
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum ResetPeriod {
DAILY,
WEEKLY,
MONTHLY,
QUARTERLY,
YEARLY
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum ResourceType {
INPUT_TOKENS,
OUTPUT_TOKENS,
EMBEDDING,
IMAGE_GENERATION,
AUDIO_PROCESSING,
VECTOR_SEARCH
}
package com.marketingconfort.brainboost_common.gestion_modeles.enums;
public enum VersionStatus {
DRAFT,
TESTING,
PRODUCTION,
DEPRECATED
}
package com.marketingconfort.brainboost_common.gestion_modeles.models;
import com.marketingconfort.brainboost_common.gestion_modeles.enums.AssitantType;
import com.marketingconfort.brainboost_common.gestion_modeles.enums.ModelStatus;
import com.marketingconfort.brainboost_common.gestion_modeles.enums.ModelType;
import jakarta.persistence.*;
import lombok.*;
import java.time.LocalDateTime;
import java.util.List;
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AIModel extends BaseEntity {
private String name;
private String description;
@Enumerated(EnumType.STRING)
private ModelType modelType;
private String baseUrl;
@Enumerated(EnumType.STRING)
private ModelStatus status;
private LocalDateTime lastUpdate;
private Integer ragServiceId;
@Enumerated(EnumType.STRING)
private AssitantType assistantType;
@OneToMany(mappedBy = "model", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Version> versions;
}
\ No newline at end of file
package com.marketingconfort.brainboost_common.gestion_modeles.models;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.time.LocalDateTime;
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
public abstract class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@CreatedDate
@Column(updatable = false)
private LocalDateTime createdAt;
}
package com.marketingconfort.brainboost_common.gestion_modeles.models;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.OneToMany;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class BillingData extends BaseEntity {
private String subscriptionId;
private LocalDateTime startDate;
private LocalDateTime endDate;
private Double totalCost;
@OneToMany(mappedBy = "billingData", cascade = CascadeType.ALL, orphanRemoval = true)
private List<UsageRecord> usageRecords;
}
package com.marketingconfort.brainboost_common.gestion_modeles.models;
import com.marketingconfort.brainboost_common.gestion_modeles.enums.DeploymentStatus;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DeploymentRecord extends BaseEntity {
private LocalDateTime deploymentDate;
private String deployedBy;
@Enumerated(EnumType.STRING)
private DeploymentStatus status;
private Boolean isActive;
@ManyToOne
@JoinColumn(name = "version_id")
private Version version;
@ManyToOne
@JoinColumn(name = "environment_id")
private Environment environment;
@OneToMany(mappedBy = "deploymentRecord", cascade = CascadeType.ALL, orphanRemoval = true)
private List<UsageRecord> usageRecords;
}
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter