Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ChatKnowledge): Fix knowledge command load bug #1767

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading