mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
Merge branch 'main' of https://github.com/maxkb-dev/maxkb
This commit is contained in:
commit
d582507523
|
|
@ -472,7 +472,7 @@ class ChatRecordSerializer(serializers.Serializer):
|
|||
class Query(serializers.Serializer):
|
||||
application_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):
|
||||
if with_valid:
|
||||
|
|
|
|||
|
|
@ -284,6 +284,11 @@ class ChatRecordApi(ApiMixin):
|
|||
type=openapi.TYPE_STRING,
|
||||
required=True,
|
||||
description=_('Conversation ID')),
|
||||
openapi.Parameter(name='order_asc',
|
||||
in_=openapi.IN_QUERY,
|
||||
type=openapi.TYPE_BOOLEAN,
|
||||
required=False,
|
||||
description=_('Is it ascending order')),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -6764,3 +6764,6 @@ msgstr ""
|
|||
|
||||
msgid "The network is busy, try again later."
|
||||
msgstr ""
|
||||
|
||||
msgid "Is it ascending order"
|
||||
msgstr ""
|
||||
|
|
@ -6902,4 +6902,7 @@ msgid "AI reply: "
|
|||
msgstr "AI 回复: "
|
||||
|
||||
msgid "The network is busy, try again later."
|
||||
msgstr "网络繁忙,请稍后再试。"
|
||||
msgstr "网络繁忙,请稍后再试。"
|
||||
|
||||
msgid "Is it ascending order"
|
||||
msgstr "是否升序"
|
||||
|
|
@ -6914,4 +6914,7 @@ msgid "AI reply: "
|
|||
msgstr "AI 回覆: "
|
||||
|
||||
msgid "The network is busy, try again later."
|
||||
msgstr "網絡繁忙,請稍後再試。"
|
||||
msgstr "網絡繁忙,請稍後再試。"
|
||||
|
||||
msgid "Is it ascending order"
|
||||
msgstr "是否昇冪"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from typing import Dict
|
||||
|
||||
import dashscope
|
||||
from dashscope.audio.tts_v2 import *
|
||||
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from common.util.common import _remove_empty_lines
|
||||
|
|
@ -38,9 +38,14 @@ class AliyunBaiLianTextToSpeech(MaxKBBaseModel, BaseTextToSpeech):
|
|||
|
||||
def text_to_speech(self, text):
|
||||
dashscope.api_key = self.api_key
|
||||
synthesizer = SpeechSynthesizer(model=self.model, **self.params)
|
||||
text = _remove_empty_lines(text)
|
||||
audio = synthesizer.call(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)
|
||||
if type(audio) == str:
|
||||
print(audio)
|
||||
raise Exception(audio)
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ const handleScrollTop = ($event: any) => {
|
|||
scrollTop.value = $event.scrollTop
|
||||
if (
|
||||
dialogScrollbar.value.scrollHeight - (scrollTop.value + scrollDiv.value.wrapRef.offsetHeight) <=
|
||||
30
|
||||
40
|
||||
) {
|
||||
scorll.value = true
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -179,7 +179,18 @@ const render = (
|
|||
const value = formFieldList.value
|
||||
.map((item) => {
|
||||
if (form_data[item.field] !== undefined) {
|
||||
return { [item.field]: form_data[item.field] }
|
||||
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] }
|
||||
}
|
||||
if (item.show_default_value === true || item.show_default_value === undefined) {
|
||||
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 }
|
||||
|
|
@ -187,7 +198,6 @@ const render = (
|
|||
return {}
|
||||
})
|
||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||
|
||||
formValue.value = _.cloneDeep(value)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
v-model="dialogVisible"
|
||||
style="width: 550px"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -181,7 +181,10 @@ function editName(val: string, item: any) {
|
|||
}
|
||||
|
||||
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
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
await formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
log.asyncPutChatClientLog(applicationId.value, chatId.value, form.value, loading).then(() => {
|
||||
emit('refresh')
|
||||
emit('refresh', chatId.value, form.value.abstract)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,8 +232,11 @@ function mouseenter(row: any) {
|
|||
function editLogTitle(row: any) {
|
||||
EditTitleDialogRef.value.open(row, applicationDetail.value.id)
|
||||
}
|
||||
function refreshFieldTitle() {
|
||||
getChatLog(applicationDetail.value.id)
|
||||
function refreshFieldTitle(chatId: string, abstract: string) {
|
||||
const find = chatLogData.value.find((item: any) => item.id == chatId)
|
||||
if (find) {
|
||||
find.abstract = abstract
|
||||
}
|
||||
}
|
||||
function deleteLog(row: any) {
|
||||
log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => {
|
||||
|
|
|
|||
|
|
@ -115,13 +115,17 @@
|
|||
<div class="footer-content flex-between">
|
||||
<div>
|
||||
<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>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-divider direction="vertical" />
|
||||
<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>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
|
|
|||
Loading…
Reference in New Issue