Checkpoint: Ajout de la configuration des champs obligatoires pour le score LLM
Nouvelle fonctionnalité permettant de configurer quels champs sont obligatoires ou optionnels pour atteindre un score de reconnaissance de 100%. Modifications: - Nouvelle table llmFieldsConfig dans la base de données - Routes tRPC pour gérer la configuration (getAll, updateField) - Interface utilisateur dans la page Paramètres avec tableau et cases à cocher - Modification du code d'extraction pour générer dynamiquement l'instruction de score - Initialisation automatique des champs par défaut (supplierName, invoiceNumber, invoiceDate, totalAmount obligatoires) - Tests unitaires pour valider la fonctionnalité L'utilisateur peut maintenant personnaliser quels champs doivent être détectés pour qu'une facture atteigne 100% de score.
This commit is contained in:
11
drizzle/0011_woozy_sabretooth.sql
Normal file
11
drizzle/0011_woozy_sabretooth.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE `llmFieldsConfig` (
|
||||
`id` int AUTO_INCREMENT NOT NULL,
|
||||
`userId` int NOT NULL,
|
||||
`fieldName` varchar(100) NOT NULL,
|
||||
`displayName` varchar(255) NOT NULL,
|
||||
`isRequired` int NOT NULL DEFAULT 1,
|
||||
`displayOrder` int NOT NULL DEFAULT 0,
|
||||
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
||||
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT `llmFieldsConfig_id` PRIMARY KEY(`id`)
|
||||
);
|
||||
1288
drizzle/meta/0011_snapshot.json
Normal file
1288
drizzle/meta/0011_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,13 @@
|
||||
"when": 1770831408967,
|
||||
"tag": "0010_late_thor_girl",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 11,
|
||||
"version": "5",
|
||||
"when": 1770971673626,
|
||||
"tag": "0011_woozy_sabretooth",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -283,3 +283,22 @@ export const automationRules = mysqlTable("automationRules", {
|
||||
|
||||
export type AutomationRule = typeof automationRules.$inferSelect;
|
||||
export type InsertAutomationRule = typeof automationRules.$inferInsert;
|
||||
|
||||
/**
|
||||
* LLM Fields Configuration table
|
||||
* Stores configuration for each field used in invoice extraction
|
||||
* Allows users to define which fields are required for quality score calculation
|
||||
*/
|
||||
export const llmFieldsConfig = mysqlTable("llmFieldsConfig", {
|
||||
id: int("id").autoincrement().primaryKey(),
|
||||
userId: int("userId").notNull(), // Each user has their own configuration
|
||||
fieldName: varchar("fieldName", { length: 100 }).notNull(), // Field identifier (supplierName, invoiceNumber, etc.)
|
||||
displayName: varchar("displayName", { length: 255 }).notNull(), // Human-readable field name
|
||||
isRequired: int("isRequired").default(1).notNull(), // 1 = required for 100% score, 0 = optional
|
||||
displayOrder: int("displayOrder").default(0).notNull(), // Order in UI
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
|
||||
});
|
||||
|
||||
export type LlmFieldConfig = typeof llmFieldsConfig.$inferSelect;
|
||||
export type InsertLlmFieldConfig = typeof llmFieldsConfig.$inferInsert;
|
||||
|
||||
Reference in New Issue
Block a user