Add public AI prompt templates for websites.
Manage reusable templates in Super Admin, attach editable per-site prompts with Meshkee API public links that require no auth. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
4db9c7709d
commit
91a20a89d6
@@ -0,0 +1,32 @@
|
||||
-- Super Admin AI prompt templates (per website / domain), with public share ids.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ai_prompt_templates (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
domain_id BIGINT NOT NULL REFERENCES domains (id) ON DELETE CASCADE,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
body TEXT NOT NULL,
|
||||
public_id VARCHAR(32) NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
CONSTRAINT ai_prompt_templates_public_id_unique UNIQUE (public_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_prompt_templates_domain_id
|
||||
ON ai_prompt_templates (domain_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_prompt_templates_created_at
|
||||
ON ai_prompt_templates (created_at DESC);
|
||||
|
||||
CREATE OR REPLACE FUNCTION ai_prompt_templates_set_updated_at()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = now();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
DROP TRIGGER IF EXISTS ai_prompt_templates_set_updated_at ON ai_prompt_templates;
|
||||
CREATE TRIGGER ai_prompt_templates_set_updated_at
|
||||
BEFORE UPDATE ON ai_prompt_templates
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION ai_prompt_templates_set_updated_at();
|
||||
Reference in New Issue
Block a user