- Introduction of PARTNER_RAG retriever, PARTNER_RAG_SPECIALIST and linked Agent and Task, to support documentation inquiries in the management app (eveai_app)

- Addition of a tenant_partner_services view to show partner services from the viewpoint of a tenant
- Addition of domain model diagrams
- Addition of license_periods views and form
This commit is contained in:
Josako
2025-07-16 21:24:08 +02:00
parent 000636a229
commit f3a243698c
30 changed files with 1566 additions and 356 deletions

View File

@@ -0,0 +1,138 @@
erDiagram
CATALOG {
int id PK
string name
text description
string type
string type_version
int min_chunk_size
int max_chunk_size
jsonb user_metadata
jsonb system_metadata
jsonb configuration
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PROCESSOR {
int id PK
string name
text description
int catalog_id FK
string type
string sub_file_type
boolean active
boolean tuning
jsonb user_metadata
jsonb system_metadata
jsonb configuration
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
RETRIEVER {
int id PK
string name
text description
int catalog_id FK
string type
string type_version
boolean tuning
jsonb user_metadata
jsonb system_metadata
jsonb configuration
jsonb arguments
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
DOCUMENT {
int id PK
int catalog_id FK
string name
datetime valid_from
datetime valid_to
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
DOCUMENT_VERSION {
int id PK
int doc_id FK
string url
string bucket_name
string object_name
string file_type
string sub_file_type
float file_size
string language
text user_context
text system_context
jsonb user_metadata
jsonb system_metadata
jsonb catalog_properties
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
boolean processing
datetime processing_started_at
datetime processing_finished_at
string processing_error
}
EMBEDDING {
int id PK
string type
int doc_vers_id FK
boolean active
text chunk
}
EMBEDDING_MISTRAL {
int id PK,FK
vector_1024 embedding
}
EMBEDDING_SMALL_OPENAI {
int id PK,FK
vector_1536 embedding
}
EMBEDDING_LARGE_OPENAI {
int id PK,FK
vector_3072 embedding
}
USER {
int id PK
string user_name
string email
}
%% Relationships
CATALOG ||--o{ PROCESSOR : "has many"
CATALOG ||--o{ RETRIEVER : "has many"
CATALOG ||--o{ DOCUMENT : "has many"
DOCUMENT ||--o{ DOCUMENT_VERSION : "has many"
DOCUMENT_VERSION ||--o{ EMBEDDING : "has many"
EMBEDDING ||--o| EMBEDDING_MISTRAL : "inheritance"
EMBEDDING ||--o| EMBEDDING_SMALL_OPENAI : "inheritance"
EMBEDDING ||--o| EMBEDDING_LARGE_OPENAI : "inheritance"
USER ||--o{ CATALOG : "creates/updates"
USER ||--o{ PROCESSOR : "creates/updates"
USER ||--o{ RETRIEVER : "creates/updates"
USER ||--o{ DOCUMENT : "creates/updates"
USER ||--o{ DOCUMENT_VERSION : "creates/updates"

View File

@@ -0,0 +1,244 @@
erDiagram
BUSINESS_EVENT_LOG {
int id PK
datetime timestamp
string event_type
int tenant_id
string trace_id
string span_id
string span_name
string parent_span_id
int document_version_id
float document_version_file_size
int specialist_id
string specialist_type
string specialist_type_version
string chat_session_id
int interaction_id
string environment
int llm_metrics_total_tokens
int llm_metrics_prompt_tokens
int llm_metrics_completion_tokens
float llm_metrics_total_time
int llm_metrics_nr_of_pages
int llm_metrics_call_count
string llm_interaction_type
text message
int license_usage_id FK
}
LICENSE {
int id PK
int tenant_id FK
int tier_id FK
date start_date
date end_date
int nr_of_periods
string currency
boolean yearly_payment
float basic_fee
int max_storage_mb
float additional_storage_price
int additional_storage_bucket
int included_embedding_mb
decimal additional_embedding_price
int additional_embedding_bucket
int included_interaction_tokens
decimal additional_interaction_token_price
int additional_interaction_bucket
float overage_embedding
float overage_interaction
boolean additional_storage_allowed
boolean additional_embedding_allowed
boolean additional_interaction_allowed
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
LICENSE_TIER {
int id PK
string name
string version
date start_date
date end_date
float basic_fee_d
float basic_fee_e
int max_storage_mb
decimal additional_storage_price_d
decimal additional_storage_price_e
int additional_storage_bucket
int included_embedding_mb
decimal additional_embedding_price_d
decimal additional_embedding_price_e
int additional_embedding_bucket
int included_interaction_tokens
decimal additional_interaction_token_price_d
decimal additional_interaction_token_price_e
int additional_interaction_bucket
float standard_overage_embedding
float standard_overage_interaction
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PARTNER_SERVICE_LICENSE_TIER {
int partner_service_id PK,FK
int license_tier_id PK,FK
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
LICENSE_PERIOD {
int id PK
int license_id FK
int tenant_id FK
int period_number
date period_start
date period_end
string currency
float basic_fee
int max_storage_mb
float additional_storage_price
int additional_storage_bucket
int included_embedding_mb
decimal additional_embedding_price
int additional_embedding_bucket
int included_interaction_tokens
decimal additional_interaction_token_price
int additional_interaction_bucket
boolean additional_storage_allowed
boolean additional_embedding_allowed
boolean additional_interaction_allowed
enum status
datetime upcoming_at
datetime pending_at
datetime active_at
datetime completed_at
datetime invoiced_at
datetime closed_at
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
LICENSE_USAGE {
int id PK
int tenant_id FK
float storage_mb_used
float embedding_mb_used
int embedding_prompt_tokens_used
int embedding_completion_tokens_used
int embedding_total_tokens_used
int interaction_prompt_tokens_used
int interaction_completion_tokens_used
int interaction_total_tokens_used
int license_period_id FK
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PAYMENT {
int id PK
int license_period_id FK
int tenant_id FK
enum payment_type
decimal amount
string currency
text description
enum status
string external_payment_id
string payment_method
jsonb provider_data
datetime paid_at
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
INVOICE {
int id PK
int license_period_id FK
int payment_id FK
int tenant_id FK
enum invoice_type
string invoice_number
date invoice_date
date due_date
decimal amount
string currency
decimal tax_amount
text description
enum status
datetime sent_at
datetime paid_at
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
LICENSE_CHANGE_LOG {
int id PK
int license_id FK
datetime changed_at
string field_name
string old_value
string new_value
text reason
int created_by FK
}
TENANT {
int id PK
string name
string currency
}
USER {
int id PK
string user_name
string email
}
PARTNER_SERVICE {
int id PK
string name
string type
}
%% Main business relationships
TENANT ||--o{ LICENSE : "has many"
LICENSE_TIER ||--o{ LICENSE : "has many"
LICENSE ||--o{ LICENSE_PERIOD : "has many"
LICENSE_PERIOD ||--|| LICENSE_USAGE : "has one"
LICENSE_PERIOD ||--o{ PAYMENT : "has many"
LICENSE_PERIOD ||--o{ INVOICE : "has many"
%% License management
LICENSE ||--o{ LICENSE_CHANGE_LOG : "has many"
%% Payment-Invoice relationship
PAYMENT ||--o| INVOICE : "can have"
%% Partner service licensing
PARTNER_SERVICE ||--o{ PARTNER_SERVICE_LICENSE_TIER : "has many"
LICENSE_TIER ||--o{ PARTNER_SERVICE_LICENSE_TIER : "has many"
%% Event logging
LICENSE_USAGE ||--o{ BUSINESS_EVENT_LOG : "has many"
%% Tenant relationships
TENANT ||--o{ LICENSE_PERIOD : "has many"
TENANT ||--o{ LICENSE_USAGE : "has many"
TENANT ||--o{ PAYMENT : "has many"
TENANT ||--o{ INVOICE : "has many"

View File

@@ -0,0 +1,211 @@
erDiagram
CHAT_SESSION {
int id PK
int user_id FK
string session_id
datetime session_start
datetime session_end
string timezone
}
SPECIALIST {
int id PK
string name
text description
string type
string type_version
boolean tuning
jsonb configuration
jsonb arguments
boolean active
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
EVE_AI_ASSET {
int id PK
string name
text description
string type
string type_version
string bucket_name
string object_name
string file_type
float file_size
jsonb user_metadata
jsonb system_metadata
jsonb configuration
int prompt_tokens
int completion_tokens
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
datetime last_used_at
}
EVE_AI_AGENT {
int id PK
int specialist_id FK
string name
text description
string type
string type_version
text role
text goal
text backstory
boolean tuning
jsonb configuration
jsonb arguments
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
EVE_AI_TASK {
int id PK
int specialist_id FK
string name
text description
string type
string type_version
text task_description
text expected_output
boolean tuning
jsonb configuration
jsonb arguments
jsonb context
boolean asynchronous
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
EVE_AI_TOOL {
int id PK
int specialist_id FK
string name
text description
string type
string type_version
boolean tuning
jsonb configuration
jsonb arguments
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
DISPATCHER {
int id PK
string name
text description
string type
string type_version
boolean tuning
jsonb configuration
jsonb arguments
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
INTERACTION {
int id PK
int chat_session_id FK
int specialist_id FK
jsonb specialist_arguments
jsonb specialist_results
string timezone
int appreciation
datetime question_at
datetime detailed_question_at
datetime answer_at
string processing_error
}
INTERACTION_EMBEDDING {
int interaction_id PK,FK
int embedding_id PK,FK
}
SPECIALIST_RETRIEVER {
int specialist_id PK,FK
int retriever_id PK,FK
}
SPECIALIST_DISPATCHER {
int specialist_id PK,FK
int dispatcher_id PK,FK
}
SPECIALIST_MAGIC_LINK {
int id PK
string name
text description
int specialist_id FK
int tenant_make_id FK
string magic_link_code
datetime valid_from
datetime valid_to
jsonb specialist_args
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
USER {
int id PK
string user_name
string email
}
TENANT_MAKE {
int id PK
string name
text description
}
RETRIEVER {
int id PK
string name
text description
}
EMBEDDING {
int id PK
string type
text chunk
}
%% Main conversation flow
USER ||--o{ CHAT_SESSION : "has many"
CHAT_SESSION ||--o{ INTERACTION : "has many"
SPECIALIST ||--o{ INTERACTION : "processes"
%% Specialist composition (EveAI components)
SPECIALIST ||--o{ EVE_AI_AGENT : "has many"
SPECIALIST ||--o{ EVE_AI_TASK : "has many"
SPECIALIST ||--o{ EVE_AI_TOOL : "has many"
%% Specialist connections
SPECIALIST ||--o{ SPECIALIST_RETRIEVER : "uses retrievers"
RETRIEVER ||--o{ SPECIALIST_RETRIEVER : "used by specialists"
SPECIALIST ||--o{ SPECIALIST_DISPATCHER : "uses dispatchers"
DISPATCHER ||--o{ SPECIALIST_DISPATCHER : "used by specialists"
%% Interaction results
INTERACTION ||--o{ INTERACTION_EMBEDDING : "references embeddings"
EMBEDDING ||--o{ INTERACTION_EMBEDDING : "used in interactions"
%% Magic links for specialist access
SPECIALIST ||--o{ SPECIALIST_MAGIC_LINK : "has magic links"
TENANT_MAKE ||--o{ SPECIALIST_MAGIC_LINK : "branded links"

View File

@@ -0,0 +1,199 @@
erDiagram
TENANT {
int id PK
string code
string name
string website
string timezone
string type
string currency
boolean storage_dirty
int default_tenant_make_id FK
datetime created_at
datetime updated_at
}
USER {
int id PK
int tenant_id FK
string user_name
string email
string password
string first_name
string last_name
boolean active
string fs_uniquifier
datetime confirmed_at
date valid_to
boolean is_primary_contact
boolean is_financial_contact
datetime last_login_at
datetime current_login_at
string last_login_ip
string current_login_ip
int login_count
datetime created_at
datetime updated_at
}
ROLE {
int id PK
string name
string description
}
ROLES_USERS {
int user_id PK,FK
int role_id PK,FK
}
TENANT_DOMAIN {
int id PK
int tenant_id FK
string domain
date valid_to
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
TENANT_PROJECT {
int id PK
int tenant_id FK
string name
text description
array services
string encrypted_api_key
string visual_api_key
boolean active
string responsible_email
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
TENANT_MAKE {
int id PK
int tenant_id FK
string name
text description
boolean active
string website
string logo_url
string default_language
array allowed_languages
jsonb chat_customisation_options
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PARTNER {
int id PK
int tenant_id FK
string code
string logo_url
boolean active
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PARTNER_SERVICE {
int id PK
int partner_id FK
string name
text description
string type
string type_version
boolean active
json configuration
json permissions
json system_metadata
json user_metadata
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PARTNER_TENANT {
int partner_service_id PK,FK
int tenant_id PK,FK
json configuration
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
}
PARTNER_SERVICE_LICENSE_TIER {
int id PK
int partner_service_id FK
}
SPECIALIST_MAGIC_LINK_TENANT {
string magic_link_code PK
int tenant_id FK
}
TRANSLATION_CACHE {
string cache_key PK
text source_text
text translated_text
string source_language
string target_language
text context
int prompt_tokens
int completion_tokens
datetime created_at
int created_by FK
datetime updated_at
int updated_by FK
datetime last_used_at
}
PARTNER_RAG_RETRIEVER {
int partner_id FK
int tenant_id PK,FK
int retriever_id PK
}
LICENSE {
int id PK
int tenant_id FK
date start_date
date end_date
}
LICENSE_USAGE {
int id PK
int tenant_id FK
}
%% Relationships
TENANT ||--o{ USER : "has many"
TENANT ||--o{ TENANT_DOMAIN : "has many"
TENANT ||--o{ TENANT_PROJECT : "has many"
TENANT ||--o{ TENANT_MAKE : "has many"
TENANT ||--o| TENANT_MAKE : "default_tenant_make"
TENANT ||--o| PARTNER : "has one"
TENANT ||--o{ LICENSE : "has many"
TENANT ||--o{ LICENSE_USAGE : "has many"
TENANT ||--o{ SPECIALIST_MAGIC_LINK_TENANT : "has many"
TENANT ||--o{ PARTNER_TENANT : "has many"
TENANT ||--o{ PARTNER_RAG_RETRIEVER : "has many"
USER ||--o{ ROLES_USERS : "has many"
ROLE ||--o{ ROLES_USERS : "has many"
PARTNER ||--o{ PARTNER_SERVICE : "has many"
PARTNER ||--o{ PARTNER_RAG_RETRIEVER : "has many"
PARTNER_SERVICE ||--o{ PARTNER_TENANT : "has many"
PARTNER_SERVICE ||--o{ PARTNER_SERVICE_LICENSE_TIER : "has many"