mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
feat: 日志管理
This commit is contained in:
parent
79807c2f6d
commit
65d27fd191
|
|
@ -30,6 +30,19 @@ const getChatLog: (
|
|||
)
|
||||
}
|
||||
|
||||
export default {
|
||||
getChatLog
|
||||
/**
|
||||
* 删除日志
|
||||
* @param 参数 applicaiton_id, chat_id,
|
||||
*/
|
||||
const delChatLog: (
|
||||
applicaiton_id: string,
|
||||
chat_id: string,
|
||||
loading?: Ref<boolean>
|
||||
) => Promise<Result<boolean>> = (applicaiton_id, chat_id, loading) => {
|
||||
return del(`${prefix}/${applicaiton_id}/document/${chat_id}`, {}, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
getChatLog,
|
||||
delChatLog
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,10 @@
|
|||
:size="32"
|
||||
/>
|
||||
<h4 class="ellipsis-1">{{ detail?.name }}</h4>
|
||||
<div class="ml-8" v-if="detail">
|
||||
<el-tag v-if="detail?.status" class="success-tag">运行中</el-tag>
|
||||
<el-tag v-else class="warning-tag">已停用</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-row class="mt-16">
|
||||
<el-col :span="12">
|
||||
<el-row>
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mt-16">
|
||||
<div class="flex">
|
||||
<el-text type="info">公开访问链接</el-text>
|
||||
<el-switch
|
||||
|
|
@ -46,7 +42,7 @@
|
|||
<el-button @click="openDialog"> 嵌入第三方 </el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mt-16">
|
||||
<div class="flex">
|
||||
<el-text type="info">API访问凭据</el-text>
|
||||
<el-switch
|
||||
|
|
|
|||
|
|
@ -45,10 +45,6 @@
|
|||
:size="32"
|
||||
/>
|
||||
</template>
|
||||
<div class="status-tag">
|
||||
<el-tag v-if="item.status" class="success-tag">运行中</el-tag>
|
||||
<el-tag v-else class="warning-tag">已停用</el-tag>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="footer-content">
|
||||
|
|
@ -67,26 +63,11 @@
|
|||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-divider direction="vertical" />
|
||||
<span @click.stop>
|
||||
<el-dropdown trigger="click" placement="bottom-start">
|
||||
<span class="el-dropdown-link">
|
||||
<el-button text>
|
||||
<AppIcon iconName="MoreFilled"></AppIcon>
|
||||
</el-button>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<div class="dropdown-custom-switch">
|
||||
<span>运行中</span>
|
||||
<!-- <el-switch size="small" v-model="item.status" @change="changeState($event, item)" /> -->
|
||||
</div>
|
||||
<el-dropdown-item divided @click="deleteApplication(item)"
|
||||
>删除</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</span>
|
||||
<el-tooltip effect="dark" content="删除" placement="top">
|
||||
<el-button text @click.stop="deleteApplication(item)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</CardBox>
|
||||
|
|
@ -173,20 +154,6 @@ function deleteApplication(row: any) {
|
|||
.catch(() => {})
|
||||
}
|
||||
|
||||
// function changeState(bool: Boolean, row: any) {
|
||||
// const obj = {
|
||||
// is_active: bool
|
||||
// }
|
||||
// loading.value = true
|
||||
// applicationApi
|
||||
// .asyncPutParagraph(id, documentId, row.id, obj)
|
||||
// .then((res) => {
|
||||
// loading.value = false
|
||||
// })
|
||||
// .catch(() => {
|
||||
// loading.value = false
|
||||
// })
|
||||
// }
|
||||
|
||||
function getList() {
|
||||
applicationApi
|
||||
|
|
|
|||
|
|
@ -31,12 +31,17 @@
|
|||
<el-table-column prop="chat_record_count" label="对话提问数" align="right" />
|
||||
<el-table-column prop="star_num" label="用户反馈" align="right">
|
||||
<template #default="{ row }">
|
||||
<div>
|
||||
<AppIcon iconName="app-like-color"></AppIcon>
|
||||
{{ row.star_num }}
|
||||
<AppIcon iconName="app-oppose-color"></AppIcon>
|
||||
{{ row.trample_num }}
|
||||
</div>
|
||||
<span v-if="!row.trample_num && !row.trample_num"> - </span>
|
||||
<span v-else>
|
||||
<span v-if="row.star_num">
|
||||
<AppIcon iconName="app-like-color"></AppIcon>
|
||||
{{ row.star_num }}
|
||||
</span>
|
||||
<span v-if="row.trample_num" class="ml-4">
|
||||
<AppIcon iconName="app-oppose-color"></AppIcon>
|
||||
{{ row.trample_num }}
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="mark_sum" label="改进标注" align="right" />
|
||||
|
|
@ -49,7 +54,7 @@
|
|||
<el-table-column label="操作" width="70" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip effect="dark" content="删除" placement="top">
|
||||
<el-button type="primary" text>
|
||||
<el-button type="primary" text @click.stop="deleteLog(row)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
|
|
@ -62,6 +67,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import logApi from '@/api/log'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
const route = useRoute()
|
||||
|
|
@ -102,6 +108,21 @@ function rowClickHandle(row: any) {
|
|||
// router.push({ path: `/dataset/${id}/${row.id}` })
|
||||
}
|
||||
|
||||
function deleteLog(row: any) {
|
||||
MsgConfirm(`是否删除对话:${row.abstract} ?`, `删除后无法恢复,请谨慎操作。`, {
|
||||
confirmButtonText: '删除',
|
||||
confirmButtonClass: 'danger'
|
||||
})
|
||||
.then(() => {
|
||||
loading.value = true
|
||||
logApi.delChatLog(id as string, row.id, loading).then(() => {
|
||||
MsgSuccess('删除成功')
|
||||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
function handleSizeChange() {
|
||||
paginationConfig.current_page = 1
|
||||
getList()
|
||||
|
|
@ -114,11 +135,11 @@ function changeHandle(val: number) {
|
|||
}
|
||||
|
||||
function getList() {
|
||||
let obj = {
|
||||
let obj: any = {
|
||||
history_day: history_day.value
|
||||
}
|
||||
if (search.value) {
|
||||
obj = { ...object, search: search.value }
|
||||
obj = { ...obj, search: search.value }
|
||||
}
|
||||
logApi.getChatLog(id as string, paginationConfig, obj, loading).then((res) => {
|
||||
tableData.value = res.data.records
|
||||
|
|
|
|||
Loading…
Reference in New Issue