feat: add mock key catalog and standard calls
This commit is contained in:
1 parent
78ed3c1103
commit
5e8e462548
8 files changed
+671
-8
No files matched your search
@@ -0,0 +1,47 @@
|
||||
CREATE TABLE IF NOT EXISTS model_providers (
|
||||
id varchar(64) PRIMARY KEY,
|
||||
code varchar(64) NOT NULL UNIQUE,
|
||||
name varchar(120) NOT NULL,
|
||||
protocol varchar(32) NOT NULL CHECK (protocol IN ('openai-compatible', 'http', 'sdk')),
|
||||
base_url text,
|
||||
description text,
|
||||
status varchar(16) NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'disabled')),
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS model_catalog (
|
||||
id varchar(64) PRIMARY KEY,
|
||||
provider_id varchar(64) NOT NULL REFERENCES model_providers(id),
|
||||
public_name varchar(160) NOT NULL,
|
||||
upstream_model varchar(160) NOT NULL,
|
||||
model_type varchar(24) NOT NULL CHECK (model_type IN ('text', 'code', 'multimodal', 'image', 'audio', 'video', 'embedding', '3d')),
|
||||
call_mode varchar(16) NOT NULL CHECK (call_mode IN ('sync', 'stream', 'async')),
|
||||
description text NOT NULL DEFAULT '',
|
||||
input_types jsonb NOT NULL DEFAULT '[]'::jsonb,
|
||||
output_types jsonb NOT NULL DEFAULT '[]'::jsonb,
|
||||
capabilities jsonb NOT NULL DEFAULT '{}'::jsonb,
|
||||
status varchar(16) NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'disabled')),
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS model_catalog_provider_id_idx ON model_catalog(provider_id);
|
||||
CREATE INDEX IF NOT EXISTS model_catalog_status_idx ON model_catalog(status);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS platform_api_keys (
|
||||
id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
name varchar(80) NOT NULL,
|
||||
key_prefix varchar(24) NOT NULL,
|
||||
key_hash char(64) NOT NULL UNIQUE,
|
||||
scopes jsonb NOT NULL DEFAULT '["invoke"]'::jsonb,
|
||||
model_ids jsonb NOT NULL DEFAULT '[]'::jsonb,
|
||||
status varchar(16) NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'disabled')),
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
last_used_at timestamptz,
|
||||
revoked_at timestamptz
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS platform_api_keys_user_id_idx ON platform_api_keys(user_id);
|
||||
CREATE INDEX IF NOT EXISTS platform_api_keys_status_idx ON platform_api_keys(status);
|
||||
Reference in new issue
Block a user