feat: 增加在应用里通过日志绑定问题的时候,问题可以修改 #292 (#527)

This commit is contained in:
shaohuzhang1 2024-05-24 11:22:50 +08:00 committed by GitHub
parent 948700fbc0
commit 9ac9c9b64a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -426,6 +426,9 @@ class ChatRecordSerializer(serializers.Serializer):
error_messages=ErrMessage.char("段落标题"))
content = serializers.CharField(required=True, error_messages=ErrMessage.char("段落内容"))
problem_text = serializers.CharField(required=False, allow_null=True, allow_blank=True,
error_messages=ErrMessage.char("问题"))
class ParagraphModel(serializers.ModelSerializer):
class Meta:
model = Paragraph
@ -496,8 +499,9 @@ class ChatRecordSerializer(serializers.Serializer):
content=instance.get("content"),
dataset_id=dataset_id,
title=instance.get("title") if 'title' in instance else '')
problem = Problem(id=uuid.uuid1(), content=chat_record.problem_text, dataset_id=dataset_id)
problem_text = instance.get('problem_text') if instance.get(
'problem_text') is not None else chat_record.problem_text
problem = Problem(id=uuid.uuid1(), content=problem_text, dataset_id=dataset_id)
problem_paragraph_mapping = ProblemParagraphMapping(id=uuid.uuid1(), dataset_id=dataset_id,
document_id=document_id,
problem_id=problem.id,

View File

@ -9,7 +9,7 @@
@submit.prevent
>
<el-form-item label="关联问题">
<span>{{ form.problem_text }}</span>
<el-input v-model="form.problem_text" placeholder="关联问题"> </el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input
@ -172,7 +172,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (valid) {
const obj = {
title: form.value.title,
content: form.value.content
content: form.value.content,
problem_text: form.value.problem_text
}
logApi
.putChatRecordLog(