mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-01 00:03:29 +00:00
fix: Solve the problem of invalid subgraph naming when creating tugraph (#1731)
This commit is contained in:
parent
f889fa3775
commit
84988b89fe
@ -1,5 +1,6 @@
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
from dbgpt._private.config import Config
|
||||
@ -79,6 +80,10 @@ class KnowledgeService:
|
||||
)
|
||||
if request.vector_type == "VectorStore":
|
||||
request.vector_type = CFG.VECTOR_STORE_TYPE
|
||||
if request.vector_type == "KnowledgeGraph":
|
||||
knowledge_space_name_pattern = r"^[a-zA-Z0-9\u4e00-\u9fa5]+$"
|
||||
if not re.match(knowledge_space_name_pattern, request.name):
|
||||
raise Exception(f"space name:{request.name} invalid")
|
||||
spaces = knowledge_space_dao.get_knowledge_space(query)
|
||||
if len(spaces) > 0:
|
||||
raise Exception(f"space name:{request.name} have already named")
|
||||
|
Loading…
Reference in New Issue
Block a user