feat: meter AI usage
This commit is contained in:
@@ -1016,10 +1016,16 @@ public static class StartupInitializationExtensions
|
||||
"Title" TEXT NOT NULL,
|
||||
"Provider" TEXT NOT NULL,
|
||||
"ResultJson" TEXT NOT NULL,
|
||||
"InputCharacterCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"OutputCharacterCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"EstimatedTokenCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"CreatedAtUtc" TEXT NOT NULL,
|
||||
CONSTRAINT "FK_AiInteractions_JobApplications_JobApplicationId" FOREIGN KEY ("JobApplicationId") REFERENCES "JobApplications" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
""");
|
||||
EnsureColumn(c, "AiInteractions", "InputCharacterCount", "ALTER TABLE AiInteractions ADD COLUMN InputCharacterCount INTEGER NOT NULL DEFAULT 0;");
|
||||
EnsureColumn(c, "AiInteractions", "OutputCharacterCount", "ALTER TABLE AiInteractions ADD COLUMN OutputCharacterCount INTEGER NOT NULL DEFAULT 0;");
|
||||
EnsureColumn(c, "AiInteractions", "EstimatedTokenCount", "ALTER TABLE AiInteractions ADD COLUMN EstimatedTokenCount INTEGER NOT NULL DEFAULT 0;");
|
||||
Exec(c, """CREATE INDEX IF NOT EXISTS "IX_AiInteractions_JobApplicationId" ON "AiInteractions" ("JobApplicationId");""");
|
||||
Exec(c, """CREATE INDEX IF NOT EXISTS "IX_AiInteractions_Owner_Job_Module_Created" ON "AiInteractions" ("OwnerUserId", "JobApplicationId", "Module", "CreatedAtUtc");""");
|
||||
}
|
||||
@@ -1760,6 +1766,9 @@ public static class StartupInitializationExtensions
|
||||
`Title` varchar(255) NOT NULL,
|
||||
`Provider` varchar(100) NOT NULL,
|
||||
`ResultJson` longtext NOT NULL,
|
||||
`InputCharacterCount` int NOT NULL DEFAULT 0,
|
||||
`OutputCharacterCount` int NOT NULL DEFAULT 0,
|
||||
`EstimatedTokenCount` int NOT NULL DEFAULT 0,
|
||||
`CreatedAtUtc` datetime(6) NOT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
CONSTRAINT `FK_AiInteractions_JobApplications_JobApplicationId` FOREIGN KEY (`JobApplicationId`) REFERENCES `JobApplications` (`Id`) ON DELETE CASCADE
|
||||
@@ -1842,6 +1851,9 @@ public static class StartupInitializationExtensions
|
||||
EnsureMySqlAutoIncrementPrimaryKey(conn, "CvVariants", "Id");
|
||||
EnsureMySqlAutoIncrementPrimaryKey(conn, "CvVariantVersions", "Id");
|
||||
EnsureMySqlAutoIncrementPrimaryKey(conn, "AiInteractions", "Id");
|
||||
EnsureMySqlColumn(conn, "AiInteractions", "InputCharacterCount", "ALTER TABLE `AiInteractions` ADD COLUMN `InputCharacterCount` int NOT NULL DEFAULT 0;");
|
||||
EnsureMySqlColumn(conn, "AiInteractions", "OutputCharacterCount", "ALTER TABLE `AiInteractions` ADD COLUMN `OutputCharacterCount` int NOT NULL DEFAULT 0;");
|
||||
EnsureMySqlColumn(conn, "AiInteractions", "EstimatedTokenCount", "ALTER TABLE `AiInteractions` ADD COLUMN `EstimatedTokenCount` int NOT NULL DEFAULT 0;");
|
||||
|
||||
foreach (var (ixTable, ixName, ixColumns, ixUnique) in new[]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user