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):
|
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:
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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 ""
|
||||||
@ -6902,4 +6902,7 @@ msgid "AI reply: "
|
|||||||
msgstr "AI 回复: "
|
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 "是否升序"
|
||||||
@ -6914,4 +6914,7 @@ msgid "AI reply: "
|
|||||||
msgstr "AI 回覆: "
|
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 "是否昇冪"
|
||||||
@ -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,9 +38,14 @@ 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)
|
||||||
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:
|
if type(audio) == str:
|
||||||
print(audio)
|
print(audio)
|
||||||
raise Exception(audio)
|
raise Exception(audio)
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
@ -179,7 +179,18 @@ 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) {
|
||||||
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) {
|
if (item.show_default_value === true || item.show_default_value === undefined) {
|
||||||
return { [item.field]: item.default_value }
|
return { [item.field]: item.default_value }
|
||||||
@ -187,7 +198,6 @@ const render = (
|
|||||||
return {}
|
return {}
|
||||||
})
|
})
|
||||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||||
|
|
||||||
formValue.value = _.cloneDeep(value)
|
formValue.value = _.cloneDeep(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
@ -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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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(() => {
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user