feat: migrate java control plane foundation
This commit is contained in:
1 parent
1615401185
commit
9da175c040
24 files changed
+1555
-12
No files matched your search
@@ -31,9 +31,18 @@ management:
|
||||
enabled: true
|
||||
|
||||
moyi:
|
||||
web:
|
||||
cors-origins: ${CONTROL_PLANE_CORS_ORIGINS:http://localhost:5173,http://127.0.0.1:5173}
|
||||
auth:
|
||||
session-ttl-hours: ${SESSION_TTL_HOURS:168}
|
||||
password-pepper: ${AUTH_PASSWORD_PEPPER:}
|
||||
secure-cookie: ${AUTH_SECURE_COOKIE:false}
|
||||
bootstrap:
|
||||
admin-account: ${ADMIN_ACCOUNT:adimin}
|
||||
admin-password: ${ADMIN_PASSWORD:admin123}
|
||||
admin-display-name: ${ADMIN_DISPLAY_NAME:平台管理员}
|
||||
credentials:
|
||||
encryption-key: ${CREDENTIAL_ENCRYPTION_KEY:}
|
||||
storage:
|
||||
oss-endpoint: ${OSS_ENDPOINT:}
|
||||
oss-region: ${OSS_REGION:}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
ALTER TABLE model_providers
|
||||
ADD COLUMN IF NOT EXISTS source_type varchar(24) NOT NULL DEFAULT 'custom',
|
||||
ADD COLUMN IF NOT EXISTS credential_type varchar(24),
|
||||
ADD COLUMN IF NOT EXISTS credential_ciphertext text,
|
||||
ADD COLUMN IF NOT EXISTS credential_masked varchar(64);
|
||||
|
||||
ALTER TABLE model_catalog
|
||||
ADD COLUMN IF NOT EXISTS model_key varchar(160),
|
||||
ADD COLUMN IF NOT EXISTS source_label varchar(160),
|
||||
ADD COLUMN IF NOT EXISTS pricing jsonb,
|
||||
ADD COLUMN IF NOT EXISTS priority integer,
|
||||
ADD COLUMN IF NOT EXISTS max_concurrency integer;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS model_catalog_model_key_idx ON model_catalog(model_key);
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE IF NOT EXISTS usage_events (
|
||||
id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
api_key_id uuid REFERENCES platform_api_keys(id) ON DELETE SET NULL,
|
||||
model_id varchar(64) REFERENCES model_catalog(id) ON DELETE SET NULL,
|
||||
event_kind varchar(16) NOT NULL CHECK (event_kind IN ('call', 'task')),
|
||||
status varchar(16) NOT NULL CHECK (status IN ('queued', 'running', 'succeeded', 'failed', 'cancelled')),
|
||||
latency_ms integer,
|
||||
input_units bigint,
|
||||
output_units bigint,
|
||||
cost_amount numeric(18, 6),
|
||||
provider_task_id varchar(160),
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS usage_events_user_created_idx ON usage_events(user_id, created_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS usage_events_task_id_idx ON usage_events(provider_task_id);
|
||||
@@ -0,0 +1,20 @@
|
||||
INSERT INTO model_providers (id, code, name, protocol, source_type, base_url, description, status)
|
||||
VALUES
|
||||
('provider-mock', 'moyi-mock', 'MOYI Mock Provider', 'http', 'custom', 'http://mock.local', '用于本地联调的 Mock 供应商。', 'active'),
|
||||
('provider-deepseek', 'deepseek', 'DeepSeek', 'openai-compatible', 'official', 'https://api.deepseek.com', 'DeepSeek 官方兼容接口。', 'active'),
|
||||
('provider-kimi', 'kimi', '月之暗面 Kimi', 'openai-compatible', 'official', 'https://api.moonshot.ai/v1', 'Kimi 官方兼容接口。', 'active'),
|
||||
('provider-zhipu', 'zhipu', '智谱 GLM', 'openai-compatible', 'official', 'https://open.bigmodel.cn/api/paas/v4', '智谱官方兼容接口。', 'active'),
|
||||
('provider-bytedance', 'bytedance', '字节跳动 Seedance', 'http', 'official', 'https://ark.cn-beijing.volces.com/api/v3', '火山方舟异步视频模型。', 'active'),
|
||||
('provider-vast', 'vast-tripo', 'VAST / Tripo', 'http', 'official', 'https://api.tripo3d.ai', 'Tripo 异步 3D 模型。', 'active')
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
INSERT INTO model_catalog (id, provider_id, model_key, public_name, upstream_model, model_type, call_mode, description, input_types, output_types, capabilities, status)
|
||||
VALUES
|
||||
('model-mock-text', 'provider-mock', 'moyi-mock-text', 'MOYI Text Pro(Mock)', 'moyi-mock-text-v1', 'multimodal', 'sync', '用于本地验证标准聊天接口的同步模型。', '["text", "image"]', '["text"]', '{"streaming":true,"vision":true}', 'active'),
|
||||
('model-deepseek-v4-flash', 'provider-deepseek', 'deepseek-v4-flash', 'DeepSeek V4 Flash', 'deepseek-v4-flash', 'text', 'sync', 'DeepSeek 高速文本模型。', '["text"]', '["text"]', '{"streaming":true}', 'active'),
|
||||
('model-deepseek-v4-pro', 'provider-deepseek', 'deepseek-v4-pro', 'DeepSeek V4 Pro', 'deepseek-v4-pro', 'text', 'sync', 'DeepSeek 高能力推理模型。', '["text"]', '["text"]', '{"streaming":true,"reasoning":true}', 'active'),
|
||||
('model-kimi-k3', 'provider-kimi', 'kimi-k3', 'Kimi K3', 'kimi-k3', 'multimodal', 'sync', 'Kimi 长上下文多模态模型。', '["text", "image"]', '["text"]', '{"streaming":true,"vision":true}', 'active'),
|
||||
('model-glm-4-5', 'provider-zhipu', 'glm-4.5', 'GLM-4.5', 'glm-4.5', 'multimodal', 'sync', '智谱 GLM 通用多模态模型。', '["text", "image"]', '["text"]', '{"streaming":true,"toolCalling":true}', 'active'),
|
||||
('model-seedance-1-0-pro', 'provider-bytedance', 'seedance-1.0-pro', 'Seedance 1.0 Pro', 'doubao-seedance-1-0-pro-250528', 'video', 'async', '异步文生视频模型。', '["text", "image", "video", "audio"]', '["video"]', '{"taskPolling":true,"webhook":true}', 'active'),
|
||||
('model-mock-3d', 'provider-vast', 'tripo-v3', 'Tripo 3D Generator', 'v3.1-20260211', '3d', 'async', '异步文生 3D 模型。', '["text", "image"]', '["model", "thumbnail"]', '{"taskPolling":true,"webhook":true,"formats":["glb","obj","fbx"]}', 'active')
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
Reference in new issue
Block a user