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"
|
:size="32"
|
||||||
/>
|
/>
|
||||||
<h4 class="ellipsis-1">{{ detail?.name }}</h4>
|
<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>
|
</div>
|
||||||
|
|
||||||
<el-row class="mt-16">
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mt-16">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-text type="info">公开访问链接</el-text>
|
<el-text type="info">公开访问链接</el-text>
|
||||||
<el-switch
|
<el-switch
|
||||||
@ -46,7 +42,7 @@
|
|||||||
<el-button @click="openDialog"> 嵌入第三方 </el-button>
|
<el-button @click="openDialog"> 嵌入第三方 </el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="mt-16">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-text type="info">API访问凭据</el-text>
|
<el-text type="info">API访问凭据</el-text>
|
||||||
<el-switch
|
<el-switch
|
||||||
|
|||||||
@ -45,10 +45,6 @@
|
|||||||
:size="32"
|
:size="32"
|
||||||
/>
|
/>
|
||||||
</template>
|
</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>
|
<template #footer>
|
||||||
<div class="footer-content">
|
<div class="footer-content">
|
||||||
@ -67,26 +63,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
<span @click.stop>
|
<el-tooltip effect="dark" content="删除" placement="top">
|
||||||
<el-dropdown trigger="click" placement="bottom-start">
|
<el-button text @click.stop="deleteApplication(item)">
|
||||||
<span class="el-dropdown-link">
|
<el-icon><Delete /></el-icon>
|
||||||
<el-button text>
|
</el-button>
|
||||||
<AppIcon iconName="MoreFilled"></AppIcon>
|
</el-tooltip>
|
||||||
</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>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
@ -173,20 +154,6 @@ function deleteApplication(row: any) {
|
|||||||
.catch(() => {})
|
.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() {
|
function getList() {
|
||||||
applicationApi
|
applicationApi
|
||||||
|
|||||||
@ -31,12 +31,17 @@
|
|||||||
<el-table-column prop="chat_record_count" label="对话提问数" align="right" />
|
<el-table-column prop="chat_record_count" label="对话提问数" align="right" />
|
||||||
<el-table-column prop="star_num" label="用户反馈" align="right">
|
<el-table-column prop="star_num" label="用户反馈" align="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div>
|
<span v-if="!row.trample_num && !row.trample_num"> - </span>
|
||||||
<AppIcon iconName="app-like-color"></AppIcon>
|
<span v-else>
|
||||||
{{ row.star_num }}
|
<span v-if="row.star_num">
|
||||||
<AppIcon iconName="app-oppose-color"></AppIcon>
|
<AppIcon iconName="app-like-color"></AppIcon>
|
||||||
{{ row.trample_num }}
|
{{ row.star_num }}
|
||||||
</div>
|
</span>
|
||||||
|
<span v-if="row.trample_num" class="ml-4">
|
||||||
|
<AppIcon iconName="app-oppose-color"></AppIcon>
|
||||||
|
{{ row.trample_num }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="mark_sum" label="改进标注" align="right" />
|
<el-table-column prop="mark_sum" label="改进标注" align="right" />
|
||||||
@ -49,7 +54,7 @@
|
|||||||
<el-table-column label="操作" width="70" align="center">
|
<el-table-column label="操作" width="70" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tooltip effect="dark" content="删除" placement="top">
|
<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-icon><Delete /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -62,6 +67,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive, computed } from 'vue'
|
import { ref, onMounted, reactive, computed } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||||
import logApi from '@/api/log'
|
import logApi from '@/api/log'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@ -102,6 +108,21 @@ function rowClickHandle(row: any) {
|
|||||||
// router.push({ path: `/dataset/${id}/${row.id}` })
|
// 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() {
|
function handleSizeChange() {
|
||||||
paginationConfig.current_page = 1
|
paginationConfig.current_page = 1
|
||||||
getList()
|
getList()
|
||||||
@ -114,11 +135,11 @@ function changeHandle(val: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
let obj = {
|
let obj: any = {
|
||||||
history_day: history_day.value
|
history_day: history_day.value
|
||||||
}
|
}
|
||||||
if (search.value) {
|
if (search.value) {
|
||||||
obj = { ...object, search: search.value }
|
obj = { ...obj, search: search.value }
|
||||||
}
|
}
|
||||||
logApi.getChatLog(id as string, paginationConfig, obj, loading).then((res) => {
|
logApi.getChatLog(id as string, paginationConfig, obj, loading).then((res) => {
|
||||||
tableData.value = res.data.records
|
tableData.value = res.data.records
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user