181 lines
5.9 KiB
SQL
181 lines
5.9 KiB
SQL
create table providers (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
type text not null,
|
|
name text not null,
|
|
key text,
|
|
url text,
|
|
models text,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
|
|
create table settings (
|
|
id text not null primary key,
|
|
default_lang text not null default 'en',
|
|
register_enabled numeric not null default 1,
|
|
password_enabled numeric not null default 1,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table oidc (
|
|
id text not null primary key,
|
|
label text not null,
|
|
domain text not null,
|
|
client_id text not null,
|
|
client_secret text not null,
|
|
wellknown_url text not null,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table users (
|
|
id text not null primary key,
|
|
firstname text not null default '',
|
|
lastname text not null default '',
|
|
password text not null default '',
|
|
email text not null unique,
|
|
picture text not null default '',
|
|
enabled numeric default true,
|
|
theme text default 'auto',
|
|
lang text default 'fr',
|
|
timezone text default 'Europe/Paris',
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table user_addresses (
|
|
id text not null primary key,
|
|
user_id text not null,
|
|
type text not null,
|
|
address text not null,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table teams (
|
|
id text not null primary key,
|
|
label text not null,
|
|
default_agent_id text,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric ,
|
|
_version text not null
|
|
);
|
|
|
|
create table user_teams (
|
|
id text not null primary key,
|
|
user_id text not null,
|
|
team_id text not null,
|
|
administrator bool default 0,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table channels (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
name text not null,
|
|
type text not null,
|
|
enabled numeric not null default 1,
|
|
configuration text not null default '{}',
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table tools (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
name text not null,
|
|
enabled numeric not null default 1,
|
|
configuration text not null default '',
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table tasks (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
model_id text not null,
|
|
label text not null,
|
|
prompt text not null,
|
|
cron text not null,
|
|
status text not null,
|
|
next_datetime numeric,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table chats (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
start_datetime numeric not null,
|
|
end_datetime numeric,
|
|
agent_id text,
|
|
user_id text,
|
|
task_id text,
|
|
title text,
|
|
fresh_title numeric default 0,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table chat_messages (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
chat_id text not null,
|
|
content_datetime numeric,
|
|
role text not null,
|
|
content text,
|
|
agent_id text,
|
|
tool_call_id text,
|
|
tool_calls text,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric,
|
|
_version text not null
|
|
);
|
|
|
|
create table files (
|
|
id text not null primary key,
|
|
name text not null default '',
|
|
content_type text not null default '',
|
|
storage_path text not null default '',
|
|
storage_filename text not null default '',
|
|
content blob,
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric ,
|
|
_version text not null
|
|
);
|
|
|
|
create table agents (
|
|
id text not null primary key,
|
|
team_id text not null,
|
|
name text not null default '',
|
|
system_prompt text not null default '',
|
|
def_provider_id text not null default '',
|
|
def_model_id text not null default '',
|
|
tools_policy text not null default '',
|
|
sub_agents numeric not null default 0,
|
|
loop_strategy text not null default '',
|
|
max_iterations numeric not null default 1,
|
|
stopping_criteria text not null default '',
|
|
-- kb text not null default '',
|
|
-- tools text not null default '',
|
|
-- skills text not null default '',
|
|
-- channels text not null default '',
|
|
_date_created numeric not null default current_timestamp,
|
|
_date_updated numeric ,
|
|
_version text not null
|
|
);
|