feat: chat log
This commit is contained in:
parent
e9527bdd2b
commit
238821e96b
95
ui/src/components/card-checkbox/index.vue
Normal file
95
ui/src/components/card-checkbox/index.vue
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<template>
|
||||||
|
<el-card
|
||||||
|
shadow="hover"
|
||||||
|
class="card-checkbox cursor"
|
||||||
|
:class="modelValue.includes(toModelValue) ? 'active' : ''"
|
||||||
|
@click="checked"
|
||||||
|
>
|
||||||
|
<div class="flex-between">
|
||||||
|
<div class="flex align-center">
|
||||||
|
<slot name="icon">
|
||||||
|
<KnowledgeIcon :type="data.type" />
|
||||||
|
</slot>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
<el-checkbox v-bind:modelValue="modelValue.includes(toModelValue)" @change="checkboxChange">
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import KnowledgeIcon from '@/views/knowledge/component/KnowledgeIcon.vue'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
defineOptions({ name: 'CardCheckbox' })
|
||||||
|
const props = defineProps<{
|
||||||
|
data: any
|
||||||
|
|
||||||
|
modelValue: Array<any>
|
||||||
|
|
||||||
|
valueField?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const toModelValue = computed(() => (props.valueField ? props.data[props.valueField] : props.data))
|
||||||
|
|
||||||
|
// const isChecked = computed({
|
||||||
|
// get: () => props.modelValue.includes(toModelValue.value)),
|
||||||
|
// set: (val) => val
|
||||||
|
// })
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue', 'change'])
|
||||||
|
|
||||||
|
const checked = () => {
|
||||||
|
const value = props.modelValue ? props.modelValue : []
|
||||||
|
if (props.modelValue.includes(toModelValue.value)) {
|
||||||
|
emit(
|
||||||
|
'update:modelValue',
|
||||||
|
value.filter((item) => item !== toModelValue.value),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
emit('update:modelValue', [...value, toModelValue.value])
|
||||||
|
}
|
||||||
|
checkboxChange()
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkboxChange() {
|
||||||
|
emit('change')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.card-checkbox {
|
||||||
|
&.active {
|
||||||
|
border: 1px solid var(--el-color-primary);
|
||||||
|
}
|
||||||
|
input.checkbox[type='checkbox'] {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
height: 14px;
|
||||||
|
width: 14px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
background-color: white;
|
||||||
|
color: #000;
|
||||||
|
height: 13px;
|
||||||
|
width: 13px;
|
||||||
|
visibility: visible;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: var(--el-border);
|
||||||
|
border-radius: var(--el-border-radius-small);
|
||||||
|
box-sizing: content-box;
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
&:checked::after {
|
||||||
|
content: '✓';
|
||||||
|
color: #ffffff;
|
||||||
|
border-color: var(--el-color-primary);
|
||||||
|
background: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -20,6 +20,7 @@ import MdEditor from './markdown/MdEditor.vue'
|
|||||||
import MdPreview from './markdown/MdPreview.vue'
|
import MdPreview from './markdown/MdPreview.vue'
|
||||||
import MdEditorMagnify from './markdown/MdEditorMagnify.vue'
|
import MdEditorMagnify from './markdown/MdEditorMagnify.vue'
|
||||||
import TagEllipsis from './tag-ellipsis/index.vue'
|
import TagEllipsis from './tag-ellipsis/index.vue'
|
||||||
|
import CardCheckbox from './card-checkbox/index.vue'
|
||||||
export default {
|
export default {
|
||||||
install(app: App) {
|
install(app: App) {
|
||||||
app.component('LogoFull', LogoFull)
|
app.component('LogoFull', LogoFull)
|
||||||
@ -43,5 +44,6 @@ export default {
|
|||||||
app.component('MdEditor', MdEditor)
|
app.component('MdEditor', MdEditor)
|
||||||
app.component('MdEditorMagnify', MdEditorMagnify)
|
app.component('MdEditorMagnify', MdEditorMagnify)
|
||||||
app.component('TagEllipsis', TagEllipsis)
|
app.component('TagEllipsis', TagEllipsis)
|
||||||
|
app.component('CardCheckbox', CardCheckbox)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,7 +64,7 @@ const ApplicationDetailRouter = {
|
|||||||
icon: 'app-document',
|
icon: 'app-document',
|
||||||
iconActive: 'app-document-active',
|
iconActive: 'app-document-active',
|
||||||
title: 'views.chatLog.title',
|
title: 'views.chatLog.title',
|
||||||
active: 'log',
|
active: 'chat-log',
|
||||||
parentPath: '/application/:id/:type',
|
parentPath: '/application/:id/:type',
|
||||||
parentName: 'ApplicationDetail'
|
parentName: 'ApplicationDetail'
|
||||||
},
|
},
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const useApplicationStore = defineStore('application', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
async asyncGetApplicationDataset(id: string, loading?: Ref<boolean>) {
|
async asyncGetApplicationKnowledge(id: string, loading?: Ref<boolean>) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
applicationApi
|
applicationApi
|
||||||
.getApplicationDataset(id, loading)
|
.getApplicationDataset(id, loading)
|
||||||
|
|||||||
@ -424,8 +424,8 @@ function mapToUrlParams(map: any[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDetail()
|
// getDetail()
|
||||||
getAccessToken()
|
// getAccessToken()
|
||||||
// changeDayHandle(history_day.value)
|
// changeDayHandle(history_day.value)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -89,118 +89,127 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
<div v-loading.fullscreen.lock="paginationConfig.current_page === 1 && loading">
|
||||||
<el-row v-if="applicationList.length > 0" :gutter="15">
|
<InfiniteScroll
|
||||||
<template v-for="(item, index) in applicationList" :key="index">
|
:size="applicationList.length"
|
||||||
<el-col
|
:total="paginationConfig.total"
|
||||||
v-if="item.resource_type === 'folder'"
|
:page_size="paginationConfig.page_size"
|
||||||
:xs="24"
|
v-model:current_page="paginationConfig.current_page"
|
||||||
:sm="12"
|
@load="getList"
|
||||||
:md="12"
|
:loading="loading"
|
||||||
:lg="8"
|
>
|
||||||
:xl="6"
|
<el-row v-if="applicationList.length > 0" :gutter="15">
|
||||||
class="mb-16"
|
<template v-for="(item, index) in applicationList" :key="index">
|
||||||
>
|
<el-col
|
||||||
<CardBox
|
v-if="item.resource_type === 'folder'"
|
||||||
:title="item.name"
|
:xs="24"
|
||||||
:description="item.desc || $t('common.noData')"
|
:sm="12"
|
||||||
class="cursor"
|
:md="12"
|
||||||
|
:lg="8"
|
||||||
|
:xl="6"
|
||||||
|
class="mb-16"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<CardBox
|
||||||
<el-avatar shape="square" :size="32" style="background: none">
|
:title="item.name"
|
||||||
<AppIcon iconName="app-folder" style="font-size: 32px"></AppIcon>
|
:description="item.desc || $t('common.noData')"
|
||||||
</el-avatar>
|
class="cursor"
|
||||||
</template>
|
>
|
||||||
<template #subTitle>
|
<template #icon>
|
||||||
<el-text class="color-secondary lighter" size="small">
|
<el-avatar shape="square" :size="32" style="background: none">
|
||||||
{{ $t('common.creator') }}: {{ item.username }}
|
<AppIcon iconName="app-folder" style="font-size: 32px"></AppIcon>
|
||||||
</el-text>
|
</el-avatar>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
<template #subTitle>
|
||||||
</el-col>
|
<el-text class="color-secondary lighter" size="small">
|
||||||
<el-col v-else :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="mb-16">
|
|
||||||
<CardBox
|
|
||||||
:title="item.name"
|
|
||||||
:description="item.desc"
|
|
||||||
class="cursor"
|
|
||||||
@click="router.push({ path: `/application/${item.id}/${item.type}/overview` })"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<LogoIcon height="28px" style="width: 28px; height: 28px; display: block" />
|
|
||||||
</template>
|
|
||||||
<template #subTitle>
|
|
||||||
<el-text class="color-secondary" size="small">
|
|
||||||
<auto-tooltip :content="item.username">
|
|
||||||
{{ $t('common.creator') }}: {{ item.username }}
|
{{ $t('common.creator') }}: {{ item.username }}
|
||||||
</auto-tooltip>
|
</el-text>
|
||||||
</el-text>
|
</template>
|
||||||
</template>
|
</CardBox>
|
||||||
<template #tag>
|
</el-col>
|
||||||
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px">
|
<el-col v-else :xs="24" :sm="12" :md="12" :lg="8" :xl="6" class="mb-16">
|
||||||
{{ $t('views.application.workflow') }}
|
<CardBox
|
||||||
</el-tag>
|
:title="item.name"
|
||||||
<el-tag class="blue-tag" v-else style="height: 22px">
|
:description="item.desc"
|
||||||
{{ $t('views.application.simple') }}
|
class="cursor"
|
||||||
</el-tag>
|
@click="router.push({ path: `/application/${item.id}/${item.type}/overview` })"
|
||||||
</template>
|
>
|
||||||
|
<template #icon>
|
||||||
|
<LogoIcon height="28px" style="width: 28px; height: 28px; display: block" />
|
||||||
|
</template>
|
||||||
|
<template #subTitle>
|
||||||
|
<el-text class="color-secondary" size="small">
|
||||||
|
<auto-tooltip :content="item.username">
|
||||||
|
{{ $t('common.creator') }}: {{ item.username }}
|
||||||
|
</auto-tooltip>
|
||||||
|
</el-text>
|
||||||
|
</template>
|
||||||
|
<template #tag>
|
||||||
|
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px">
|
||||||
|
{{ $t('views.application.workflow') }}
|
||||||
|
</el-tag>
|
||||||
|
<el-tag class="blue-tag" v-else style="height: 22px">
|
||||||
|
{{ $t('views.application.simple') }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div v-if="item.is_publish" class="flex align-center">
|
<div v-if="item.is_publish" class="flex align-center">
|
||||||
<el-icon class="color-success mr-8" style="font-size: 16px">
|
<el-icon class="color-success mr-8" style="font-size: 16px">
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="color-secondary">
|
<span class="color-secondary">
|
||||||
{{ $t('views.application.status.published') }}
|
{{ $t('views.application.status.published') }}
|
||||||
</span>
|
</span>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
<el-icon class="mr-8"><Clock /></el-icon>
|
<el-icon class="mr-8"><Clock /></el-icon>
|
||||||
<span class="color-secondary">{{ dateFormat(item.update_time) }}</span>
|
<span class="color-secondary">{{ dateFormat(item.update_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="flex align-center">
|
<div v-else class="flex align-center">
|
||||||
<AppIcon iconName="app-disabled" class="color-secondary mr-8"></AppIcon>
|
<AppIcon iconName="app-disabled" class="color-secondary mr-8"></AppIcon>
|
||||||
<span class="color-secondary">
|
<span class="color-secondary">
|
||||||
{{ $t('views.application.status.unpublished') }}
|
{{ $t('views.application.status.unpublished') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #mouseEnter>
|
<template #mouseEnter>
|
||||||
<div @click.stop>
|
<div @click.stop>
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<el-button text @click.stop>
|
<el-button text @click.stop>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<MoreFilled />
|
<MoreFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item @click.stop="getAccessToken(item.id)">
|
<el-dropdown-item @click.stop="getAccessToken(item.id)">
|
||||||
<AppIcon iconName="app-create-chat"></AppIcon>
|
<AppIcon iconName="app-create-chat"></AppIcon>
|
||||||
{{ $t('views.application.operation.toChat') }}
|
{{ $t('views.application.operation.toChat') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.stop="settingApplication(item)">
|
<el-dropdown-item @click.stop="settingApplication(item)">
|
||||||
<el-icon><Setting /></el-icon>
|
<el-icon><Setting /></el-icon>
|
||||||
{{ $t('common.setting') }}
|
{{ $t('common.setting') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item divided @click.stop="exportApplication(item)">
|
<el-dropdown-item divided @click.stop="exportApplication(item)">
|
||||||
<AppIcon iconName="app-export"></AppIcon>
|
<AppIcon iconName="app-export"></AppIcon>
|
||||||
{{ $t('common.export') }}
|
{{ $t('common.export') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
divided
|
divided
|
||||||
icon="Delete"
|
icon="Delete"
|
||||||
@click.stop="deleteApplication(item)"
|
@click.stop="deleteApplication(item)"
|
||||||
>{{ $t('common.delete') }}</el-dropdown-item
|
>{{ $t('common.delete') }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-empty :description="$t('common.noData')" v-else />
|
<el-empty :description="$t('common.noData')" v-else />
|
||||||
|
</InfiniteScroll>
|
||||||
</div>
|
</div>
|
||||||
</ContentContainer>
|
</ContentContainer>
|
||||||
<CreateApplicationDialog ref="CreateApplicationDialogRef" />
|
<CreateApplicationDialog ref="CreateApplicationDialogRef" />
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<LayoutContainer :header="$t('views.chatLog.title')">
|
<div class="p-16-24">
|
||||||
<div class="p-24">
|
<h2 class="mb-16">{{ $t('views.chatLog.title') }}</h2>
|
||||||
|
|
||||||
|
<el-card style="--el-card-padding: 24px">
|
||||||
<div class="mb-16">
|
<div class="mb-16">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="history_day"
|
v-model="history_day"
|
||||||
@ -24,6 +26,8 @@
|
|||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
@change="changeDayRangeHandle"
|
@change="changeDayRangeHandle"
|
||||||
|
style="width: 240px;"
|
||||||
|
class="mr-12"
|
||||||
/>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="search"
|
v-model="search"
|
||||||
@ -153,7 +157,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</app-table>
|
</app-table>
|
||||||
</div>
|
</el-card>
|
||||||
<ChatRecordDrawer
|
<ChatRecordDrawer
|
||||||
:next="nextChatRecord"
|
:next="nextChatRecord"
|
||||||
:pre="preChatRecord"
|
:pre="preChatRecord"
|
||||||
@ -223,31 +227,7 @@
|
|||||||
:value="item.id"
|
:value="item.id"
|
||||||
>
|
>
|
||||||
<span class="flex align-center">
|
<span class="flex align-center">
|
||||||
<AppAvatar
|
<KnowledgeIcon :type="item.type" v-if="!item.knowledge_id" />
|
||||||
v-if="!item.knowledge_id && item.type === '1'"
|
|
||||||
class="mr-12 avatar-purple"
|
|
||||||
shape="square"
|
|
||||||
:size="24"
|
|
||||||
>
|
|
||||||
<img src="@/assets/icon_web.svg" style="width: 58%" alt="" />
|
|
||||||
</AppAvatar>
|
|
||||||
<AppAvatar
|
|
||||||
v-else-if="!item.knowledge_id && item.type === '2'"
|
|
||||||
class="mr-12 avatar-purple"
|
|
||||||
shape="square"
|
|
||||||
:size="24"
|
|
||||||
style="background: none"
|
|
||||||
>
|
|
||||||
<img src="@/assets/logo_lark.svg" style="width: 100%" alt="" />
|
|
||||||
</AppAvatar>
|
|
||||||
<AppAvatar
|
|
||||||
v-else-if="!item.knowledge_id && item.type === '0'"
|
|
||||||
class="mr-12 avatar-blue"
|
|
||||||
shape="square"
|
|
||||||
:size="24"
|
|
||||||
>
|
|
||||||
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
|
|
||||||
</AppAvatar>
|
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</span>
|
</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
@ -283,12 +263,13 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</LayoutContainer>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, type Ref, onMounted, reactive, computed } from 'vue'
|
import { ref, type Ref, onMounted, reactive, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
import KnowledgeIcon from '@/views/knowledge/component/KnowledgeIcon.vue'
|
||||||
import ChatRecordDrawer from './component/ChatRecordDrawer.vue'
|
import ChatRecordDrawer from './component/ChatRecordDrawer.vue'
|
||||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||||
import chatLogApi from '@/api/application/chat-log'
|
import chatLogApi from '@/api/application/chat-log'
|
||||||
@ -542,7 +523,13 @@ const exportLog = () => {
|
|||||||
obj = { ...obj, abstract: search.value }
|
obj = { ...obj, abstract: search.value }
|
||||||
}
|
}
|
||||||
|
|
||||||
chatLogApi.postExportChatLog(detail.value.id, detail.value.name, obj, { select_ids: arr }, loading)
|
chatLogApi.postExportChatLog(
|
||||||
|
detail.value.id,
|
||||||
|
detail.value.name,
|
||||||
|
obj,
|
||||||
|
{ select_ids: arr },
|
||||||
|
loading,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ import { set } from 'lodash'
|
|||||||
import { app } from '@/main'
|
import { app } from '@/main'
|
||||||
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
import NodeContainer from '@/workflow/common/NodeContainer.vue'
|
||||||
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
import NodeCascader from '@/workflow/common/NodeCascader.vue'
|
||||||
import AddDatasetDialog from '@/views/application/component/AddDatasetDialog.vue'
|
import AddDatasetDialog from '@/views/application/component/AddKnowledgeDialog.vue'
|
||||||
import ParamSettingDialog from '@/views/application/component/ParamSettingDialog.vue'
|
import ParamSettingDialog from '@/views/application/component/ParamSettingDialog.vue'
|
||||||
import type { FormInstance } from 'element-plus'
|
import type { FormInstance } from 'element-plus'
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user