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="请输入" 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'
}) })
inputValue.value = ''
applicationApi.postChatMessage(chartOpenId.value, problem_text).then(async (response) => { applicationApi.postChatMessage(chartOpenId.value, problem_text).then(async (response) => {
inputValue.value = ''
const row = chatList.value.find((item) => item.id === id) const row = chatList.value.find((item) => item.id === id)
if (row) { if (row) {

View File

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

View File

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