Skip to content

Commit

Permalink
fix(ChatKnowledge): Fix knowledge command load bug (#1767)
Browse files Browse the repository at this point in the history
Co-authored-by: huangjh131 <[email protected]>
Co-authored-by: Fangyin Cheng <[email protected]>
  • Loading branch information
3 people authored Aug 1, 2024
1 parent 25d7d94 commit 7ea9b8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dbgpt/app/knowledge/_cli/knowledge_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def knowledge_init(
logger.info(f"Create space: {space}")
client.space_add(space)
logger.info("Create space successfully")
space_list = client.space_list(KnowledgeSpaceRequest(name=space.name))
space_list = client.space_list(space)
if len(space_list) != 1:
raise Exception(f"List space {space.name} error")
space = KnowledgeSpaceRequest(**space_list[0])
Expand All @@ -146,7 +146,10 @@ def upload(filename: str):
f"Document {filename} already exist in space {space.name}, overwrite it"
)
client.document_delete(
space.name, KnowledgeDocumentRequest(doc_name=filename)
space.name,
KnowledgeDocumentRequest(
doc_name=filename, doc_type=KnowledgeType.DOCUMENT.value
),
)
doc_id = client.document_upload(
space.name, filename, KnowledgeType.DOCUMENT.value, filename
Expand Down
4 changes: 2 additions & 2 deletions dbgpt/app/knowledge/request/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class KnowledgeSpaceRequest(BaseModel):
"""name: knowledge space name"""

"""vector_type: vector type"""
id: int = None
id: Optional[int] = None
name: str = None
"""vector_type: vector type"""
vector_type: str = None
"""vector_type: vector type"""
domain_type: str = "normal"
domain_type: str = "Normal"
"""desc: description"""
desc: str = None
"""owner: owner"""
Expand Down
2 changes: 1 addition & 1 deletion dbgpt/serve/rag/service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ async def _sync_knowledge_document(
)
knowledge = None
if not space.domain_type or (
space.domain_type == BusinessFieldType.NORMAL.value
space.domain_type.lower() == BusinessFieldType.NORMAL.value.lower()
):
knowledge = KnowledgeFactory.create(
datasource=doc.content,
Expand Down

0 comments on commit 7ea9b8c

Please sign in to comment.