This commit is contained in:
aries_ckt
2025-10-12 23:05:11 +08:00
parent 3b5de05f16
commit 5d84533144
2 changed files with 21 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
"""Module for Knowledge Base."""
import re
from abc import ABC, abstractmethod
from enum import Enum
@@ -215,6 +216,6 @@ class Knowledge(ABC):
def parse_document_body(body: str) -> str:
result = re.sub(r'<a name="(.*)"></a>', "", body)
result = re.sub(r"<br\s*/?>", "", result)
soup = BeautifulSoup(result, 'html.parser')
soup = BeautifulSoup(result, "html.parser")
result = soup.get_text()
return result

View File

@@ -48,30 +48,37 @@ class StorageManager(BaseComponent):
if not storage_config.graph:
raise ValueError(
"Graph storage is not configured. To use Knowledge Graph:\n"
"1. Make sure TuGraph database is running (docker run -d -p 7687:7687 --name tugraph_demo tugraph/tugraph-runtime-centos7:latest)\n"
"1. Make sure TuGraph database is running "
"(docker run -d -p 7687:7687 --name tugraph_demo "
"tugraph/tugraph-runtime-centos7:latest)\n"
"2. Start the webserver with graph storage config:\n"
" python dbgpt_server.py --config configs/dbgpt-graphrag.toml\n"
"3. Or add [rag.storage.graph] section to your current config file:\n"
"3. Or add [rag.storage.graph] section to your current config "
"file:\n"
" [rag.storage.graph]\n"
" type = \"TuGraph\"\n"
" host = \"127.0.0.1\"\n"
' type = "TuGraph"\n'
' host = "127.0.0.1"\n'
" port = 7687\n"
" username = \"admin\"\n"
" password = \"73@TuGraph\"\n"
"See docs/docs/installation/integrations/graph_rag_install.md for details."
' username = "admin"\n'
' password = "73@TuGraph"\n'
"See docs/docs/installation/integrations/graph_rag_install.md "
"for details."
)
return self.create_kg_store(index_name, llm_model)
elif storage_type == "FullText":
if not storage_config.full_text:
raise ValueError(
"FullText storage is not configured. To use Full-Text Search (BM25):\n"
"1. Make sure Elasticsearch is running (docker run -d -p 9200:9200 -e \"discovery.type=single-node\" elasticsearch:8.7.0)\n"
"FullText storage is not configured. To use Full-Text "
"Search (BM25):\n"
"1. Make sure Elasticsearch is running (docker run -d -p "
'9200:9200 -e "discovery.type=single-node" elasticsearch:8.7.0)\n'
"2. Start the webserver with full-text config:\n"
" python dbgpt_server.py --config configs/dbgpt-bm25-rag.toml\n"
"3. Or add [rag.storage.full_text] section to your current config file:\n"
"3. Or add [rag.storage.full_text] section to your current "
"config file:\n"
" [rag.storage.full_text]\n"
" type = \"elasticsearch\"\n"
" host = \"127.0.0.1\"\n"
' type = "elasticsearch"\n'
' host = "127.0.0.1"\n'
" port = 9200\n"
"See documentation for details."
)