mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
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 {
|
||||
getAllAppilcation,
|
||||
getApplication,
|
||||
|
|
@ -236,5 +249,6 @@ export default {
|
|||
getAccessToken,
|
||||
postAppAuthentication,
|
||||
getProfile,
|
||||
putChatVote
|
||||
putChatVote,
|
||||
getChatLog
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@
|
|||
placeholder="请输入"
|
||||
:autosize="{ minRows: 1, maxRows: 8 }"
|
||||
@keydown.enter="sendChatHandle($event)"
|
||||
:disabled="loading"
|
||||
/>
|
||||
<div class="operate">
|
||||
<el-button
|
||||
|
|
@ -168,7 +167,7 @@ function sendChatHandle(event: any) {
|
|||
if (!event.ctrlKey) {
|
||||
// 如果没有按下组合键ctrl,则会阻止默认事件
|
||||
event.preventDefault()
|
||||
if (!isDisabledChart.value) {
|
||||
if (!isDisabledChart.value && !loading.value) {
|
||||
chatMessage()
|
||||
}
|
||||
} else {
|
||||
|
|
@ -237,8 +236,8 @@ function chatMessage() {
|
|||
record_id: '',
|
||||
vote_status: '-1'
|
||||
})
|
||||
inputValue.value = ''
|
||||
applicationApi.postChatMessage(chartOpenId.value, problem_text).then(async (response) => {
|
||||
inputValue.value = ''
|
||||
const row = chatList.value.find((item) => item.id === id)
|
||||
|
||||
if (row) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<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">
|
||||
<div v-if="showInput">
|
||||
<el-input
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, watch, computed } from 'vue'
|
||||
import { ref, nextTick, watch, computed, onMounted } from 'vue'
|
||||
defineOptions({ name: 'AppTable' })
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -63,6 +63,7 @@ const quickInputRef = ref()
|
|||
const loading = ref(false)
|
||||
const showInput = ref(false)
|
||||
const inputValue = ref('')
|
||||
const tableHeight = ref(0)
|
||||
|
||||
watch(showInput, (bool) => {
|
||||
if (!bool) {
|
||||
|
|
@ -93,6 +94,15 @@ function handleCurrentChange() {
|
|||
emit('changePage')
|
||||
}
|
||||
defineExpose({})
|
||||
|
||||
onMounted(() => {
|
||||
tableHeight.value = window.innerHeight - 300
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
tableHeight.value = window.innerHeight - 300
|
||||
})()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
<el-tag v-else class="warning-tag">已停用</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="active-button" @click.stop>
|
||||
<el-switch />
|
||||
</div>
|
||||
|
||||
<el-row class="mt-16">
|
||||
<el-col :span="24">
|
||||
<el-text type="info">公开访问链接</el-text>
|
||||
<el-col :span="12">
|
||||
<div class="flex">
|
||||
<el-text type="info">公开访问链接</el-text>
|
||||
<el-switch class="ml-8" inline-prompt active-text="开" inactive-text="关" />
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<span class="vertical-middle lighter">
|
||||
{{ shareUrl }}
|
||||
|
|
@ -33,40 +35,33 @@
|
|||
<AppIcon iconName="app-copy"></AppIcon>
|
||||
</el-button>
|
||||
</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 :span="12">
|
||||
<el-text type="info">API访问凭据</el-text>
|
||||
<el-col :span="12">
|
||||
<div class="flex">
|
||||
<el-text type="info">API访问凭据</el-text>
|
||||
<el-switch class="ml-8" inline-prompt active-text="开" inactive-text="关" />
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<span class="vertical-middle lighter">
|
||||
API Key: OGZmZThlZjYyYzU2MWE1OTlkYTVjZTBi
|
||||
</span>
|
||||
|
||||
<el-button type="primary" text>
|
||||
<AppIcon iconName="app-copy"></AppIcon>
|
||||
<AppIcon iconName="app-copy"></AppIcon>
|
||||
</el-button>
|
||||
</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 class="mt-16">
|
||||
<el-button @click="openDialog"> 获取密钥 </el-button>
|
||||
</div>
|
||||
</el-col> -->
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="mt-16">
|
||||
<el-button type="primary"><a :href="shareUrl" target="_blank">演示</a></el-button>
|
||||
<el-button @click="openDialog"> 嵌入第三方 </el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<EmbedDialog ref="EmbedDialogRef"/>
|
||||
<EmbedDialog ref="EmbedDialogRef" />
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -79,15 +74,16 @@ import useStore from '@/stores'
|
|||
const { application } = useStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }
|
||||
} = route as any
|
||||
|
||||
|
||||
const EmbedDialogRef = ref()
|
||||
const shareUrl = ref('')
|
||||
const accessToken = ref('')
|
||||
const detail = ref<any>(null)
|
||||
const apiKey = ref<any>(null)
|
||||
const {
|
||||
params: { id }
|
||||
} = route as any
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
@ -95,7 +91,7 @@ function openDialog() {
|
|||
EmbedDialogRef.value.open(accessToken.value)
|
||||
}
|
||||
function getAccessToken() {
|
||||
application.asyncGetAccessToken(id, loading).then((res) => {
|
||||
application.asyncGetAccessToken(id, loading).then((res: any) => {
|
||||
accessToken.value = res?.data?.access_token
|
||||
shareUrl.value = application.location + res?.data?.access_token
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,8 +1,119 @@
|
|||
<template>
|
||||
<div>
|
||||
对话日志
|
||||
</div>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -18,17 +18,15 @@
|
|||
</div>
|
||||
<app-table
|
||||
class="mt-16"
|
||||
:data="documentData"
|
||||
:data="dataList"
|
||||
:pagination-config="paginationConfig"
|
||||
quick-create
|
||||
@sizeChange="handleSizeChange"
|
||||
@changePage="handleCurrentChange"
|
||||
@cell-mouse-enter="cellMouseEnter"
|
||||
@cell-mouse-leave="cellMouseLeave"
|
||||
@creatQuick="creatQuickHandle"
|
||||
@row-click="rowClickHandle"
|
||||
v-loading="loading"
|
||||
:max-height="tableHeight"
|
||||
>
|
||||
<el-table-column prop="name" label="文件名称" min-width="280">
|
||||
<template #default="{ row }">
|
||||
|
|
@ -99,7 +97,7 @@
|
|||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { ref, onMounted, reactive,computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import documentApi from '@/api/document'
|
||||
import { toThousands } from '@/utils/utils'
|
||||
|
|
@ -115,7 +113,6 @@ const loading = ref(false)
|
|||
const filterText = ref('')
|
||||
const documentData = ref<any[]>([])
|
||||
const currentMouseId = ref(null)
|
||||
const tableHeight = ref(0)
|
||||
|
||||
const paginationConfig = reactive({
|
||||
currentPage: 1,
|
||||
|
|
@ -123,6 +120,13 @@ const paginationConfig = reactive({
|
|||
total: 0
|
||||
})
|
||||
|
||||
const dataList = computed(() =>
|
||||
documentData.value.slice(
|
||||
(paginationConfig.currentPage - 1) * paginationConfig.pageSize,
|
||||
paginationConfig.currentPage * paginationConfig.pageSize
|
||||
)
|
||||
)
|
||||
|
||||
function rowClickHandle(row: any) {
|
||||
router.push({ path: `/dataset/${id}/${row.id}` })
|
||||
}
|
||||
|
|
@ -207,11 +211,8 @@ function cellMouseLeave() {
|
|||
currentMouseId.value = null
|
||||
}
|
||||
|
||||
function handleSizeChange(val: number) {
|
||||
console.log(`${val} items per page`)
|
||||
}
|
||||
function handleCurrentChange(val: number) {
|
||||
console.log(`current page: ${val}`)
|
||||
function handleSizeChange() {
|
||||
paginationConfig.currentPage = 1
|
||||
}
|
||||
|
||||
function getList() {
|
||||
|
|
@ -229,12 +230,6 @@ function getList() {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
tableHeight.value = window.innerHeight - 300
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
tableHeight.value = window.innerHeight - 300
|
||||
})()
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue