This commit is contained in:
liqiang-fit2cloud 2025-03-04 15:05:41 +08:00
commit d582507523
13 changed files with 55 additions and 15 deletions

View File

@ -472,7 +472,7 @@ class ChatRecordSerializer(serializers.Serializer):
class Query(serializers.Serializer): class Query(serializers.Serializer):
application_id = serializers.UUIDField(required=True) application_id = serializers.UUIDField(required=True)
chat_id = serializers.UUIDField(required=True) chat_id = serializers.UUIDField(required=True)
order_asc = serializers.BooleanField(required=False) order_asc = serializers.BooleanField(required=False, allow_null=True)
def list(self, with_valid=True): def list(self, with_valid=True):
if with_valid: if with_valid:

View File

@ -284,6 +284,11 @@ class ChatRecordApi(ApiMixin):
type=openapi.TYPE_STRING, type=openapi.TYPE_STRING,
required=True, required=True,
description=_('Conversation ID')), description=_('Conversation ID')),
openapi.Parameter(name='order_asc',
in_=openapi.IN_QUERY,
type=openapi.TYPE_BOOLEAN,
required=False,
description=_('Is it ascending order')),
] ]
@staticmethod @staticmethod

View File

@ -6764,3 +6764,6 @@ msgstr ""
msgid "The network is busy, try again later." msgid "The network is busy, try again later."
msgstr "" msgstr ""
msgid "Is it ascending order"
msgstr ""

View File

@ -6903,3 +6903,6 @@ msgstr "AI 回复: "
msgid "The network is busy, try again later." msgid "The network is busy, try again later."
msgstr "网络繁忙,请稍后再试。" msgstr "网络繁忙,请稍后再试。"
msgid "Is it ascending order"
msgstr "是否升序"

View File

@ -6915,3 +6915,6 @@ msgstr "AI 回覆: "
msgid "The network is busy, try again later." msgid "The network is busy, try again later."
msgstr "網絡繁忙,請稍後再試。" msgstr "網絡繁忙,請稍後再試。"
msgid "Is it ascending order"
msgstr "是否昇冪"

View File

@ -1,7 +1,7 @@
from typing import Dict from typing import Dict
import dashscope import dashscope
from dashscope.audio.tts_v2 import *
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from common.util.common import _remove_empty_lines from common.util.common import _remove_empty_lines
@ -38,8 +38,13 @@ class AliyunBaiLianTextToSpeech(MaxKBBaseModel, BaseTextToSpeech):
def text_to_speech(self, text): def text_to_speech(self, text):
dashscope.api_key = self.api_key dashscope.api_key = self.api_key
synthesizer = SpeechSynthesizer(model=self.model, **self.params)
text = _remove_empty_lines(text) text = _remove_empty_lines(text)
if 'sambert' in self.model:
from dashscope.audio.tts import SpeechSynthesizer
audio = SpeechSynthesizer.call(model=self.model, text=text, **self.params).get_audio_data()
else:
from dashscope.audio.tts_v2 import SpeechSynthesizer
synthesizer = SpeechSynthesizer(model=self.model, **self.params)
audio = synthesizer.call(text) audio = synthesizer.call(text)
if type(audio) == str: if type(audio) == str:
print(audio) print(audio)

View File

