fix: AI conversation file upload image cannot be loaded (#3512)
This commit is contained in:
parent
0bd648578e
commit
31147c0f6e
@ -155,21 +155,18 @@ class ApplicationChatRecordQuerySerializers(serializers.Serializer):
|
|||||||
'padding_problem_text': chat_record.details.get('problem_padding').get(
|
'padding_problem_text': chat_record.details.get('problem_padding').get(
|
||||||
'padding_problem_text') if 'problem_padding' in chat_record.details else None,
|
'padding_problem_text') if 'problem_padding' in chat_record.details else None,
|
||||||
**(show_source_dict if show_source else {}),
|
**(show_source_dict if show_source else {}),
|
||||||
**(show_exec_dict if show_exec else {})
|
**(show_exec_dict if show_exec else show_exec_dict)
|
||||||
}
|
}
|
||||||
|
|
||||||
def page(self, current_page: int, page_size: int, with_valid=True):
|
def page(self, current_page: int, page_size: int, with_valid=True, show_source=None, show_exec=None):
|
||||||
if with_valid:
|
if with_valid:
|
||||||
self.is_valid(raise_exception=True)
|
self.is_valid(raise_exception=True)
|
||||||
order_by = '-create_time' if self.data.get('order_asc') is None or self.data.get(
|
order_by = '-create_time' if self.data.get('order_asc') is None or self.data.get(
|
||||||
'order_asc') else 'create_time'
|
'order_asc') else 'create_time'
|
||||||
application_access_token = QuerySet(ApplicationAccessToken).filter(
|
if show_source is None:
|
||||||
application_id=self.data.get('application_id')).first()
|
show_source = True
|
||||||
show_source = False
|
if show_exec is None:
|
||||||
show_exec = False
|
show_exec = True
|
||||||
if application_access_token is not None:
|
|
||||||
show_exec = application_access_token.show_exec
|
|
||||||
show_source = application_access_token.show_source
|
|
||||||
page = page_search(current_page, page_size,
|
page = page_search(current_page, page_size,
|
||||||
QuerySet(ChatRecord).filter(chat_id=self.data.get('chat_id')).order_by(order_by),
|
QuerySet(ChatRecord).filter(chat_id=self.data.get('chat_id')).order_by(order_by),
|
||||||
post_records_handler=lambda chat_record: self.reset_chat_record(chat_record, show_source,
|
post_records_handler=lambda chat_record: self.reset_chat_record(chat_record, show_source,
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from django.db.models import QuerySet
|
|||||||
from django.utils.translation import gettext_lazy as _, gettext
|
from django.utils.translation import gettext_lazy as _, gettext
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from application.models import VoteChoices, ChatRecord, Chat
|
from application.models import VoteChoices, ChatRecord, Chat, ApplicationAccessToken
|
||||||
from application.serializers.application_chat import ChatCountSerializer
|
from application.serializers.application_chat import ChatCountSerializer
|
||||||
from application.serializers.application_chat_record import ChatRecordSerializerModel, \
|
from application.serializers.application_chat_record import ChatRecordSerializerModel, \
|
||||||
ApplicationChatRecordQuerySerializers
|
ApplicationChatRecordQuerySerializers
|
||||||
@ -159,6 +159,13 @@ class HistoricalConversationRecordSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
def page(self, current_page, page_size):
|
def page(self, current_page, page_size):
|
||||||
self.is_valid(raise_exception=True)
|
self.is_valid(raise_exception=True)
|
||||||
|
application_access_token = QuerySet(ApplicationAccessToken).filter(
|
||||||
|
application_id=self.data.get('application_id')).first()
|
||||||
|
show_source = False
|
||||||
|
show_exec = False
|
||||||
|
if application_access_token is not None:
|
||||||
|
show_exec = application_access_token.show_exec
|
||||||
|
show_source = application_access_token.show_source
|
||||||
return ApplicationChatRecordQuerySerializers(
|
return ApplicationChatRecordQuerySerializers(
|
||||||
data={'application_id': self.data.get('application_id'), 'chat_id': self.data.get('chat_id')}).page(
|
data={'application_id': self.data.get('application_id'), 'chat_id': self.data.get('chat_id')}).page(
|
||||||
current_page, page_size)
|
current_page, page_size, show_source=show_source, show_exec=show_exec)
|
||||||
|
|||||||
@ -129,10 +129,8 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-space wrap>
|
<el-space wrap>
|
||||||
<template v-for="(item, index) in uploadImageList" :key="index">
|
<template v-for="(item, index) in uploadImageList" :key="index">
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="file file-image cursor border border-r-6"
|
class="file file-image cursor border border-r-6"
|
||||||
v-if="item.url"
|
|
||||||
@mouseenter.stop="mouseenter(item)"
|
@mouseenter.stop="mouseenter(item)"
|
||||||
@mouseleave.stop="mouseleave()"
|
@mouseleave.stop="mouseleave()"
|
||||||
>
|
>
|
||||||
@ -239,6 +237,7 @@
|
|||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:accept="getAcceptList()"
|
:accept="getAcceptList()"
|
||||||
:on-change="(file: any, fileList: any) => uploadFile(file, fileList)"
|
:on-change="(file: any, fileList: any) => uploadFile(file, fileList)"
|
||||||
|
v-model:file-list="fileAllList"
|
||||||
ref="upload"
|
ref="upload"
|
||||||
>
|
>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user