From 16fd5a35301bfdc8b139c00a9333cf33b7cb6af5 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 25 Aug 2026 14:11:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(llm-proxy):=20=E6=96=B0=E5=A2=9E=20pipelin?= =?UTF-8?q?e=5Fllm=5Ftokens=20=E8=A1=A8(=E7=9F=AD=E6=9C=9F=20token=20+=20?= =?UTF-8?q?=E7=94=A8=E9=87=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/create_tables.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/create_tables.py b/scripts/create_tables.py index 078f452..87b825a 100644 --- a/scripts/create_tables.py +++ b/scripts/create_tables.py @@ -134,6 +134,31 @@ CREATE TABLE IF NOT EXISTS pipeline_session_settings ( KEY `idx_session` (`session_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; """, +""" +CREATE TABLE IF NOT EXISTS pipeline_llm_tokens ( + `id` varchar(32) NOT NULL, + `token` varchar(80) NOT NULL, + `org_id` varchar(32) NOT NULL DEFAULT '0', + `project_id` varchar(32) NOT NULL DEFAULT '', + `task_id` varchar(32) NOT NULL DEFAULT '', + `model_name` varchar(100) NOT NULL DEFAULT '', + `purpose` varchar(100) NOT NULL DEFAULT '', + `status` varchar(20) NOT NULL DEFAULT 'active', + `expires_at` datetime NOT NULL, + `max_calls` int(11) NOT NULL DEFAULT 500, + `call_count` int(11) NOT NULL DEFAULT 0, + `prompt_tokens` bigint(20) NOT NULL DEFAULT 0, + `completion_tokens` bigint(20) NOT NULL DEFAULT 0, + `created_by` varchar(64) NOT NULL DEFAULT '', + `created_at` datetime NOT NULL DEFAULT current_timestamp(), + `last_used_at` datetime NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_token` (`token`), + KEY `idx_org` (`org_id`), + KEY `idx_project` (`project_id`), + KEY `idx_status_exp` (`status`,`expires_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +""", ] # v2 引擎列迁移(原 init.py::_init_v2_tables 启动时 ALTER 迁移,现迁到部署期,information_schema 幂等)