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

Method edit

apps/knowledge/serializers/problem.py:183–194  ·  view source on GitHub ↗
(self, instance: Dict, with_valid=True)

Source from the content-addressed store, hash-verified

181
182 @transaction.atomic
183 def edit(self, instance: Dict, with_valid=True):
184 if with_valid:
185 self.is_valid(raise_exception=True)
186 problem_id = self.data.get('problem_id')
187 knowledge_id = self.data.get('knowledge_id')
188 content = instance.get('content')
189 problem = QuerySet(Problem).filter(id=problem_id, knowledge_id=knowledge_id).first()
190 QuerySet(Knowledge).filter(id=knowledge_id)
191 problem.content = content
192 problem.save()
193 model_id = get_embedding_model_id_by_knowledge_id(knowledge_id)
194 update_problem_embedding(problem_id, content, model_id)
195
196 class Create(serializers.Serializer):
197 workspace_id = serializers.CharField(required=True, label=_('workspace id'))

Callers

nothing calls this directly

Calls 5

is_validMethod · 0.95
update_problem_embeddingFunction · 0.90
getMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected