mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
feat: allow setting default model enable as chat, memory, embedding
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
DROP TABLE IF EXISTS lifecycle_events;
|
||||
DROP TABLE IF EXISTS container_versions;
|
||||
DROP TABLE IF EXISTS models;
|
||||
DROP TABLE IF EXISTS snapshots;
|
||||
DROP TABLE IF EXISTS containers;
|
||||
DROP TABLE IF EXISTS users;
|
||||
|
||||
@@ -79,9 +79,14 @@ CREATE TABLE IF NOT EXISTS models (
|
||||
dimensions INTEGER,
|
||||
is_multimodal BOOLEAN NOT NULL DEFAULT false,
|
||||
type TEXT NOT NULL DEFAULT 'chat',
|
||||
enable_as TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
CONSTRAINT models_model_id_unique UNIQUE (model_id),
|
||||
CONSTRAINT models_enable_as_check CHECK (
|
||||
(type = 'embedding' AND (enable_as = 'embedding' OR enable_as IS NULL)) OR
|
||||
(type = 'chat' AND (enable_as IN ('chat', 'memory') OR enable_as IS NULL))
|
||||
),
|
||||
CONSTRAINT models_type_check CHECK (type IN ('chat', 'embedding')),
|
||||
CONSTRAINT models_dimensions_check CHECK (type != 'embedding' OR dimensions IS NOT NULL)
|
||||
);
|
||||
@@ -99,6 +104,10 @@ CREATE TABLE IF NOT EXISTS model_variants (
|
||||
CREATE INDEX IF NOT EXISTS idx_model_variants_model_uuid ON model_variants(model_uuid);
|
||||
CREATE INDEX IF NOT EXISTS idx_model_variants_variant_id ON model_variants(variant_id);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_models_enable_as_unique ON models(enable_as) WHERE enable_as IS NOT NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_snapshots_container_id ON snapshots(container_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_snapshots_parent_id ON snapshots(parent_snapshot_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS container_versions (
|
||||
id TEXT PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user