|
@@ -1,91 +1,164 @@
|
|
|
<template>
|
|
|
<div class="white content">
|
|
|
- <div class="white" v-loading="loading">
|
|
|
- <v-banner class="mb-3">
|
|
|
- Redis
|
|
|
- <template v-slot:actions>
|
|
|
- <v-btn
|
|
|
- text
|
|
|
- color="primary"
|
|
|
- @click="getConversationsStatus"
|
|
|
- >
|
|
|
- <v-icon left>mdi-refresh</v-icon>
|
|
|
- 刷新
|
|
|
- </v-btn>
|
|
|
- <v-btn
|
|
|
- text
|
|
|
- color="deep-purple accent-4"
|
|
|
- @click="onClearRedisCache"
|
|
|
- >
|
|
|
- <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
- 清除对话缓存
|
|
|
- </v-btn>
|
|
|
- </template>
|
|
|
- </v-banner>
|
|
|
- <v-container>
|
|
|
- <v-row >
|
|
|
- <v-col
|
|
|
- v-for="elevation in elevations"
|
|
|
- :key="elevation.value"
|
|
|
- cols="3"
|
|
|
- >
|
|
|
- <v-card
|
|
|
- class="pa-2"
|
|
|
- tile
|
|
|
- height="150"
|
|
|
+ <div class="white">
|
|
|
+ <div v-loading="loading">
|
|
|
+ <v-banner class="mb-3">
|
|
|
+ Redis
|
|
|
+ <template v-slot:actions>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="primary"
|
|
|
+ @click="getConversationsStatus"
|
|
|
>
|
|
|
- <div class="d-flex align-center justify-center flex-column" style="height: 100%;">
|
|
|
- <div class="text-h3" :class="`${elevation.textColor}--text`">{{ itemData[elevation.value] }}</div>
|
|
|
- <div>{{ elevation.text }}</div>
|
|
|
- </div>
|
|
|
- </v-card>
|
|
|
- </v-col>
|
|
|
- </v-row>
|
|
|
- </v-container>
|
|
|
+ <v-icon left>mdi-refresh</v-icon>
|
|
|
+ 刷新
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearRedisCache({ clear_all_agent_data: true })"
|
|
|
+ >
|
|
|
+ <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
+ 清空所有agent对话数据
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearRedisCache({ cleanup_invalid_refs: true })"
|
|
|
+ >
|
|
|
+ <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
+ 清理无效引用
|
|
|
+ </v-btn>
|
|
|
+ <!-- <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearRedisCache"
|
|
|
+ >
|
|
|
+ <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
+ 清除所有对话缓存
|
|
|
+ </v-btn> -->
|
|
|
+ </template>
|
|
|
+ </v-banner>
|
|
|
+ <v-container>
|
|
|
+ <v-row >
|
|
|
+ <v-col
|
|
|
+ v-for="elevation in elevations"
|
|
|
+ :key="elevation.value"
|
|
|
+ cols="3"
|
|
|
+ >
|
|
|
+ <v-card
|
|
|
+ class="pa-2"
|
|
|
+ tile
|
|
|
+ height="150"
|
|
|
+ >
|
|
|
+ <div class="d-flex align-center justify-center flex-column" style="height: 100%;">
|
|
|
+ <div class="text-h3" :class="`${elevation.textColor}--text`">{{ itemData[elevation.value] }}</div>
|
|
|
+ <div>{{ elevation.text }}</div>
|
|
|
+ </div>
|
|
|
+ </v-card>
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </v-container>
|
|
|
+ </div>
|
|
|
<!-- <v-divider></v-divider> -->
|
|
|
|
|
|
- <v-banner class="mb-3">
|
|
|
- embedding
|
|
|
- <template v-slot:actions>
|
|
|
- <v-btn
|
|
|
- text
|
|
|
- color="primary"
|
|
|
- @click="getEmbeddingStats"
|
|
|
- >
|
|
|
- <v-icon left>mdi-refresh</v-icon>
|
|
|
- 刷新
|
|
|
- </v-btn>
|
|
|
- <v-btn
|
|
|
- text
|
|
|
- color="deep-purple accent-4"
|
|
|
- @click="onClearEmbeddingCache"
|
|
|
- >
|
|
|
- <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
- 清除对话缓存
|
|
|
- </v-btn>
|
|
|
- </template>
|
|
|
- </v-banner>
|
|
|
- <v-container>
|
|
|
- <v-row >
|
|
|
- <v-col
|
|
|
- v-for="elevation in embeddingElevations"
|
|
|
- :key="elevation.value"
|
|
|
- cols="3"
|
|
|
- >
|
|
|
- <v-card
|
|
|
- class="pa-2"
|
|
|
- tile
|
|
|
- height="150"
|
|
|
+ <div v-loading="embLoading">
|
|
|
+ <v-banner class="mb-3">
|
|
|
+ embedding
|
|
|
+ <template v-slot:actions>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="primary"
|
|
|
+ @click="getEmbeddingStats"
|
|
|
+ >
|
|
|
+ <v-icon left>mdi-refresh</v-icon>
|
|
|
+ 刷新
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearEmbeddingCache"
|
|
|
+ >
|
|
|
+ <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
+ 清除对话缓存
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ </v-banner>
|
|
|
+ <v-container>
|
|
|
+ <v-row >
|
|
|
+ <v-col
|
|
|
+ v-for="elevation in embeddingElevations"
|
|
|
+ :key="elevation.value"
|
|
|
+ cols="3"
|
|
|
+ >
|
|
|
+ <v-card
|
|
|
+ class="pa-2"
|
|
|
+ tile
|
|
|
+ height="150"
|
|
|
+ >
|
|
|
+ <div class="d-flex align-center justify-center flex-column" style="height: 100%;">
|
|
|
+ <div class="text-h3" :class="`${elevation.textColor}--text`">{{ embeddingData[elevation.value] }}</div>
|
|
|
+ <div>{{ elevation.text }}</div>
|
|
|
+ </div>
|
|
|
+ </v-card>
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </v-container>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-loading="checkpointLoading">
|
|
|
+ <v-banner class="mb-3">
|
|
|
+ Checkpoint
|
|
|
+ <template v-slot:actions>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="primary"
|
|
|
+ @click="getCheckpoint"
|
|
|
+ >
|
|
|
+ <v-icon left>mdi-refresh</v-icon>
|
|
|
+ 刷新
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearCheckpoint"
|
|
|
>
|
|
|
- <div class="d-flex align-center justify-center flex-column" style="height: 100%;">
|
|
|
- <div class="text-h3" :class="`${elevation.textColor}--text`">{{ embeddingData[elevation.value] }}</div>
|
|
|
- <div>{{ elevation.text }}</div>
|
|
|
- </div>
|
|
|
- </v-card>
|
|
|
- </v-col>
|
|
|
- </v-row>
|
|
|
- </v-container>
|
|
|
+ <v-icon left>mdi-trash-can-outline</v-icon>
|
|
|
+ 清除对话缓存
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ </v-banner>
|
|
|
+ <v-container>
|
|
|
+ <v-row >
|
|
|
+ <v-col
|
|
|
+ v-for="elevation in checkpointElevations"
|
|
|
+ :key="elevation.value"
|
|
|
+ cols="3"
|
|
|
+ >
|
|
|
+ <v-card
|
|
|
+ class="pa-2"
|
|
|
+ tile
|
|
|
+ height="150"
|
|
|
+ >
|
|
|
+ <div class="d-flex align-center justify-center flex-column" style="height: 100%;">
|
|
|
+ <div class="text-h3" :class="`${elevation.textColor}--text`">{{ checkpointData[elevation.value] }}</div>
|
|
|
+ <div>{{ elevation.text }}</div>
|
|
|
+ </div>
|
|
|
+ </v-card>
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </v-container>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <MDialog :visible.sync="show" title="设置保留checkpoint数量" @submit="handleSubmit" widthType="2">
|
|
|
+ <v-text-field
|
|
|
+ v-model="keepCount"
|
|
|
+ dense
|
|
|
+ label="checkpoint数量"
|
|
|
+ placeholder="请输入每个线程保留的checkpoint数量"
|
|
|
+ outlined
|
|
|
+ ></v-text-field>
|
|
|
+ </MDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -94,13 +167,23 @@ import {
|
|
|
getConversationsStatus,
|
|
|
clearConversation,
|
|
|
getEmbeddingStats,
|
|
|
- clearEmbeddingCache
|
|
|
+ clearEmbeddingCache,
|
|
|
+ getCheckpoint,
|
|
|
+ clearCheckpoint
|
|
|
} from '@/api/dataChart'
|
|
|
+import MDialog from '@/components/Dialog'
|
|
|
export default {
|
|
|
name: 'modelHistory',
|
|
|
+ components: {
|
|
|
+ MDialog
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
+ keepCount: 10,
|
|
|
+ show: false,
|
|
|
loading: false,
|
|
|
+ embLoading: false,
|
|
|
+ checkpointLoading: false,
|
|
|
elevations: [
|
|
|
{ value: 'connected_clients', text: '客户端连接数', textColor: 'primary' },
|
|
|
{ value: 'memory_usage_mb', text: 'redis占用内存(M)', textColor: 'primary' },
|
|
@@ -112,12 +195,19 @@ export default {
|
|
|
{ value: 'memory_usage_mb', text: 'embedding占用内存(M)', textColor: 'primary' },
|
|
|
{ value: 'total_count', text: '总数', textColor: 'primary' }
|
|
|
],
|
|
|
- embeddingData: {}
|
|
|
+ checkpointElevations: [
|
|
|
+ { value: 'total_users', text: '用户数量', textColor: 'primary' },
|
|
|
+ { value: 'total_threads', text: '线程总数', textColor: 'primary' },
|
|
|
+ { value: 'total_checkpoints', text: 'total_checkpoints总数', textColor: 'primary' }
|
|
|
+ ],
|
|
|
+ embeddingData: {},
|
|
|
+ checkpointData: {}
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
this.getConversationsStatus()
|
|
|
this.getEmbeddingStats()
|
|
|
+ this.getCheckpoint()
|
|
|
},
|
|
|
methods: {
|
|
|
async getConversationsStatus () {
|
|
@@ -132,22 +222,34 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async getEmbeddingStats () {
|
|
|
- this.loading = true
|
|
|
+ this.embLoading = true
|
|
|
try {
|
|
|
const { data } = await getEmbeddingStats()
|
|
|
this.embeddingData = data
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|
|
|
} finally {
|
|
|
- this.loading = false
|
|
|
+ this.embLoading = false
|
|
|
}
|
|
|
},
|
|
|
- onClearRedisCache () {
|
|
|
- this.$confirm('提示', '确定清除对话缓存吗?').then(async () => {
|
|
|
+ async getCheckpoint () {
|
|
|
+ this.checkpointLoading = true
|
|
|
+ try {
|
|
|
+ const { data } = await getCheckpoint()
|
|
|
+ this.checkpointData = data
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error(error)
|
|
|
+ } finally {
|
|
|
+ this.checkpointLoading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onClearRedisCache (param) {
|
|
|
+ this.$confirm('提示', '确定执行清除吗?').then(async () => {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
- await clearConversation()
|
|
|
+ await clearConversation(param)
|
|
|
this.$snackbar.success('清除成功')
|
|
|
+ this.getConversationsStatus()
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|
|
|
} finally {
|
|
@@ -161,12 +263,31 @@ export default {
|
|
|
try {
|
|
|
await clearEmbeddingCache()
|
|
|
this.$snackbar.success('清除成功')
|
|
|
+ this.getEmbeddingStats()
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|
|
|
} finally {
|
|
|
this.loading = false
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ onClearCheckpoint () {
|
|
|
+ this.show = true
|
|
|
+ this.keepCount = 10
|
|
|
+ },
|
|
|
+ async handleSubmit () {
|
|
|
+ if (!this.keepCount) {
|
|
|
+ this.$snackbar.error('请输入保留的checkpoint数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const { data } = await clearCheckpoint({ keep_count: Number(this.keepCount) })
|
|
|
+ this.$snackbar.success(data.response)
|
|
|
+ this.show = false
|
|
|
+ this.getCheckpoint()
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error(error)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|