Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
userpj committed Jul 22, 2024
1 parent 71e9036 commit 8abe0c0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions appbuilder/core/console/knowledge_base/data_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class KnowledgeBaseGetDocumentsListRequest(BaseModel):


class DocumentMeta(BaseModel):
source: str = Field("", description="文档来源")
file_id: str = Field("", description="文档对应的文件ID")
source: str = Field(None, description="文档来源")
file_id: str = Field(None, description="文档对应的文件ID")


class Document(BaseModel):
Expand Down
30 changes: 18 additions & 12 deletions appbuilder/tests/test_knowledge_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,25 @@ def test_create_knowledge_base(self):
),
)

list_res = knowledge.get_documents_list()
document_id = list_res.data[-1].id
res = knowledge.describe_chunks(document_id)
knowledge.describe_chunk(res.data[0].id)
resp = knowledge.create_chunk(document_id, content="test")
chunk_id = resp.id
knowledge.modify_chunk(chunk_id, content="new test", enable=True)
knowledge.delete_chunk(chunk_id)
try:
list_res = knowledge.get_documents_list()
document_id = list_res.data[-1].id
res = knowledge.describe_chunks(document_id)
knowledge.describe_chunk(res.data[0].id)
resp = knowledge.create_chunk(document_id, content="test")
chunk_id = resp.id
knowledge.modify_chunk(chunk_id, content="new test", enable=True)
knowledge.delete_chunk(chunk_id)

knowledge.modify_knowledge_base(
knowledge_base_id=knowledge_base_id, name="test"
)
knowledge.delete_knowledge_base(knowledge_base_id)
except Exception as e:
print("错误为 {}".format(e))
finally:
knowledge.delete_knowledge_base(knowledge_base_id)

knowledge.modify_knowledge_base(
knowledge_base_id=knowledge_base_id, name="test"
)
knowledge.delete_knowledge_base(knowledge_base_id)
self.assertIsNotNone(knowledge_base_id)


Expand Down

0 comments on commit 8abe0c0

Please sign in to comment.