@ -417,7 +417,7 @@ const handleScrollTop = ($event: any) => {
scrollTop.value = $event.scrollTop scrollTop.value = $event.scrollTop
if ( if (
dialogScrollbar.value.scrollHeight - (scrollTop.value + scrollDiv.value.wrapRef.offsetHeight) <= dialogScrollbar.value.scrollHeight - (scrollTop.value + scrollDiv.value.wrapRef.offsetHeight) <=
30 40
) { ) {
scorll.value = true scorll.value = true
} else { } else {

View File

@ -179,15 +179,25 @@ const render = (
const value = formFieldList.value const value = formFieldList.value
.map((item) => { .map((item) => {
if (form_data[item.field] !== undefined) { if (form_data[item.field] !== undefined) {
if (item.value_field && item.option_list && item.option_list.length > 0) {
const value_field = item.value_field
const find = item.option_list?.find((i) => i[value_field] === form_data[item.field])
if (find) {
return { [item.field]: form_data[item.field] } return { [item.field]: form_data[item.field] }
} }
if (item.show_default_value === true || item.show_default_value === undefined) { if (item.show_default_value === true || item.show_default_value === undefined) {
return { [item.field]: item.default_value } return { [item.field]: item.default_value }
} }
} else {
return { [item.field]: form_data[item.field] }
}
}
if (item.show_default_value === true || item.show_default_value === undefined) {
return { [item.field]: item.default_value }
}
return {} return {}
}) })
.reduce((x, y) => ({ ...x, ...y }), {}) .reduce((x, y) => ({ ...x, ...y }), {})
formValue.value = _.cloneDeep(value) formValue.value = _.cloneDeep(value)
} }
} }

View File

@ -6,6 +6,7 @@
v-model="dialogVisible" v-model="dialogVisible"
style="width: 550px" style="width: 550px"
append-to-body append-to-body
destroy-on-close
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
> >

View File

@ -181,7 +181,10 @@ function editName(val: string, item: any) {
} }
log.asyncPutChatClientLog(applicationDetail.value.id, item.id, obj, loading).then(() => { log.asyncPutChatClientLog(applicationDetail.value.id, item.id, obj, loading).then(() => {
getChatLog(applicationDetail.value.id) const find = chatLogData.value.find((item: any) => item.id == item.id)
if (find) {
find.abstract = val
}
item['writeStatus'] = false item['writeStatus'] = false
}) })
} else { } else {

View File

@ -75,7 +75,7 @@ const submit = async (formEl: FormInstance | undefined) => {
await formEl.validate((valid) => { await formEl.validate((valid) => {
if (valid) { if (valid) {
log.asyncPutChatClientLog(applicationId.value, chatId.value, form.value, loading).then(() => { log.asyncPutChatClientLog(applicationId.value, chatId.value, form.value, loading).then(() => {
emit('refresh') emit('refresh', chatId.value, form.value.abstract)
dialogVisible.value = false dialogVisible.value = false
}) })
} }

View File

@ -232,8 +232,11 @@ function mouseenter(row: any) {
function editLogTitle(row: any) { function editLogTitle(row: any) {
EditTitleDialogRef.value.open(row, applicationDetail.value.id) EditTitleDialogRef.value.open(row, applicationDetail.value.id)
} }
function refreshFieldTitle() { function refreshFieldTitle(chatId: string, abstract: string) {
getChatLog(applicationDetail.value.id) const find = chatLogData.value.find((item: any) => item.id == chatId)
if (find) {
find.abstract = abstract
}
} }
function deleteLog(row: any) { function deleteLog(row: any) {
log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => { log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => {

View File

@ -115,13 +115,17 @@
<div class="footer-content flex-between"> <div class="footer-content flex-between">
<div> <div>
<el-tooltip effect="dark" :content="$t('common.copy')" placement="top"> <el-tooltip effect="dark" :content="$t('common.copy')" placement="top">
<el-button text @click.stop="copyFunctionLib(item)"> <el-button text @click.stop="copyFunctionLib(item)"
:disabled="item.permission_type === 'PUBLIC' && !canEdit(item)"
>
<AppIcon iconName="app-copy"></AppIcon> <AppIcon iconName="app-copy"></AppIcon>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-tooltip effect="dark" :content="$t('common.export')" placement="top"> <el-tooltip effect="dark" :content="$t('common.export')" placement="top">
<el-button text @click.stop="exportFunctionLib(item)"> <el-button text @click.stop="exportFunctionLib(item)"
:disabled="item.permission_type === 'PUBLIC' && !canEdit(item)"
>
<AppIcon iconName="app-export"></AppIcon> <AppIcon iconName="app-export"></AppIcon>
</el-button> </el-button>
</el-tooltip> </el-tooltip>