MCPcopy Create free account
hub / github.com/1Panel-dev/MaxKB / list

Method list

apps/knowledge/serializers/paragraph.py:116–130  ·  view source on GitHub ↗

获取问题列表 :param with_valid: 是否校验 :return: 问题列表

(self, with_valid=False)

Source from the content-addressed store, hash-verified

114 raise AppApiException(500, _("Paragraph id does not exist"))
115
116 def list(self, with_valid=False):
117 """
118 获取问题列表
119 :param with_valid: 是否校验
120 :return: 问题列表
121 """
122 if with_valid:
123 self.is_valid(raise_exception=True)
124 problem_paragraph_mapping = QuerySet(ProblemParagraphMapping).filter(
125 knowledge_id=self.data.get("knowledge_id"), paragraph_id=self.data.get("paragraph_id")
126 )
127 return [
128 ProblemSerializer(row).data
129 for row in QuerySet(Problem).filter(id__in=[row.problem_id for row in problem_paragraph_mapping])
130 ]
131
132 @transaction.atomic
133 def save(self, instance: Dict, with_valid=True, with_embedding=True, embedding_by_problem=None):

Callers

nothing calls this directly

Calls 3

is_validMethod · 0.95
ProblemSerializerClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected