Skip to content

Commit 9ac9c9b

Browse files
authored
feat: 增加在应用里通过日志绑定问题的时候,问题可以修改 #292 (#527)
1 parent 948700f commit 9ac9c9b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

apps/application/serializers/chat_serializers.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ class ImproveSerializer(serializers.Serializer):
426426
error_messages=ErrMessage.char("段落标题"))
427427
content = serializers.CharField(required=True, error_messages=ErrMessage.char("段落内容"))
428428

429+
problem_text = serializers.CharField(required=False, allow_null=True, allow_blank=True,
430+
error_messages=ErrMessage.char("问题"))
431+
429432
class ParagraphModel(serializers.ModelSerializer):
430433
class Meta:
431434
model = Paragraph
@@ -496,8 +499,9 @@ def improve(self, instance: Dict, with_valid=True):
496499
content=instance.get("content"),
497500
dataset_id=dataset_id,
498501
title=instance.get("title") if 'title' in instance else '')
499-
500-
problem = Problem(id=uuid.uuid1(), content=chat_record.problem_text, dataset_id=dataset_id)
502+
problem_text = instance.get('problem_text') if instance.get(
503+
'problem_text') is not None else chat_record.problem_text
504+
problem = Problem(id=uuid.uuid1(), content=problem_text, dataset_id=dataset_id)
501505
problem_paragraph_mapping = ProblemParagraphMapping(id=uuid.uuid1(), dataset_id=dataset_id,
502506
document_id=document_id,
503507
problem_id=problem.id,

ui/src/views/log/component/EditContentDialog.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@submit.prevent
1010
>
1111
<el-form-item label="关联问题">
12-
<span>{{ form.problem_text }}</span>
12+
<el-input v-model="form.problem_text" placeholder="关联问题"> </el-input>
1313
</el-form-item>
1414
<el-form-item label="内容" prop="content">
1515
<el-input
@@ -172,7 +172,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
172172
if (valid) {
173173
const obj = {
174174
title: form.value.title,
175-
content: form.value.content
175+
content: form.value.content,
176+
problem_text: form.value.problem_text
176177
}
177178
logApi
178179
.putChatRecordLog(

0 commit comments

Comments
 (0)