fix: 修复导出应用日志引用分段字段格式

This commit is contained in:
shaohuzhang1 2024-10-29 17:29:19 +08:00 committed by shaohuzhang1
parent 67fd113449
commit e68e5873c9
10 changed files with 23 additions and 25 deletions

View File

@ -716,6 +716,7 @@ class ApplicationSerializer(serializers.Serializer):
application.save()
# 插入知识库关联关系
self.save_application_mapping(application_dataset_id_list, dataset_id_list, application.id)
chat_cache.clear_by_application_id(str(application.id))
work_flow_version = WorkFlowVersion(work_flow=work_flow, application=application,
name=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
publish_user_id=user_id,

View File

@ -167,25 +167,35 @@ class ChatSerializers(serializers.Serializer):
os.path.join(PROJECT_DIR, "apps", "application", 'sql', 'list_application_chat.sql')),
with_table_name=False)
@staticmethod
def paragraph_list_to_string(paragraph_list):
return "\n**********\n".join(
[f"{paragraph.get('title')}:\n{paragraph.get('content')}" for paragraph in paragraph_list])
@staticmethod
def to_row(row: Dict):
details = row.get('details')
padding_problem_text = details.get('problem_padding').get(
'padding_problem_text') if 'problem_padding' in details and 'padding_problem_text' in details.get(
'problem_padding') else ""
paragraph_list = details.get('search_step').get(
'paragraph_list') if 'search_step' in details and 'paragraph_list' in details.get('search_step') else []
for key, node in details.items():
if node.get('type') == 'search-dataset-node' and node.get('paragraph_list') is not None and len(
node.get('paragraph_list')) > 0:
paragraph_list = node.get('paragraph_list')
search_dataset_node_list = [(key, node) for key, node in details.items() if
node.get("type") == 'search-dataset-node' or node.get(
"step_type") == 'search_step']
reference_paragraph_len = '\n'.join([str(len(node.get('paragraph_list',
[]))) if key == 'search_step' else node.get(
'name') + ':' + str(len(node.get('paragraph_list', []))) for
key, node in search_dataset_node_list])
reference_paragraph = '\n----------\n'.join(
[ChatSerializers.Query.paragraph_list_to_string(node.get('paragraph_list',
[])) if key == 'search_step' else node.get(
'name') + ':\n' + ChatSerializers.Query.paragraph_list_to_string(node.get('paragraph_list',
[])) for
key, node in search_dataset_node_list])
improve_paragraph_list = row.get('improve_paragraph_list')
vote_status_map = {'-1': '未投票', '0': '赞同', '1': '反对'}
return [str(row.get('chat_id')), row.get('abstract'), row.get('problem_text'), padding_problem_text,
row.get('answer_text'), vote_status_map.get(row.get('vote_status')), len(paragraph_list), "\n".join(
[f"{index}{paragraph_list[index].get('title')}\n{paragraph_list[index].get('content')}" for index
in
range(len(paragraph_list))]),
row.get('answer_text'), vote_status_map.get(row.get('vote_status')), reference_paragraph_len,
reference_paragraph,
"\n".join([
f"{improve_paragraph_list[index].get('title')}\n{improve_paragraph_list[index].get('content')}"
for index in range(len(improve_paragraph_list))]),

View File

@ -46,15 +46,10 @@ const form_data = ref({})
const item = ref({})
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
const validate = () => {
console.log('asda')
dynamicsFormRef.value
?.validate()
.then((ok) => {
console.log('ok')
})
.catch((e) => {
console.log(e)
})
.then((ok) => {})
.catch((e) => {})
}
</script>
<style lang="scss"></style>

View File

@ -80,7 +80,6 @@ const split_md_img = (result: Array<string>) => {
const split_md_img_ = (source: string) => {
const temp_md_img_list = source.match(/(!\[.*?\]\(.*?\){.*?})|(!\[.*?\]\(.*?\))/g)
console.log(temp_md_img_list)
const md_img_list = temp_md_img_list ? temp_md_img_list.filter((i) => i) : []
const split_img_value = source
.split(/(!\[.*?\]\(.*?\){.*?})|(!\[.*?\]\(.*?\))/g)

View File

@ -79,7 +79,6 @@ const writeValue = ref('')
const loading = ref(false)
watch(isEdit, (bool) => {
console.log(bool)
if (!bool) {
writeValue.value = ''
emit('close')

View File

@ -102,7 +102,6 @@ watch(debugVisible, (bool) => {
})
const submit = async (formEl: FormInstance | undefined) => {
console.log(formEl)
const validate = formEl ? formEl.validate() : Promise.resolve()
validate.then(() => {
functionLibApi.postFunctionLibDebug(form.value, loading).then((res) => {

View File

@ -87,7 +87,6 @@ const initActive = async () => {
appSecret: props.config.app_secret,
agent_id: props.config.agent_id
}
console.log(props.config)
const redirectUri = encodeURIComponent(window.location.origin)

View File

@ -46,7 +46,6 @@ const init = async () => {
},
onCheckWeComLogin: obj.value,
async onLoginSuccess({ code }: any) {
console.log('Login success:', code)
user.wecomCallback(code).then(() => {
setTimeout(() => {
router.push({ name: 'home' })

View File

@ -43,7 +43,6 @@ const currentIndex = ref(null)
const emit = defineEmits(['refresh'])
const open = (row: any, index: any) => {
// console.log(row, index)
if (row) {
currentItem.value = cloneDeep(row)
currentIndex.value = index

View File

@ -107,7 +107,6 @@ function deleteParam(index: any) {
}
function refresh(data: any, index: any) {
// console.log(data, index)
for (let i = 0; i < modelParamsForm.value.length; i++) {
let field = modelParamsForm.value[i].field
let label = modelParamsForm.value[i].label
@ -136,7 +135,6 @@ function refresh(data: any, index: any) {
}
function submit() {
// console.log('submit: ', modelParamsForm.value)
ModelApi.updateModelParamsForm(props.model.id, modelParamsForm.value, loading).then((ok) => {
MsgSuccess('模型参数保存成功')
close()