mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: clean up formatting and whitespace in chat-log.ts and EditMarkDialog.vue
This commit is contained in:
parent
4c9d024b67
commit
a0e2403e77
|
|
@ -1,4 +1,4 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import {Result} from '@/request/Result'
|
||||
import {
|
||||
get,
|
||||
post,
|
||||
|
|
@ -10,14 +10,15 @@ import {
|
|||
download,
|
||||
exportFile,
|
||||
} from '@/request/index'
|
||||
import type { pageRequest } from '@/api/type/common'
|
||||
import type { ApplicationFormType } from '@/api/type/application'
|
||||
import { type Ref } from 'vue'
|
||||
import type {pageRequest} from '@/api/type/common'
|
||||
import type {ApplicationFormType} from '@/api/type/application'
|
||||
import {type Ref} from 'vue'
|
||||
import useStore from '@/stores'
|
||||
const prefix: any = { _value: '/workspace/' }
|
||||
|
||||
const prefix: any = {_value: '/workspace/'}
|
||||
Object.defineProperty(prefix, 'value', {
|
||||
get: function () {
|
||||
const { user } = useStore()
|
||||
const {user} = useStore()
|
||||
return this._value + user.getWorkspaceId() + '/application'
|
||||
},
|
||||
})
|
||||
|
|
@ -42,9 +43,9 @@ const postChatLogAddKnowledge: (
|
|||
* @param 参数
|
||||
* application_id
|
||||
* param {
|
||||
"start_time": "string",
|
||||
"end_time": "string",
|
||||
}
|
||||
"start_time": "string",
|
||||
"end_time": "string",
|
||||
}
|
||||
*/
|
||||
const getChatLog: (
|
||||
application_id: String,
|
||||
|
|
@ -73,7 +74,7 @@ const getChatRecordLog: (
|
|||
) => Promise<Result<any>> = (application_id, chart_id, page, loading, order_asc) => {
|
||||
return get(
|
||||
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${page.current_page}/${page.page_size}`,
|
||||
{ order_asc: order_asc !== undefined ? order_asc : true },
|
||||
{order_asc: order_asc !== undefined ? order_asc : true},
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
|
@ -81,25 +82,21 @@ const getChatRecordLog: (
|
|||
/**
|
||||
* 获取标注段落列表信息
|
||||
* @param 参数
|
||||
* application_id, chart_id, chart_record_id, knowledge_id, document_id
|
||||
* application_id, chart_id, chart_record_id
|
||||
*/
|
||||
const getMarkChatRecord: (
|
||||
application_id: String,
|
||||
chart_id: String,
|
||||
chart_record_id: String,
|
||||
knowledge_id: String,
|
||||
document_id: String,
|
||||
application_id: string,
|
||||
chart_id: string,
|
||||
chart_record_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<any>> = (
|
||||
application_id,
|
||||
chart_id,
|
||||
chart_record_id,
|
||||
knowledge_id,
|
||||
document_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(
|
||||
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/knowledge/${knowledge_id}/document/${document_id}/improve`,
|
||||
`${prefix.value}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/improve`,
|
||||
undefined,
|
||||
loading,
|
||||
)
|
||||
|
|
@ -110,10 +107,10 @@ const getMarkChatRecord: (
|
|||
* @param 参数
|
||||
* application_id, chart_id, chart_record_id, knowledge_id, document_id
|
||||
* data {
|
||||
"title": "string",
|
||||
"content": "string",
|
||||
"problem_text": "string"
|
||||
}
|
||||
"title": "string",
|
||||
"content": "string",
|
||||
"problem_text": "string"
|
||||
}
|
||||
*/
|
||||
const putChatRecordLog: (
|
||||
application_id: String,
|
||||
|
|
@ -175,9 +172,9 @@ const delMarkChatRecord: (
|
|||
* @param 参数
|
||||
* application_id
|
||||
* param {
|
||||
"start_time": "string",
|
||||
"end_time": "string",
|
||||
}
|
||||
"start_time": "string",
|
||||
"end_time": "string",
|
||||
}
|
||||
*/
|
||||
const postExportChatLog: (
|
||||
application_id: string,
|
||||
|
|
|
|||
|
|
@ -12,12 +12,16 @@
|
|||
<h4 :id="titleId" :class="titleClass">{{ $t('views.chatLog.editMark') }}</h4>
|
||||
<div class="text-right">
|
||||
<el-button text @click="isEdit = true" v-if="!isEdit">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
<el-icon>
|
||||
<EditPen/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button text style="margin-left: 4px" @click="deleteMark">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<el-icon>
|
||||
<Delete/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
<el-divider direction="vertical"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -60,17 +64,17 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, reactive } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import {ref, watch, reactive} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import type {FormInstance, FormRules} from 'element-plus'
|
||||
import chatLogApi from '@/api/application/chat-log'
|
||||
import paragraphApi from '@/api/knowledge/paragraph'
|
||||
import { t } from '@/locales'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import {t} from '@/locales'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id },
|
||||
params: {id},
|
||||
} = route as any
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -86,7 +90,7 @@ const detail = ref<any>({})
|
|||
|
||||
const rules = reactive<FormRules>({
|
||||
content: [
|
||||
{ required: true, message: t('views.chatLog.form.content.placeholder'), trigger: 'blur' },
|
||||
{required: true, message: t('views.chatLog.form.content.placeholder'), trigger: 'blur'},
|
||||
],
|
||||
})
|
||||
|
||||
|
|
@ -116,8 +120,9 @@ function deleteMark() {
|
|||
}
|
||||
|
||||
function getMark(data: any) {
|
||||
console.log(data)
|
||||
chatLogApi
|
||||
.getMarkChatRecord(id as string, data.chat_id, data.id, data.knowledge, data.document, loading)
|
||||
.getMarkChatRecord(id as string, data.chat_id, data.id, loading)
|
||||
.then((res: any) => {
|
||||
if (res.data.length > 0) {
|
||||
form.value = res.data[0]
|
||||
|
|
@ -151,13 +156,14 @@ const submit = async (formEl: FormInstance) => {
|
|||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
defineExpose({open})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.edit-mark-dialog {
|
||||
.el-dialog__header.show-close {
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.el-dialog__headerbtn {
|
||||
top: 13px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue