1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 01:12:03 +00:00

add AI stats (#7932)

* add AI credit

* update

* update test

* optimize

* Delete index.js

* update

* Update authentication.py

* add 429 for translate api

* remove-useless-code

* update ui

---------

Co-authored-by: 孙永强 <11704063+s-yongqiang@user.noreply.gitee.com>
Co-authored-by: r350178982 <32759763+r350178982@users.noreply.github.com>
This commit is contained in:
awu0403
2025-06-24 16:52:24 +08:00
committed by GitHub
parent 9328b7f8a5
commit 523637a735
15 changed files with 235 additions and 22 deletions

View File

@@ -1654,3 +1654,33 @@ CREATE TABLE `notifications_sysusernotification` (
KEY `notifications_sysusernotification_seen_9d851bf7` (`seen`),
KEY `notifications_sysusernotification_created_at_56ffd2a0` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `stats_ai_by_team` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`org_id` bigint(20) NOT NULL,
`month` date NOT NULL,
`model` varchar(100) NOT NULL,
`input_tokens` int(11) DEFAULT NULL,
`output_tokens` int(11) DEFAULT NULL,
`cost` double NOT NULL,
`created_at` datetime(6) DEFAULT NULL,
`updated_at` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stats_ai_by_team_org_id_month_model` (`org_id`,`month`,`model`),
KEY `ix_stats_ai_by_team_org_id_month` (`org_id`,`month`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `stats_ai_by_owner` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`month` date NOT NULL,
`model` varchar(100) NOT NULL,
`input_tokens` int(11) DEFAULT NULL,
`output_tokens` int(11) DEFAULT NULL,
`cost` double NOT NULL,
`created_at` datetime(6) DEFAULT NULL,
`updated_at` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stats_ai_by_owner_username_month_model` (`username`,`month`,`model`),
KEY `ix_stats_ai_by_owner_username_month` (`username`,`month`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;