UnisKB/ui/src/components/ai-chat/LogOperationButton.vue

72 lines
2.0 KiB
Vue
Raw Normal View History

2023-12-07 11:28:38 +00:00
<template>
2023-12-12 09:07:34 +00:00
<div>
<el-text type="info">
消耗: {{ data?.message_tokens + data?.answer_tokens }} tokens
<span class="ml-4">{{ datetimeFormat(data.create_time) }}</span>
</el-text>
</div>
2023-12-07 11:28:38 +00:00
<div>
2023-12-14 03:33:35 +00:00
<el-tooltip effect="dark" content="复制" placement="top">
<el-button text @click="copyClick(data?.answer_text)">
<AppIcon iconName="app-copy"></AppIcon>
</el-button>
</el-tooltip>
<el-divider direction="vertical" />
2023-12-07 11:28:38 +00:00
<el-tooltip effect="dark" content="修改内容" placement="top">
<el-button text @click="editContent(data)">
<el-icon><EditPen /></el-icon>
</el-button>
</el-tooltip>
<el-divider direction="vertical" />
2023-12-14 03:33:35 +00:00
<el-tooltip effect="dark" content="修改历史" placement="top">
<el-button text @click="editContent(data)">
<el-icon><Document /></el-icon>
2023-12-07 11:28:38 +00:00
</el-button>
</el-tooltip>
<el-divider direction="vertical" v-if="buttonData?.vote_status !== '-1'" />
<el-button text disabled v-if="buttonData?.vote_status === '0'">
2023-12-14 03:33:35 +00:00
<AppIcon iconName="app-like-color" class="primary"></AppIcon>
2023-12-07 11:28:38 +00:00
</el-button>
<el-button text disabled v-if="buttonData?.vote_status === '1'">
<AppIcon iconName="app-oppose-color"></AppIcon>
</el-button>
2023-12-12 08:00:54 +00:00
<EditContentDialog ref="EditContentDialogRef" />
2023-12-07 11:28:38 +00:00
</div>
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue'
import { copyClick } from '@/utils/clipboard'
import EditContentDialog from '@/views/log/component/EditContentDialog.vue'
2023-12-12 09:07:34 +00:00
import { datetimeFormat } from '@/utils/time'
2023-12-07 11:28:38 +00:00
const props = defineProps({
data: {
type: Object,
default: () => {}
},
applicationId: {
type: String,
default: ''
},
log: Boolean
})
const emit = defineEmits(['update:data'])
const EditContentDialogRef = ref()
const buttonData = ref(props.data)
const loading = ref(false)
function editContent(data: any) {
EditContentDialogRef.value.open(data)
}
2023-12-12 08:00:54 +00:00
// function updateContent(data: any) {
// emit('update:data', data)
// }
2023-12-07 11:28:38 +00:00
</script>
<style lang="scss" scoped></style>