|
@@ -1,15 +1,175 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
+ <div class="white content">
|
|
|
+ <div v-loading="loading">
|
|
|
+ <v-banner class="mb-3">
|
|
|
+ Redis
|
|
|
+ <template v-slot:actions>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="primary"
|
|
|
+ @click="getConversationsStatus"
|
|
|
+ >
|
|
|
+ 刷新
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearRedisCache"
|
|
|
+ >
|
|
|
+ 清除对话缓存
|
|
|
+ </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="200"
|
|
|
+ >
|
|
|
+ <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-divider></v-divider> -->
|
|
|
|
|
|
+ <v-banner class="mb-3">
|
|
|
+ embedding
|
|
|
+ <template v-slot:actions>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="primary"
|
|
|
+ @click="getEmbeddingStats"
|
|
|
+ >
|
|
|
+ 刷新
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ text
|
|
|
+ color="deep-purple accent-4"
|
|
|
+ @click="onClearEmbeddingCache"
|
|
|
+ >
|
|
|
+ 清除对话缓存
|
|
|
+ </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="200"
|
|
|
+ >
|
|
|
+ <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>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {
|
|
|
+ getConversationsStatus,
|
|
|
+ clearConversation,
|
|
|
+ getEmbeddingStats,
|
|
|
+ clearEmbeddingCache
|
|
|
+} from '@/api/dataChart'
|
|
|
export default {
|
|
|
- name: 'modelHistory'
|
|
|
+ name: 'modelHistory',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ elevations: [
|
|
|
+ { value: 'connected_clients', text: '客户端连接数', textColor: 'primary' },
|
|
|
+ { value: 'memory_usage_mb', text: 'redis占用内存(M)', textColor: 'primary' },
|
|
|
+ { value: 'total_conversations', text: '会话总数', textColor: 'primary' },
|
|
|
+ { value: 'total_users', text: '用户数', textColor: 'primary' }
|
|
|
+ ],
|
|
|
+ itemData: {},
|
|
|
+ embeddingElevations: [
|
|
|
+ { value: 'memory_usage_mb', text: 'embedding占用内存(M)', textColor: 'primary' },
|
|
|
+ { value: 'total_count', text: '总数', textColor: 'primary' }
|
|
|
+ ],
|
|
|
+ embeddingData: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.getConversationsStatus()
|
|
|
+ this.getEmbeddingStats()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getConversationsStatus () {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ const { data } = await getConversationsStatus()
|
|
|
+ this.itemData = { ...data, ...data.redis_info }
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getEmbeddingStats () {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ const { data } = await getEmbeddingStats()
|
|
|
+ this.embeddingData = data
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onClearRedisCache () {
|
|
|
+ this.$confirm('提示', '确定清除对话缓存吗?').then(async () => {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ await clearConversation()
|
|
|
+ this.$snackbar.success('清除成功')
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onClearEmbeddingCache () {
|
|
|
+ this.$confirm('提示', '确定清除embedding缓存吗?').then(async () => {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ await clearEmbeddingCache()
|
|
|
+ this.$snackbar.success('清除成功')
|
|
|
+ } catch (error) {
|
|
|
+ this.$snackbar.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
+.content {
|
|
|
+ font-size: 16px;
|
|
|
+}
|
|
|
</style>
|