Skip to content

Commit

Permalink
fix: Solve the problem of invalid subgraph naming when creating tugra…
Browse files Browse the repository at this point in the history
…ph (#1731)
  • Loading branch information
A-Salty-Fish authored Jul 22, 2024
1 parent f889fa3 commit 84988b8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dbgpt/app/knowledge/service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import re
from datetime import datetime

from dbgpt._private.config import Config
Expand Down Expand Up @@ -79,6 +80,10 @@ def create_knowledge_space(self, request: KnowledgeSpaceRequest):
)
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")
Expand Down

0 comments on commit 84988b8

Please sign in to comment.