Skip to content

Commit e68e587

Browse files
committed
fix: 修复导出应用日志引用分段字段格式
1 parent 67fd113 commit e68e587

File tree

10 files changed

+23
-25
lines changed

10 files changed

+23
-25
lines changed

apps/application/serializers/application_serializers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ def publish(self, instance, with_valid=True):
716716
application.save()
717717
# 插入知识库关联关系
718718
self.save_application_mapping(application_dataset_id_list, dataset_id_list, application.id)
719+
chat_cache.clear_by_application_id(str(application.id))
719720
work_flow_version = WorkFlowVersion(work_flow=work_flow, application=application,
720721
name=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
721722
publish_user_id=user_id,

apps/application/serializers/chat_serializers.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,35 @@ def list(self, with_valid=True):
167167
os.path.join(PROJECT_DIR, "apps", "application", 'sql', 'list_application_chat.sql')),
168168
with_table_name=False)
169169

170+
@staticmethod
171+
def paragraph_list_to_string(paragraph_list):
172+
return "\n**********\n".join(
173+
[f"{paragraph.get('title')}:\n{paragraph.get('content')}" for paragraph in paragraph_list])
174+
170175
@staticmethod
171176
def to_row(row: Dict):
172177
details = row.get('details')
173178
padding_problem_text = details.get('problem_padding').get(
174179
'padding_problem_text') if 'problem_padding' in details and 'padding_problem_text' in details.get(
175180
'problem_padding') else ""
176-
paragraph_list = details.get('search_step').get(
177-
'paragraph_list') if 'search_step' in details and 'paragraph_list' in details.get('search_step') else []
178-
for key, node in details.items():
179-
if node.get('type') == 'search-dataset-node' and node.get('paragraph_list') is not None and len(
180-
node.get('paragraph_list')) > 0:
181-
paragraph_list = node.get('paragraph_list')
181+
search_dataset_node_list = [(key, node) for key, node in details.items() if
182+
node.get("type") == 'search-dataset-node' or node.get(
183+
"step_type") == 'search_step']
184+
reference_paragraph_len = '\n'.join([str(len(node.get('paragraph_list',
185+
[]))) if key == 'search_step' else node.get(
186+
'name') + ':' + str(len(node.get('paragraph_list', []))) for
187+
key, node in search_dataset_node_list])
188+
reference_paragraph = '\n----------\n'.join(
189+
[ChatSerializers.Query.paragraph_list_to_string(node.get('paragraph_list',
190+
[])) if key == 'search_step' else node.get(
191+
'name') + ':\n' + ChatSerializers.Query.paragraph_list_to_string(node.get('paragraph_list',
192+
[])) for
193+
key, node in search_dataset_node_list])
182194
improve_paragraph_list = row.get('improve_paragraph_list')
183195
vote_status_map = {'-1': '未投票', '0': '赞同', '1': '反对'}
184196
return [str(row.get('chat_id')), row.get('abstract'), row.get('problem_text'), padding_problem_text,
185-
row.get('answer_text'), vote_status_map.get(row.get('vote_status')), len(paragraph_list), "\n".join(
186-
[f"{index}{paragraph_list[index].get('title')}\n{paragraph_list[index].get('content')}" for index
187-
in
188-
range(len(paragraph_list))]),
197+
row.get('answer_text'), vote_status_map.get(row.get('vote_status')), reference_paragraph_len,
198+
reference_paragraph,
189199
"\n".join([
190200
f"{improve_paragraph_list[index].get('title')}\n{improve_paragraph_list[index].get('content')}"
191201
for index in range(len(improve_paragraph_list))]),

ui/src/components/dynamics-form/DemoConstructor.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,10 @@ const form_data = ref({})
4646
const item = ref({})
4747
const dynamicsFormRef = ref<InstanceType<typeof DynamicsForm>>()
4848
const validate = () => {
49-
console.log('asda')
5049
dynamicsFormRef.value
5150
?.validate()
52-
.then((ok) => {
53-
console.log('ok')
54-
})
55-
.catch((e) => {
56-
console.log(e)
57-
})
51+
.then((ok) => {})
52+
.catch((e) => {})
5853
}
5954
</script>
6055
<style lang="scss"></style>

ui/src/components/markdown/MdRenderer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ const split_md_img = (result: Array<string>) => {
8080
8181
const split_md_img_ = (source: string) => {
8282
const temp_md_img_list = source.match(/(!\[.*?\]\(.*?\){.*?})|(!\[.*?\]\(.*?\))/g)
83-
console.log(temp_md_img_list)
8483
const md_img_list = temp_md_img_list ? temp_md_img_list.filter((i) => i) : []
8584
const split_img_value = source
8685
.split(/(!\[.*?\]\(.*?\){.*?})|(!\[.*?\]\(.*?\))/g)

ui/src/components/read-write/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ const writeValue = ref('')
7979
const loading = ref(false)
8080
8181
watch(isEdit, (bool) => {
82-
console.log(bool)
8382
if (!bool) {
8483
writeValue.value = ''
8584
emit('close')

ui/src/views/function-lib/component/FunctionDebugDrawer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ watch(debugVisible, (bool) => {
102102
})
103103
104104
const submit = async (formEl: FormInstance | undefined) => {
105-
console.log(formEl)
106105
const validate = formEl ? formEl.validate() : Promise.resolve()
107106
validate.then(() => {
108107
functionLibApi.postFunctionLibDebug(form.value, loading).then((res) => {

ui/src/views/login/components/dingtalkQrCode.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ const initActive = async () => {
8787
appSecret: props.config.app_secret,
8888
agent_id: props.config.agent_id
8989
}
90-
console.log(props.config)
9190
9291
const redirectUri = encodeURIComponent(window.location.origin)
9392

ui/src/views/login/components/wecomQrCode.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ const init = async () => {
4646
},
4747
onCheckWeComLogin: obj.value,
4848
async onLoginSuccess({ code }: any) {
49-
console.log('Login success:', code)
5049
user.wecomCallback(code).then(() => {
5150
setTimeout(() => {
5251
router.push({ name: 'home' })

ui/src/views/template/component/AddParamDrawer.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const currentIndex = ref(null)
4343
const emit = defineEmits(['refresh'])
4444
4545
const open = (row: any, index: any) => {
46-
// console.log(row, index)
4746
if (row) {
4847
currentItem.value = cloneDeep(row)
4948
currentIndex.value = index

ui/src/views/template/component/ParamSettingDialog.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ function deleteParam(index: any) {
107107
}
108108
109109
function refresh(data: any, index: any) {
110-
// console.log(data, index)
111110
for (let i = 0; i < modelParamsForm.value.length; i++) {
112111
let field = modelParamsForm.value[i].field
113112
let label = modelParamsForm.value[i].label
@@ -136,7 +135,6 @@ function refresh(data: any, index: any) {
136135
}
137136
138137
function submit() {
139-
// console.log('submit: ', modelParamsForm.value)
140138
ModelApi.updateModelParamsForm(props.model.id, modelParamsForm.value, loading).then((ok) => {
141139
MsgSuccess('模型参数保存成功')
142140
close()

0 commit comments

Comments
 (0)