feat: auto committed

This commit is contained in:
SpecialX
2026-07-10 18:57:39 +08:00
parent c09d6fb7d2
commit 9ea81f1bd7
96 changed files with 13000 additions and 392 deletions

View File

@@ -58,3 +58,25 @@ message GradeEvent {
string action = 8;
map<string, string> metadata = 9;
}
// AI 用量计费事件ai 服务发布data-ana 消费落 ClickHouse
// 派生数据,豁免 Outbox004 §12.2topic: edu.ai.usagematrix.md §4 + ISSUE-02 裁决)
message AIUsageEvent {
string event_id = 1; // UUID幂等去重
string aggregate_id = 2; // workflow_id 或 request_id
string event_type = 3; // 固定 "AIUsageRecorded"
int64 occurred_at = 4; // Unix 毫秒时间戳
string user_id = 5;
string school_id = 6; // 用于多租户配额
string request_id = 7; // 链路追踪 ID
string provider = 8; // openai/anthropic/baichuan/local_ollama
string model = 9; // gpt-4o-mini/claude-3-haiku/...
string operation = 10; // chat/generate_question/optimize_expression/lesson_preparation
uint32 prompt_tokens = 11;
uint32 completion_tokens = 12;
uint32 total_tokens = 13;
uint32 latency_ms = 14;
bool success = 15;
bool degraded = 16; // 是否降级LLM 不可用时)
map<string, string> metadata = 17; // 额外上下文subject/grade/difficulty 等)
}