MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / one

Method one

apps/knowledge/serializers/document.py:766–776  ·  view source on GitHub ↗
(self, with_valid=False)

Source from the content-addressed store, hash-verified

764 return FileSerializer.Operate(data={"id": file.id}).get(with_valid=True)
765
766 def one(self, with_valid=False):
767 self.is_valid(raise_exception=True)
768 query_set = QuerySet(model=Document)
769 query_set = query_set.filter(**{"id": self.data.get("document_id")})
770 return native_search(
771 {"document_custom_sql": query_set, "order_by_query": QuerySet(Document).order_by("-create_time", "id")},
772 select_string=get_file_content(
773 os.path.join(PROJECT_DIR, "apps", "knowledge", "sql", "list_document.sql")
774 ),
775 with_search_one=True,
776 )
777
778 def edit(self, instance: Dict, with_valid=False):
779 if with_valid:

Callers 2

editMethod · 0.95
saveMethod · 0.45

Calls 4

is_validMethod · 0.95
native_searchFunction · 0.90
get_file_contentFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected