mirror of
https://github.com/mindverse/Second-Me.git
synced 2026-07-24 08:33:26 +00:00
* fix: modify thinking_model loading configuration * feat: realize thinkModel ui * feat:store * feat: add combined_llm_config_dto * add thinking_model_config & database migration * directly add thinking model to user_llm_config * delete thinking model repo dto service * delete thinkingmodel table migration * add is_cot config * feat: allow define is_cot * feat: simplify logs info * feat: add training model * feat: fix is_cot problem * fix: fix chat message * fix: fix progress error * fix: disable no settings thinking * feat: add thinking warning * fix: fix start service error * feat:fix init trainparams problem * feat: change playGround prompt * feat: Add Dimension Mismatch Handling for ChromaDB (#157) (#207) * Fix Issue #157 Add chroma_utils.py to manage chromaDB and added docs for explanation * Add logging and debugging process - Enhanced the`reinitialize_chroma_collections` function in`chroma_utils.py` to properly check if collections exist before attempting to delete them, preventing potential errors when collections don't exist. - Improved error handling in the`_handle_dimension_mismatch` method in`embedding_service.py` by adding more robust exception handling and verification steps after reinitialization. - Enhanced the collection initialization process in`embedding_service.py` to provide more detailed error messages and better handle cases where collections still have incorrect dimensions after reinitialization. - Added additional verification steps to ensure that collection dimensions match the expected dimension after creation or retrieval. - Improved logging throughout the code to provide more context in error messages, making debugging easier. * Change topics_generator timeout to 30 (#263) * quick fix * fix: shade -> shade_merge_info (#265) * fix: shade -> shade_merge_info * add convert array * quick fix import error * add log * add heartbeat * new strategy * sse version * add heartbeat * zh to en * optimize code * quick fix convert function * Feat/new branch management (#267) * feat: new branch management * feat: fix multi-upload * optimize contribute management --------- Co-authored-by: Crabboss Mr <1123357821@qq.com> Co-authored-by: Ye Xiangle <yexiangle@mail.mindverse.ai> Co-authored-by: Xinghan Pan <sampan090611@gmail.com> Co-authored-by: doubleBlack2 <108928143+doubleBlack2@users.noreply.github.com> Co-authored-by: kevin-mindverse <kevin@mindverse.ai> Co-authored-by: KKKKKKKevin <115385420+kevin-mindverse@users.noreply.github.com>
237 lines
No EOL
8.9 KiB
SQL
237 lines
No EOL
8.9 KiB
SQL
-- Document Table
|
|
CREATE TABLE IF NOT EXISTS document (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
name VARCHAR(255) NOT NULL DEFAULT '',
|
|
title VARCHAR(511) NOT NULL DEFAULT '',
|
|
extract_status TEXT CHECK(extract_status IN ('INITIALIZED', 'SUCCESS', 'FAILED')) NOT NULL DEFAULT 'INITIALIZED',
|
|
embedding_status TEXT CHECK(embedding_status IN ('INITIALIZED', 'SUCCESS', 'FAILED')) NOT NULL DEFAULT 'INITIALIZED',
|
|
analyze_status TEXT CHECK(analyze_status IN ('INITIALIZED', 'SUCCESS', 'FAILED')) NOT NULL DEFAULT 'INITIALIZED',
|
|
mime_type VARCHAR(50) NOT NULL DEFAULT '',
|
|
raw_content TEXT DEFAULT NULL,
|
|
user_description VARCHAR(255) NOT NULL DEFAULT '',
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
url VARCHAR(1023) NOT NULL DEFAULT '',
|
|
document_size INTEGER NOT NULL DEFAULT 0,
|
|
insight TEXT DEFAULT NULL, -- JSON data stored as TEXT
|
|
summary TEXT DEFAULT NULL, -- JSON data stored as TEXT
|
|
keywords TEXT DEFAULT NULL
|
|
);
|
|
|
|
-- Document table indexes
|
|
CREATE INDEX IF NOT EXISTS idx_extract_status ON document(extract_status);
|
|
CREATE INDEX IF NOT EXISTS idx_name ON document(name);
|
|
CREATE INDEX IF NOT EXISTS idx_create_time ON document(create_time);
|
|
|
|
-- Chunk Table
|
|
CREATE TABLE IF NOT EXISTS chunk (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
document_id INTEGER NOT NULL,
|
|
content TEXT NOT NULL,
|
|
has_embedding BOOLEAN NOT NULL DEFAULT 0,
|
|
tags TEXT DEFAULT NULL, -- JSON data stored as TEXT
|
|
topic VARCHAR(255) DEFAULT NULL,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (document_id) REFERENCES document(id)
|
|
);
|
|
|
|
-- Chunk table indexes
|
|
CREATE INDEX IF NOT EXISTS idx_document_id ON chunk(document_id);
|
|
CREATE INDEX IF NOT EXISTS idx_has_embedding ON chunk(has_embedding);
|
|
|
|
-- L1 Version Table
|
|
CREATE TABLE IF NOT EXISTS l1_versions (
|
|
version INTEGER PRIMARY KEY,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
status VARCHAR(50) NOT NULL,
|
|
description VARCHAR(500)
|
|
);
|
|
|
|
-- L1 Bio Table
|
|
CREATE TABLE IF NOT EXISTS l1_bios (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
version INTEGER NOT NULL,
|
|
content TEXT,
|
|
content_third_view TEXT,
|
|
summary TEXT,
|
|
summary_third_view TEXT,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (version) REFERENCES l1_versions(version)
|
|
);
|
|
|
|
-- L1 Shade Table
|
|
CREATE TABLE IF NOT EXISTS l1_shades (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
version INTEGER NOT NULL,
|
|
name VARCHAR(200),
|
|
aspect VARCHAR(200),
|
|
icon VARCHAR(100),
|
|
desc_third_view TEXT,
|
|
content_third_view TEXT,
|
|
desc_second_view TEXT,
|
|
content_second_view TEXT,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (version) REFERENCES l1_versions(version)
|
|
);
|
|
|
|
-- L1 Cluster Table
|
|
CREATE TABLE IF NOT EXISTS l1_clusters (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
version INTEGER NOT NULL,
|
|
cluster_id VARCHAR(100),
|
|
memory_ids TEXT, -- JSON data stored as TEXT
|
|
cluster_center TEXT, -- JSON data stored as TEXT
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (version) REFERENCES l1_versions(version)
|
|
);
|
|
|
|
-- L1 Chunk Topic Table
|
|
CREATE TABLE IF NOT EXISTS l1_chunk_topics (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
version INTEGER NOT NULL,
|
|
chunk_id VARCHAR(100),
|
|
topic TEXT,
|
|
tags TEXT, -- JSON data stored as TEXT
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
FOREIGN KEY (version) REFERENCES l1_versions(version)
|
|
);
|
|
|
|
-- Status Biography Table
|
|
CREATE TABLE IF NOT EXISTS status_biography (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
content TEXT NOT NULL,
|
|
content_third_view TEXT NOT NULL,
|
|
summary TEXT NOT NULL,
|
|
summary_third_view TEXT NOT NULL,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Personal Load Table
|
|
CREATE TABLE IF NOT EXISTS loads (
|
|
id VARCHAR(36) PRIMARY KEY, -- UUID
|
|
name VARCHAR(255) NOT NULL, -- load name
|
|
description TEXT, -- load description
|
|
email VARCHAR(255) NOT NULL DEFAULT '', -- load email
|
|
avatar_data TEXT, -- load avatar base64 encoded data
|
|
instance_id VARCHAR(255), -- upload instance ID
|
|
instance_password VARCHAR(255), -- upload instance password
|
|
status TEXT CHECK(status IN ('active', 'inactive', 'deleted')) DEFAULT 'active',
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_loads_status ON loads(status);
|
|
CREATE INDEX IF NOT EXISTS idx_loads_created_at ON loads(created_at);
|
|
|
|
-- Memory Files Table
|
|
CREATE TABLE IF NOT EXISTS memories (
|
|
id VARCHAR(36) NOT NULL,
|
|
name VARCHAR(255) NOT NULL,
|
|
size INTEGER NOT NULL,
|
|
type VARCHAR(50) NOT NULL,
|
|
path VARCHAR(1024) NOT NULL,
|
|
meta_data TEXT, -- JSON data stored as TEXT
|
|
document_id VARCHAR(36),
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
status TEXT CHECK(status IN ('active', 'deleted')) NOT NULL DEFAULT 'active',
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_memories_document_id ON memories(document_id);
|
|
CREATE INDEX IF NOT EXISTS idx_memories_created_at ON memories(created_at);
|
|
CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(type);
|
|
CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status);
|
|
|
|
-- Roles Table
|
|
CREATE TABLE IF NOT EXISTS roles (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
uuid VARCHAR(64) NOT NULL UNIQUE,
|
|
name VARCHAR(100) NOT NULL UNIQUE,
|
|
description VARCHAR(500),
|
|
system_prompt TEXT NOT NULL,
|
|
icon VARCHAR(100),
|
|
is_active BOOLEAN NOT NULL DEFAULT 1,
|
|
enable_l0_retrieval BOOLEAN NOT NULL DEFAULT 1,
|
|
enable_l1_retrieval BOOLEAN NOT NULL DEFAULT 1,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_roles_name ON roles(name);
|
|
CREATE INDEX IF NOT EXISTS idx_roles_uuid ON roles(uuid);
|
|
CREATE INDEX IF NOT EXISTS idx_roles_is_active ON roles(is_active);
|
|
|
|
-- Insert predefined Roles (only if they don't exist)
|
|
INSERT OR IGNORE INTO roles (uuid, name, description, system_prompt, icon) VALUES
|
|
('role_interviewer_8f3a1c2e4b5d6f7a9e0b1d2c3f4e5d6b',
|
|
'Interviewer (a test case)',
|
|
'Professional interviewer who asks insightful questions to learn about people',
|
|
|
|
'You are a professional interviewer with expertise in asking insightful questions to understand people deeply, and you are facing the interviewee, and you dont know his/her background. Your responsibilities include:\n1. Asking thoughtful, open-ended questions\n2. Following up on interesting points\n3. sharing what you know to attract the interviewee.',
|
|
'interview-icon');
|
|
|
|
-- User LLM Configuration Table
|
|
CREATE TABLE IF NOT EXISTS user_llm_configs (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
provider_type VARCHAR(50) NOT NULL DEFAULT 'openai',
|
|
key VARCHAR(200),
|
|
|
|
-- Chat configuration
|
|
chat_endpoint VARCHAR(200),
|
|
chat_api_key VARCHAR(200),
|
|
chat_model_name VARCHAR(200),
|
|
|
|
-- Embedding configuration
|
|
embedding_endpoint VARCHAR(200),
|
|
embedding_api_key VARCHAR(200),
|
|
embedding_model_name VARCHAR(200),
|
|
|
|
-- Thinking configuration
|
|
thinking_model_name VARCHAR(200),
|
|
thinking_endpoint VARCHAR(200),
|
|
thinking_api_key VARCHAR(200),
|
|
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
|
|
-- User LLM Configuration table indexes
|
|
CREATE INDEX IF NOT EXISTS idx_user_llm_configs_created_at ON user_llm_configs(created_at);
|
|
|
|
-- Spaces Table
|
|
CREATE TABLE IF NOT EXISTS spaces (
|
|
id VARCHAR(255) PRIMARY KEY,
|
|
title VARCHAR(255) NOT NULL,
|
|
objective TEXT NOT NULL,
|
|
participants TEXT NOT NULL, -- JSON array stored as TEXT
|
|
host VARCHAR(255) NOT NULL,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
status INTEGER DEFAULT 1,
|
|
conclusion TEXT,
|
|
space_share_id VARCHAR(255)
|
|
);
|
|
|
|
-- Space Messages Table
|
|
CREATE TABLE IF NOT EXISTS space_messages (
|
|
id VARCHAR(255) PRIMARY KEY,
|
|
space_id VARCHAR(255) NOT NULL,
|
|
sender_endpoint VARCHAR(255) NOT NULL,
|
|
content TEXT NOT NULL,
|
|
message_type VARCHAR(50) NOT NULL,
|
|
round INTEGER DEFAULT 0,
|
|
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
role VARCHAR(50) DEFAULT 'participant',
|
|
FOREIGN KEY (space_id) REFERENCES spaces(id)
|
|
);
|
|
|
|
-- Space Messages Table Indexes
|
|
CREATE INDEX IF NOT EXISTS idx_space_messages_space_id ON space_messages(space_id);
|
|
CREATE INDEX IF NOT EXISTS idx_space_messages_round ON space_messages(round);
|
|
CREATE INDEX IF NOT EXISTS idx_space_messages_create_time ON space_messages(create_time);
|
|
|
|
-- Space Table Indexes
|
|
CREATE INDEX IF NOT EXISTS idx_spaces_create_time ON spaces(create_time);
|
|
CREATE INDEX IF NOT EXISTS idx_spaces_status ON spaces(status); |