Phase 3: Memory & Growth - Multi-file fusion, Entity alignment with embedding, Document import, Knowledge base panel
This commit is contained in:
@@ -16,7 +16,9 @@ CREATE TABLE IF NOT EXISTS transcripts (
|
||||
project_id TEXT NOT NULL,
|
||||
filename TEXT,
|
||||
full_text TEXT,
|
||||
type TEXT DEFAULT 'audio', -- 'audio' 或 'document'
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (project_id) REFERENCES projects(id)
|
||||
);
|
||||
|
||||
@@ -29,6 +31,7 @@ CREATE TABLE IF NOT EXISTS entities (
|
||||
type TEXT,
|
||||
definition TEXT,
|
||||
aliases TEXT, -- JSON 数组:["别名1", "别名2"]
|
||||
embedding TEXT, -- JSON 数组:实体名称+定义的 embedding
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (project_id) REFERENCES projects(id)
|
||||
@@ -71,3 +74,12 @@ CREATE TABLE IF NOT EXISTS glossary (
|
||||
frequency INTEGER DEFAULT 1,
|
||||
FOREIGN KEY (project_id) REFERENCES projects(id)
|
||||
);
|
||||
|
||||
-- 创建索引以提高查询性能
|
||||
CREATE INDEX IF NOT EXISTS idx_entities_project ON entities(project_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_entities_name ON entities(name);
|
||||
CREATE INDEX IF NOT EXISTS idx_transcripts_project ON transcripts(project_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_mentions_entity ON entity_mentions(entity_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_mentions_transcript ON entity_mentions(transcript_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_relations_project ON entity_relations(project_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_glossary_project ON glossary(project_id);
|
||||
|
||||
Reference in New Issue
Block a user