feat(knowledge): 任务队列、独立 worker 与 pgvector 向量索引
知识处理改为数据库任务队列,独立 worker 做切块与向量化,失败可重试。
This commit is contained in:
1 parent
7937de5d7d
commit
c7011040c3
36 files changed
+7590
No files matched your search
@@ -0,0 +1,19 @@
|
||||
-- Enable the vector extension
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
|
||||
-- Create the ai schema if it doesn't exist
|
||||
CREATE SCHEMA IF NOT EXISTS ai;
|
||||
|
||||
-- Set up vector similarity search functions
|
||||
CREATE OR REPLACE FUNCTION vector_similarity(vector1 vector, vector2 vector)
|
||||
RETURNS float
|
||||
AS $$
|
||||
BEGIN
|
||||
RETURN 1 - (vector1 <=> vector2);
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- Ensure proper permissions
|
||||
GRANT USAGE ON SCHEMA ai TO postgres;
|
||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA ai TO postgres;
|
||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA ai TO postgres;
|
||||
Reference in new issue
Block a user