feat: 对话日志
This commit is contained in:
parent
86ccb11d94
commit
2422d35a95
@ -221,6 +221,19 @@ const putChatVote: (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对话日志
|
||||||
|
* @param 参数
|
||||||
|
* application_id, history_day
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const getChatLog: (
|
||||||
|
applicaiton_id: String,
|
||||||
|
history_day: number,
|
||||||
|
loading?: Ref<boolean>
|
||||||
|
) => Promise<Result<any>> = (applicaiton_id, history_day, loading) => {
|
||||||
|
return get(`${prefix}/${applicaiton_id}/chat`, { history_day }, loading)
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
getAllAppilcation,
|
getAllAppilcation,
|
||||||
getApplication,
|
getApplication,
|
||||||
@ -236,5 +249,6 @@ export default {
|
|||||||
getAccessToken,
|
getAccessToken,
|
||||||
postAppAuthentication,
|
postAppAuthentication,
|
||||||
getProfile,
|
getProfile,
|
||||||
putChatVote
|
putChatVote,
|
||||||
|
getChatLog
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-table" :class="quickCreate ? 'table-quick-append' : ''">
|
<div class="app-table" :class="quickCreate ? 'table-quick-append' : ''">
|
||||||
<el-table v-bind="$attrs">
|
<el-table :max-height="tableHeight" v-bind="$attrs">
|
||||||
<template #append v-if="quickCreate">
|
<template #append v-if="quickCreate">
|
||||||
<div v-if="showInput">
|
<div v-if="showInput">
|
||||||
<el-input
|
<el-input
|
||||||
@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, nextTick, watch, computed } from 'vue'
|
import { ref, nextTick, watch, computed, onMounted } from 'vue'
|
||||||
defineOptions({ name: 'AppTable' })
|
defineOptions({ name: 'AppTable' })
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -63,6 +63,7 @@ const quickInputRef = ref()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const showInput = ref(false)
|
const showInput = ref(false)
|
||||||
const inputValue = ref('')
|
const inputValue = ref('')
|
||||||
|
const tableHeight = ref(0)
|
||||||
|
|
||||||
watch(showInput, (bool) => {
|
watch(showInput, (bool) => {
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
@ -93,6 +94,15 @@ function handleCurrentChange() {
|
|||||||
emit('changePage')
|
emit('changePage')
|
||||||
}
|
}
|
||||||
defineExpose({})
|
defineExpose({})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
tableHeight.value = window.innerHeight - 300
|
||||||
|
window.onresize = () => {
|
||||||
|
return (() => {
|
||||||
|
tableHeight.value = window.innerHeight - 300
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -18,12 +18,14 @@
|
|||||||
<el-tag v-else class="warning-tag">已停用</el-tag>
|
<el-tag v-else class="warning-tag">已停用</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="active-button" @click.stop>
|
|
||||||
<el-switch />
|
|
||||||
</div>
|
|
||||||
<el-row class="mt-16">
|
<el-row class="mt-16">
|
||||||
<el-col :span="24">
|
<el-col :span="12">
|
||||||
|
<div class="flex">
|
||||||
<el-text type="info">公开访问链接</el-text>
|
<el-text type="info">公开访问链接</el-text>
|
||||||
|
<el-switch class="ml-8" inline-prompt active-text="开" inactive-text="关" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<span class="vertical-middle lighter">
|
<span class="vertical-middle lighter">
|
||||||
{{ shareUrl }}
|
{{ shareUrl }}
|
||||||
@ -33,9 +35,16 @@
|
|||||||
<AppIcon iconName="app-copy"></AppIcon>
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mt-16">
|
||||||
|
<el-button type="primary"><a :href="shareUrl" target="_blank">演示</a></el-button>
|
||||||
|
<el-button @click="openDialog"> 嵌入第三方 </el-button>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="12">
|
<el-col :span="12">
|
||||||
|
<div class="flex">
|
||||||
<el-text type="info">API访问凭据</el-text>
|
<el-text type="info">API访问凭据</el-text>
|
||||||
|
<el-switch class="ml-8" inline-prompt active-text="开" inactive-text="关" />
|
||||||
|
</div>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<span class="vertical-middle lighter">
|
<span class="vertical-middle lighter">
|
||||||
API Key: OGZmZThlZjYyYzU2MWE1OTlkYTVjZTBi
|
API Key: OGZmZThlZjYyYzU2MWE1OTlkYTVjZTBi
|
||||||
@ -45,28 +54,14 @@
|
|||||||
<AppIcon iconName="app-copy"></AppIcon>
|
<AppIcon iconName="app-copy"></AppIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
|
||||||
<span class="vertical-middle lighter"> API Secret: ************** </span>
|
|
||||||
<span>
|
|
||||||
<el-button type="primary" text>
|
|
||||||
<AppIcon iconName="app-copy"></AppIcon>
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
<el-button type="primary" text>
|
|
||||||
<AppIcon iconName="app-hide-password" />
|
|
||||||
</el-button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</el-col> -->
|
|
||||||
</el-row>
|
|
||||||
<div class="mt-16">
|
<div class="mt-16">
|
||||||
<el-button type="primary"><a :href="shareUrl" target="_blank">演示</a></el-button>
|
<el-button @click="openDialog"> 获取密钥 </el-button>
|
||||||
<el-button @click="openDialog"> 嵌入第三方 </el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
<EmbedDialog ref="EmbedDialogRef"/>
|
<EmbedDialog ref="EmbedDialogRef" />
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -79,15 +74,16 @@ import useStore from '@/stores'
|
|||||||
const { application } = useStore()
|
const { application } = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const {
|
||||||
|
params: { id }
|
||||||
|
} = route as any
|
||||||
|
|
||||||
|
|
||||||
const EmbedDialogRef = ref()
|
const EmbedDialogRef = ref()
|
||||||
const shareUrl = ref('')
|
const shareUrl = ref('')
|
||||||
const accessToken = ref('')
|
const accessToken = ref('')
|
||||||
const detail = ref<any>(null)
|
const detail = ref<any>(null)
|
||||||
const apiKey = ref<any>(null)
|
const apiKey = ref<any>(null)
|
||||||
const {
|
|
||||||
params: { id }
|
|
||||||
} = route as any
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@ -95,7 +91,7 @@ function openDialog() {
|
|||||||
EmbedDialogRef.value.open(accessToken.value)
|
EmbedDialogRef.value.open(accessToken.value)
|
||||||
}
|
}
|
||||||
function getAccessToken() {
|
function getAccessToken() {
|
||||||
application.asyncGetAccessToken(id, loading).then((res) => {
|
application.asyncGetAccessToken(id, loading).then((res: any) => {
|
||||||
accessToken.value = res?.data?.access_token
|
accessToken.value = res?.data?.access_token
|
||||||
shareUrl.value = application.location + res?.data?.access_token
|
shareUrl.value = application.location + res?.data?.access_token
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,8 +1,111 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<LayoutContainer header="对话日志">
|
||||||
对话日志
|
<div class="p-24">
|
||||||
|
<div class="mb-16">
|
||||||
|
<el-select v-model="history_day" class="mr-12">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dayOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-input v-model="search" placeholder="搜索" prefix-icon="Search" style="width: 240px" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<app-table
|
||||||
|
:data="tableData"
|
||||||
|
:pagination-config="paginationConfig"
|
||||||
|
@sizeChange="handleSizeChange"
|
||||||
|
@changePage="handleCurrentChange"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-table-column prop="abstract" label="摘要" />
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="mark_sum" label="改进标注" align="right" />
|
||||||
|
<el-table-column label="时间" width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ datetimeFormat(row.create_time) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" width="70" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tooltip effect="dark" content="删除" placement="top">
|
||||||
|
<el-button type="primary" text>
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</app-table>
|
||||||
|
</div>
|
||||||
|
</LayoutContainer>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, reactive } from 'vue'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import applicationApi from '@/api/application'
|
||||||
|
import { datetimeFormat } from '@/utils/time'
|
||||||
|
const route = useRoute()
|
||||||
|
const {
|
||||||
|
params: { id }
|
||||||
|
} = route
|
||||||
|
|
||||||
|
const dayOptions = [
|
||||||
|
{
|
||||||
|
value: 7,
|
||||||
|
label: '过去7天'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 30,
|
||||||
|
label: '过去30天'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 90,
|
||||||
|
label: '过去90天'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 188,
|
||||||
|
label: '过去半年'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const loading = ref(false)
|
||||||
|
const paginationConfig = reactive({
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
const tableData = ref([])
|
||||||
|
const history_day = ref(7)
|
||||||
|
const search = ref('')
|
||||||
|
|
||||||
|
function handleSizeChange(val: number) {
|
||||||
|
console.log(`${val} items per page`)
|
||||||
|
}
|
||||||
|
function handleCurrentChange(val: number) {
|
||||||
|
console.log(`current page: ${val}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
applicationApi.getChatLog(id as string, history_day.value, loading).then((res) => {
|
||||||
|
tableData.value = res.data
|
||||||
|
paginationConfig.total = res.data.length
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@ -28,7 +28,6 @@
|
|||||||
@creatQuick="creatQuickHandle"
|
@creatQuick="creatQuickHandle"
|
||||||
@row-click="rowClickHandle"
|
@row-click="rowClickHandle"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:max-height="tableHeight"
|
|
||||||
>
|
>
|
||||||
<el-table-column prop="name" label="文件名称" min-width="280">
|
<el-table-column prop="name" label="文件名称" min-width="280">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@ -115,7 +114,6 @@ const loading = ref(false)
|
|||||||
const filterText = ref('')
|
const filterText = ref('')
|
||||||
const documentData = ref<any[]>([])
|
const documentData = ref<any[]>([])
|
||||||
const currentMouseId = ref(null)
|
const currentMouseId = ref(null)
|
||||||
const tableHeight = ref(0)
|
|
||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -229,12 +227,6 @@ function getList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tableHeight.value = window.innerHeight - 300
|
|
||||||
window.onresize = () => {
|
|
||||||
return (() => {
|
|
||||||
tableHeight.value = window.innerHeight - 300
|
|
||||||
})()
|
|
||||||
}
|
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user