mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-09-21 13:52:09 +08:00
feat: Integrate Neo4j driver into SystemHandler for enhanced graph database support
- Updated SystemHandler to include a Neo4j driver, allowing for improved interaction with graph databases. - Modified NewSystemHandler to accept the Neo4j driver as a parameter. - Adjusted getGraphDatabaseEngine method to return the appropriate engine name based on Neo4j driver availability.
This commit is contained in:
@@ -7,17 +7,20 @@ import (
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/neo4j/neo4j-go-driver/v6/neo4j"
|
||||
)
|
||||
|
||||
// SystemHandler handles system-related requests
|
||||
type SystemHandler struct {
|
||||
cfg *config.Config
|
||||
cfg *config.Config
|
||||
neo4jDriver neo4j.Driver
|
||||
}
|
||||
|
||||
// NewSystemHandler creates a new system handler
|
||||
func NewSystemHandler(cfg *config.Config) *SystemHandler {
|
||||
func NewSystemHandler(cfg *config.Config, neo4jDriver neo4j.Driver) *SystemHandler {
|
||||
return &SystemHandler{
|
||||
cfg: cfg,
|
||||
cfg: cfg,
|
||||
neo4jDriver: neo4jDriver,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,11 +133,10 @@ func (h *SystemHandler) getVectorStoreEngine() string {
|
||||
|
||||
// getGraphDatabaseEngine returns the graph database engine name
|
||||
func (h *SystemHandler) getGraphDatabaseEngine() string {
|
||||
neo4jEnable := strings.ToLower(os.Getenv("NEO4J_ENABLE"))
|
||||
if neo4jEnable == "true" {
|
||||
return "Neo4j"
|
||||
if h.neo4jDriver == nil {
|
||||
return "未启用"
|
||||
}
|
||||
return "未启用"
|
||||
return "Neo4j"
|
||||
}
|
||||
|
||||
// isMinioEnabled checks if MinIO is enabled
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
-- 000011_remove_kb_rerank_model.down.sql
|
||||
-- Reintroduce rerank_model_id column to knowledge_bases table
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE knowledge_bases
|
||||
ADD COLUMN IF NOT EXISTS rerank_model_id VARCHAR(64);
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
-- 000011_remove_kb_rerank_model.up.sql
|
||||
-- Remove rerank_model_id column from knowledge_bases table
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE knowledge_bases
|
||||
DROP COLUMN IF EXISTS rerank_model_id;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user