chore: 添加虚拟环境到仓库
- 添加 backend_service/venv 虚拟环境 - 包含所有Python依赖包 - 注意:虚拟环境约393MB,包含12655个文件
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
CREATE TABLE embeddings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
segment_id TEXT NOT NULL,
|
||||
embedding_id TEXT NOT NULL,
|
||||
seq_id BLOB NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE (segment_id, embedding_id)
|
||||
);
|
||||
|
||||
CREATE TABLE embedding_metadata (
|
||||
id INTEGER REFERENCES embeddings(id),
|
||||
key TEXT NOT NULL,
|
||||
string_value TEXT,
|
||||
int_value INTEGER,
|
||||
float_value REAL,
|
||||
PRIMARY KEY (id, key)
|
||||
);
|
||||
|
||||
CREATE TABLE max_seq_id (
|
||||
segment_id TEXT PRIMARY KEY,
|
||||
seq_id BLOB NOT NULL
|
||||
);
|
||||
|
||||
CREATE VIRTUAL TABLE embedding_fulltext USING fts5(id, string_value);
|
||||
@@ -0,0 +1,5 @@
|
||||
-- SQLite does not support adding check with alter table, as a result, adding a check
|
||||
-- involve creating a new table and copying the data over. It is over kill with adding
|
||||
-- a boolean type column. The application write to the table needs to ensure the data
|
||||
-- integrity.
|
||||
ALTER TABLE embedding_metadata ADD COLUMN bool_value INTEGER
|
||||
@@ -0,0 +1,3 @@
|
||||
CREATE VIRTUAL TABLE embedding_fulltext_search USING fts5(string_value, tokenize='trigram');
|
||||
INSERT INTO embedding_fulltext_search (rowid, string_value) SELECT rowid, string_value FROM embedding_metadata;
|
||||
DROP TABLE embedding_fulltext;
|
||||
@@ -0,0 +1,3 @@
|
||||
CREATE INDEX IF NOT EXISTS embedding_metadata_int_value ON embedding_metadata (key, int_value) WHERE int_value IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS embedding_metadata_float_value ON embedding_metadata (key, float_value) WHERE float_value IS NOT NULL;
|
||||
CREATE INDEX IF NOT EXISTS embedding_metadata_string_value ON embedding_metadata (key, string_value) WHERE string_value IS NOT NULL;
|
||||
@@ -0,0 +1,27 @@
|
||||
ALTER TABLE max_seq_id ADD COLUMN int_seq_id INTEGER;
|
||||
|
||||
-- Convert 8 byte wide big-endian integer as blob to native 64 bit integer.
|
||||
-- Adapted from https://stackoverflow.com/a/70296198.
|
||||
UPDATE max_seq_id SET int_seq_id = (
|
||||
SELECT (
|
||||
(instr('123456789ABCDEF', substr(hex(seq_id), -1 , 1)) << 0)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -2 , 1)) << 4)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -3 , 1)) << 8)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -4 , 1)) << 12)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -5 , 1)) << 16)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -6 , 1)) << 20)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -7 , 1)) << 24)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -8 , 1)) << 28)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -9 , 1)) << 32)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -10, 1)) << 36)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -11, 1)) << 40)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -12, 1)) << 44)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -13, 1)) << 48)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -14, 1)) << 52)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -15, 1)) << 56)
|
||||
| (instr('123456789ABCDEF', substr(hex(seq_id), -16, 1)) << 60)
|
||||
)
|
||||
);
|
||||
|
||||
ALTER TABLE max_seq_id DROP COLUMN seq_id;
|
||||
ALTER TABLE max_seq_id RENAME COLUMN int_seq_id TO seq_id;
|
||||
Reference in New Issue
Block a user