feat: 历史日志

This commit is contained in:
wangdan-fit2cloud 2023-12-05 14:27:50 +08:00
parent 2422d35a95
commit edabc20ae9
3 changed files with 30 additions and 20 deletions

View File

@ -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) {

View File

@ -2,7 +2,7 @@
<LayoutContainer header="对话日志">
<div class="p-24">
<div class="mb-16">
<el-select v-model="history_day" class="mr-12">
<el-select v-model="history_day" class="mr-12" @change="changeHandle">
<el-option
v-for="item in dayOptions"
:key="item.value"
@ -14,11 +14,10 @@
</div>
<app-table
:data="tableData"
:data="dataList"
:pagination-config="paginationConfig"
@sizeChange="handleSizeChange"
@changePage="handleCurrentChange"
v-loading="loading"
>
<el-table-column prop="abstract" label="摘要" />
<el-table-column prop="chat_record_count" label="对话提问数" align="right" />
@ -53,7 +52,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 applicationApi from '@/api/application'
import { datetimeFormat } from '@/utils/time'
@ -90,11 +89,20 @@ const tableData = ref([])
const history_day = ref(7)
const search = ref('')
function handleSizeChange(val: number) {
console.log(`${val} items per page`)
const dataList = computed(() =>
tableData.value.slice(
(paginationConfig.currentPage - 1) * paginationConfig.pageSize,
paginationConfig.currentPage * paginationConfig.pageSize
)
)
function handleSizeChange() {
paginationConfig.currentPage = 1
}
function handleCurrentChange(val: number) {
console.log(`current page: ${val}`)
function changeHandle(val: number) {
history_day.value = val
getList()
}
function getList() {

View File

@ -18,11 +18,10 @@
</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"
@ -98,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'
@ -121,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}` })
}
@ -205,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() {