Merge branch 'main' of github.com:maxkb-dev/maxkb
This commit is contained in:
commit
ddb7344828
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,6 @@
|
|||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
:autosize="{ minRows: 1, maxRows: 8 }"
|
:autosize="{ minRows: 1, maxRows: 8 }"
|
||||||
@keydown.enter="sendChatHandle($event)"
|
@keydown.enter="sendChatHandle($event)"
|
||||||
:disabled="loading"
|
|
||||||
/>
|
/>
|
||||||
<div class="operate">
|
<div class="operate">
|
||||||
<el-button
|
<el-button
|
||||||
@ -168,7 +167,7 @@ function sendChatHandle(event: any) {
|
|||||||
if (!event.ctrlKey) {
|
if (!event.ctrlKey) {
|
||||||
// 如果没有按下组合键ctrl,则会阻止默认事件
|
// 如果没有按下组合键ctrl,则会阻止默认事件
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
if (!isDisabledChart.value) {
|
if (!isDisabledChart.value && !loading.value) {
|
||||||
chatMessage()
|
chatMessage()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -237,8 +236,8 @@ function chatMessage() {
|
|||||||
record_id: '',
|
record_id: '',
|
||||||
vote_status: '-1'
|
vote_status: '-1'
|
||||||
})
|
})
|
||||||
applicationApi.postChatMessage(chartOpenId.value, problem_text).then(async (response) => {
|
|
||||||
inputValue.value = ''
|
inputValue.value = ''
|
||||||
|
applicationApi.postChatMessage(chartOpenId.value, problem_text).then(async (response) => {
|
||||||
const row = chatList.value.find((item) => item.id === id)
|
const row = chatList.value.find((item) => item.id === id)
|
||||||
|
|
||||||
if (row) {
|
if (row) {
|
||||||
|
|||||||
@ -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,25 +54,11 @@
|
|||||||
<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" />
|
||||||
@ -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,119 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<LayoutContainer header="对话日志">
|
||||||
|
<div class="p-24">
|
||||||
|
<div class="mb-16">
|
||||||
|
<el-select v-model="history_day" class="mr-12" @change="changeHandle">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<app-table
|
||||||
|
:data="dataList"
|
||||||
|
:pagination-config="paginationConfig"
|
||||||
|
@sizeChange="handleSizeChange"
|
||||||
|
v-loading="loading"
|
||||||
|
>
|
||||||
|
<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>
|
<div>
|
||||||
对话日志
|
<AppIcon iconName="app-like-color"></AppIcon>
|
||||||
|
{{ row.star_num }}
|
||||||
|
<AppIcon iconName="app-oppose-color"></AppIcon>
|
||||||
|
{{ row.trample_num }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</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>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted, reactive, computed } 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('')
|
||||||
|
|
||||||
|
const dataList = computed(() =>
|
||||||
|
tableData.value.slice(
|
||||||
|
(paginationConfig.currentPage - 1) * paginationConfig.pageSize,
|
||||||
|
paginationConfig.currentPage * paginationConfig.pageSize
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
function handleSizeChange() {
|
||||||
|
paginationConfig.currentPage = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeHandle(val: number) {
|
||||||
|
history_day.value = val
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
||||||
|
|||||||
@ -18,17 +18,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<app-table
|
<app-table
|
||||||
class="mt-16"
|
class="mt-16"
|
||||||
:data="documentData"
|
:data="dataList"
|
||||||
:pagination-config="paginationConfig"
|
:pagination-config="paginationConfig"
|
||||||
quick-create
|
quick-create
|
||||||
@sizeChange="handleSizeChange"
|
@sizeChange="handleSizeChange"
|
||||||
@changePage="handleCurrentChange"
|
|
||||||
@cell-mouse-enter="cellMouseEnter"
|
@cell-mouse-enter="cellMouseEnter"
|
||||||
@cell-mouse-leave="cellMouseLeave"
|
@cell-mouse-leave="cellMouseLeave"
|
||||||
@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 }">
|
||||||
@ -99,7 +97,7 @@
|
|||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive } from 'vue'
|
import { ref, onMounted, reactive,computed } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import documentApi from '@/api/document'
|
import documentApi from '@/api/document'
|
||||||
import { toThousands } from '@/utils/utils'
|
import { toThousands } from '@/utils/utils'
|
||||||
@ -115,7 +113,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,
|
||||||
@ -123,6 +120,13 @@ const paginationConfig = reactive({
|
|||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const dataList = computed(() =>
|
||||||
|
documentData.value.slice(
|
||||||
|
(paginationConfig.currentPage - 1) * paginationConfig.pageSize,
|
||||||
|
paginationConfig.currentPage * paginationConfig.pageSize
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
function rowClickHandle(row: any) {
|
function rowClickHandle(row: any) {
|
||||||
router.push({ path: `/dataset/${id}/${row.id}` })
|
router.push({ path: `/dataset/${id}/${row.id}` })
|
||||||
}
|
}
|
||||||
@ -207,11 +211,8 @@ function cellMouseLeave() {
|
|||||||
currentMouseId.value = null
|
currentMouseId.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSizeChange(val: number) {
|
function handleSizeChange() {
|
||||||
console.log(`${val} items per page`)
|
paginationConfig.currentPage = 1
|
||||||
}
|
|
||||||
function handleCurrentChange(val: number) {
|
|
||||||
console.log(`current page: ${val}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
@ -229,12 +230,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