feat: chat
This commit is contained in:
parent
5acf2f60e5
commit
16b1a79c0b
2
ui/env/.env.chat
vendored
2
ui/env/.env.chat
vendored
@ -1,5 +1,5 @@
|
|||||||
VITE_APP_NAME=chat
|
VITE_APP_NAME=chat
|
||||||
VITE_BASE_PATH=/chat/
|
VITE_BASE_PATH=/chat/
|
||||||
VITE_APP_PORT=3000
|
VITE_APP_PORT=3001
|
||||||
VITE_APP_TITLE = 'MaxKB'
|
VITE_APP_TITLE = 'MaxKB'
|
||||||
VITE_ENTRY="entry/chat/index.html"
|
VITE_ENTRY="entry/chat/index.html"
|
||||||
@ -3,8 +3,14 @@ import type { RouteRecordRaw } from 'vue-router'
|
|||||||
export const routes: Array<RouteRecordRaw> = [
|
export const routes: Array<RouteRecordRaw> = [
|
||||||
// 对话
|
// 对话
|
||||||
{
|
{
|
||||||
path: '/chat/:accessToken',
|
path: '/:accessToken',
|
||||||
name: 'Chat',
|
name: 'Chat',
|
||||||
component: () => import('@/views/chat/index.vue'),
|
component: () => import('@/views/chat/index.vue'),
|
||||||
},
|
},
|
||||||
|
// 对话用户登录
|
||||||
|
{
|
||||||
|
path: '/user-login/:accessToken',
|
||||||
|
name: 'UserLogin',
|
||||||
|
component: () => import('@/views/chat/user-login/index.vue'),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export const routes: Array<RouteRecordRaw> = [
|
|||||||
component: () => import('@/views/chat/index.vue'),
|
component: () => import('@/views/chat/index.vue'),
|
||||||
},
|
},
|
||||||
|
|
||||||
// 对话用户登录
|
// 对话用户登录
|
||||||
{
|
{
|
||||||
path: '/user-login/:accessToken',
|
path: '/user-login/:accessToken',
|
||||||
name: 'UserLogin',
|
name: 'UserLogin',
|
||||||
|
|||||||
@ -62,15 +62,16 @@ const useApplicationStore = defineStore('application', {
|
|||||||
|
|
||||||
async asyncGetAppProfile(loading?: Ref<boolean>) {
|
async asyncGetAppProfile(loading?: Ref<boolean>) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// applicationApi
|
console.log('xxxx')
|
||||||
// .getAppProfile(loading)
|
applicationApi
|
||||||
// .then((res) => {
|
.getAppProfile(loading)
|
||||||
// sessionStorage.setItem('language', res.data?.language || getBrowserLang())
|
.then((res) => {
|
||||||
// resolve(res)
|
sessionStorage.setItem('language', res.data?.language || getBrowserLang())
|
||||||
// })
|
resolve(res)
|
||||||
// .catch((error) => {
|
})
|
||||||
// reject(error)
|
.catch((error) => {
|
||||||
// })
|
reject(error)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -80,16 +81,16 @@ const useApplicationStore = defineStore('application', {
|
|||||||
authentication_value?: any,
|
authentication_value?: any,
|
||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// applicationApi
|
applicationApi
|
||||||
// .postAppAuthentication(token, loading, authentication_value)
|
.postAppAuthentication(token, loading, authentication_value)
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// localStorage.setItem(`${token}-accessToken`, res.data)
|
localStorage.setItem(`${token}-accessToken`, res.data)
|
||||||
// sessionStorage.setItem(`${token}-accessToken`, res.data)
|
sessionStorage.setItem(`${token}-accessToken`, res.data)
|
||||||
// resolve(res)
|
resolve(res)
|
||||||
// })
|
})
|
||||||
// .catch((error) => {
|
.catch((error) => {
|
||||||
// reject(error)
|
reject(error)
|
||||||
// })
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async refreshAccessToken(token: string) {
|
async refreshAccessToken(token: string) {
|
||||||
|
|||||||
@ -41,12 +41,10 @@
|
|||||||
>
|
>
|
||||||
<img :src="detail?.icon" alt="" />
|
<img :src="detail?.icon" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<LogoIcon
|
||||||
v-else-if="detail?.name"
|
v-else
|
||||||
:name="detail?.name"
|
height="28px"
|
||||||
pinyinColor
|
style="width: 28px; height: 28px; display: block"
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -92,13 +92,7 @@
|
|||||||
>
|
>
|
||||||
<img :src="detail?.icon" alt="" />
|
<img :src="detail?.icon" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<LogoIcon v-else height="28px" style="width: 28px; height: 28px; display: block" />
|
||||||
v-else-if="detail?.name"
|
|
||||||
:name="detail?.name"
|
|
||||||
pinyinColor
|
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>
|
<h4>
|
||||||
@ -157,7 +151,7 @@ const isDefaultTheme = computed(() => {
|
|||||||
return user.isDefaultTheme()
|
return user.isDefaultTheme()
|
||||||
})
|
})
|
||||||
const {
|
const {
|
||||||
params: { id }
|
params: { id },
|
||||||
} = route as any
|
} = route as any
|
||||||
|
|
||||||
let interval: any
|
let interval: any
|
||||||
@ -182,7 +176,7 @@ function back() {
|
|||||||
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
|
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
|
||||||
cancelButtonText: t('views.applicationWorkflow.setting.exit'),
|
cancelButtonText: t('views.applicationWorkflow.setting.exit'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
distinguishCancelAndClose: true
|
distinguishCancelAndClose: true,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
saveApplication(true, true)
|
saveApplication(true, true)
|
||||||
@ -268,7 +262,7 @@ async function publicHandle() {
|
|||||||
?.validate()
|
?.validate()
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const obj = {
|
const obj = {
|
||||||
work_flow: getGraphData()
|
work_flow: getGraphData(),
|
||||||
}
|
}
|
||||||
await application.asyncPutApplication(id, obj, loading)
|
await application.asyncPutApplication(id, obj, loading)
|
||||||
const workflow = new WorkFlowInstance(obj.work_flow)
|
const workflow = new WorkFlowInstance(obj.work_flow)
|
||||||
@ -293,14 +287,14 @@ async function publicHandle() {
|
|||||||
MsgError(
|
MsgError(
|
||||||
res.node.properties?.stepName +
|
res.node.properties?.stepName +
|
||||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
||||||
err_message.toLowerCase()
|
err_message.toLowerCase(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
const keys = Object.keys(err_message)
|
const keys = Object.keys(err_message)
|
||||||
MsgError(
|
MsgError(
|
||||||
node.properties?.stepName +
|
node.properties?.stepName +
|
||||||
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
|
||||||
err_message[keys[0]]?.[0]?.message.toLowerCase()
|
err_message[keys[0]]?.[0]?.message.toLowerCase(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -318,7 +312,7 @@ const clickShowDebug = () => {
|
|||||||
...detail.value,
|
...detail.value,
|
||||||
type: 'WORK_FLOW',
|
type: 'WORK_FLOW',
|
||||||
...workflow.get_base_node()?.properties.node_data,
|
...workflow.get_base_node()?.properties.node_data,
|
||||||
work_flow: getGraphData()
|
work_flow: getGraphData(),
|
||||||
}
|
}
|
||||||
|
|
||||||
showDebug.value = true
|
showDebug.value = true
|
||||||
@ -331,14 +325,14 @@ const clickShowDebug = () => {
|
|||||||
const err_message = res.errMessage
|
const err_message = res.errMessage
|
||||||
if (typeof err_message == 'string') {
|
if (typeof err_message == 'string') {
|
||||||
MsgError(
|
MsgError(
|
||||||
res.node.properties?.stepName + ` ${t('views.applicationWorkflow.node')},` + err_message
|
res.node.properties?.stepName + ` ${t('views.applicationWorkflow.node')},` + err_message,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
const keys = Object.keys(err_message)
|
const keys = Object.keys(err_message)
|
||||||
MsgError(
|
MsgError(
|
||||||
node.properties?.stepName +
|
node.properties?.stepName +
|
||||||
` ${t('views.applicationWorkflow.node')},` +
|
` ${t('views.applicationWorkflow.node')},` +
|
||||||
err_message[keys[0]]?.[0]?.message
|
err_message[keys[0]]?.[0]?.message,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -376,7 +370,7 @@ function getDetail() {
|
|||||||
|
|
||||||
function saveApplication(bool?: boolean, back?: boolean) {
|
function saveApplication(bool?: boolean, back?: boolean) {
|
||||||
const obj = {
|
const obj = {
|
||||||
work_flow: getGraphData()
|
work_flow: getGraphData(),
|
||||||
}
|
}
|
||||||
loading.value = back || false
|
loading.value = back || false
|
||||||
application
|
application
|
||||||
|
|||||||
@ -1,27 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="chat-pc__header" :style="customStyle">
|
|
||||||
<div class="flex align-center">
|
|
||||||
<div class="mr-12 ml-24 flex">
|
|
||||||
<el-avatar
|
|
||||||
v-if="isAppIcon(application_profile?.icon)"
|
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
style="background: none"
|
|
||||||
>
|
|
||||||
<img :src="application_profile?.icon" alt="" />
|
|
||||||
</el-avatar>
|
|
||||||
<el-avatar
|
|
||||||
v-else-if="application_profile?.name"
|
|
||||||
:name="application_profile?.name"
|
|
||||||
pinyinColor
|
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<h4>{{ application_profile?.name }}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<component
|
<component
|
||||||
:is="auth_components[`/src/views/chat/auth/component/${auth_type}.vue`].default"
|
:is="auth_components[`/src/views/chat/auth/component/${auth_type}.vue`].default"
|
||||||
v-model="is_auth"
|
v-model="is_auth"
|
||||||
@ -33,7 +10,7 @@ import { computed } from 'vue'
|
|||||||
import { isAppIcon } from '@/utils/common'
|
import { isAppIcon } from '@/utils/common'
|
||||||
|
|
||||||
const auth_components: any = import.meta.glob('@/views/chat/auth/component/*.vue', {
|
const auth_components: any = import.meta.glob('@/views/chat/auth/component/*.vue', {
|
||||||
eager: true
|
eager: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
@ -42,8 +19,8 @@ const props = withDefaults(
|
|||||||
defineProps<{ modelValue: boolean; application_profile: any; auth_type?: string; style?: any }>(),
|
defineProps<{ modelValue: boolean; application_profile: any; auth_type?: string; style?: any }>(),
|
||||||
{
|
{
|
||||||
auth_type: 'password',
|
auth_type: 'password',
|
||||||
style: {}
|
style: {},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
const is_auth = computed({
|
const is_auth = computed({
|
||||||
get: () => {
|
get: () => {
|
||||||
@ -51,7 +28,7 @@ const is_auth = computed({
|
|||||||
},
|
},
|
||||||
set: (v) => {
|
set: (v) => {
|
||||||
emit('update:modelValue', v)
|
emit('update:modelValue', v)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const customStyle = computed(() => {
|
const customStyle = computed(() => {
|
||||||
@ -59,7 +36,7 @@ const customStyle = computed(() => {
|
|||||||
background: props.application_profile?.custom_theme?.theme_color,
|
background: props.application_profile?.custom_theme?.theme_color,
|
||||||
color: props.application_profile?.custom_theme?.header_font_color,
|
color: props.application_profile?.custom_theme?.header_font_color,
|
||||||
border: 'none',
|
border: 'none',
|
||||||
...props.style
|
...props.style,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -5,157 +5,149 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:style="{
|
:style="{
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1)
|
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="chat-pc__header" :style="customStyle">
|
11111111111
|
||||||
<div class="flex align-center">
|
<div class="flex">
|
||||||
<div class="mr-12 ml-24 flex">
|
<div class="chat-pc__left border-r">
|
||||||
<el-avatar
|
<div class="p-24 pb-0">
|
||||||
v-if="isAppIcon(applicationDetail?.icon)"
|
<div class="flex align-center">
|
||||||
shape="square"
|
<div class="mr-12 ml-24 flex">
|
||||||
:size="32"
|
<el-avatar
|
||||||
style="background: none"
|
v-if="isAppIcon(applicationDetail?.icon)"
|
||||||
>
|
shape="square"
|
||||||
<img :src="applicationDetail?.icon" alt="" />
|
:size="32"
|
||||||
</el-avatar>
|
style="background: none"
|
||||||
<el-avatar
|
>
|
||||||
v-else-if="applicationDetail?.name"
|
<img :src="applicationDetail?.icon" alt="" />
|
||||||
:name="applicationDetail?.name"
|
</el-avatar>
|
||||||
pinyinColor
|
<LogoIcon v-else height="28px" style="width: 28px; height: 28px; display: block" />
|
||||||
shape="square"
|
</div>
|
||||||
:size="32"
|
<h4>{{ applicationDetail?.name }}</h4>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<h4>{{ applicationDetail?.name }}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="chat-pc__left border-r">
|
|
||||||
<div class="p-24 pb-0">
|
|
||||||
<el-button class="add-button w-full primary" @click="newChat">
|
|
||||||
<el-icon>
|
|
||||||
<Plus />
|
|
||||||
</el-icon>
|
|
||||||
<span class="ml-4">{{ $t('chat.createChat') }}</span>
|
|
||||||
</el-button>
|
|
||||||
<p class="mt-20 mb-8">{{ $t('chat.history') }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="left-height pt-0">
|
|
||||||
<el-scrollbar>
|
|
||||||
<div class="p-8 pt-0">
|
|
||||||
<common-list
|
|
||||||
:style="{
|
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
|
||||||
'--el-color-primary-light-9': hexToRgba(
|
|
||||||
applicationDetail?.custom_theme?.theme_color,
|
|
||||||
0.1
|
|
||||||
)
|
|
||||||
}"
|
|
||||||
:data="chatLogData"
|
|
||||||
class="mt-8"
|
|
||||||
v-loading="left_loading"
|
|
||||||
:defaultActive="currentChatId"
|
|
||||||
@click="clickListHandle"
|
|
||||||
@mouseenter="mouseenter"
|
|
||||||
@mouseleave="mouseId = ''"
|
|
||||||
>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<div class="flex-between">
|
|
||||||
<auto-tooltip :content="row.abstract">
|
|
||||||
{{ row.abstract }}
|
|
||||||
</auto-tooltip>
|
|
||||||
<div @click.stop v-show="mouseId === row.id && row.id !== 'new'">
|
|
||||||
<el-dropdown trigger="click" :teleported="false">
|
|
||||||
<el-icon class="rotate-90 mt-4"><MoreFilled /></el-icon>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item @click.stop="editLogTitle(row)">
|
|
||||||
<el-icon><EditPen /></el-icon>
|
|
||||||
{{ $t('common.edit') }}
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item @click.stop="deleteLog(row)">
|
|
||||||
<el-icon><Delete /></el-icon>
|
|
||||||
{{ $t('common.delete') }}
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #empty>
|
|
||||||
<div class="text-center">
|
|
||||||
<el-text type="info">{{ $t('chat.noHistory') }}</el-text>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</common-list>
|
|
||||||
</div>
|
|
||||||
<div v-if="chatLogData?.length" class="gradient-divider lighter mt-8">
|
|
||||||
<span>{{ $t('chat.only20history') }}</span>
|
|
||||||
</div>
|
|
||||||
</el-scrollbar>
|
|
||||||
</div>
|
</div>
|
||||||
|
<el-button class="add-button w-full primary" @click="newChat">
|
||||||
|
<el-icon>
|
||||||
|
<Plus />
|
||||||
|
</el-icon>
|
||||||
|
<span class="ml-4">{{ $t('chat.createChat') }}</span>
|
||||||
|
</el-button>
|
||||||
|
<p class="mt-20 mb-8">{{ $t('chat.history') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-pc__right">
|
<div class="left-height pt-0">
|
||||||
<div class="right-header border-b mb-24 p-16-24 flex-between">
|
<el-scrollbar>
|
||||||
<h4 class="ellipsis-1" style="width: 66%">
|
<div class="p-8 pt-0">
|
||||||
{{ currentChatName }}
|
<common-list
|
||||||
</h4>
|
:style="{
|
||||||
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
<span class="flex align-center" v-if="currentRecordList.length">
|
'--el-color-primary-light-9': hexToRgba(
|
||||||
<AppIcon
|
applicationDetail?.custom_theme?.theme_color,
|
||||||
v-if="paginationConfig.total"
|
0.1,
|
||||||
iconName="app-chat-record"
|
),
|
||||||
class="info mr-8"
|
}"
|
||||||
style="font-size: 16px"
|
:data="chatLogData"
|
||||||
></AppIcon>
|
class="mt-8"
|
||||||
<span v-if="paginationConfig.total" class="lighter">
|
v-loading="left_loading"
|
||||||
{{ paginationConfig.total }} {{ $t('chat.question_count') }}
|
:defaultActive="currentChatId"
|
||||||
</span>
|
@click="clickListHandle"
|
||||||
<el-dropdown class="ml-8">
|
@mouseenter="mouseenter"
|
||||||
<AppIcon
|
@mouseleave="mouseId = ''"
|
||||||
iconName="app-export"
|
>
|
||||||
class="cursor"
|
<template #default="{ row }">
|
||||||
:title="$t('chat.exportRecords')"
|
<div class="flex-between">
|
||||||
></AppIcon>
|
<auto-tooltip :content="row.abstract">
|
||||||
<template #dropdown>
|
{{ row.abstract }}
|
||||||
<el-dropdown-menu>
|
</auto-tooltip>
|
||||||
<el-dropdown-item @click="exportMarkdown"
|
<div @click.stop v-show="mouseId === row.id && row.id !== 'new'">
|
||||||
>{{ $t('common.export') }} Markdown</el-dropdown-item
|
<el-dropdown trigger="click" :teleported="false">
|
||||||
>
|
<el-icon class="rotate-90 mt-4"><MoreFilled /></el-icon>
|
||||||
<el-dropdown-item @click="exportHTML"
|
<template #dropdown>
|
||||||
>{{ $t('common.export') }} HTML</el-dropdown-item
|
<el-dropdown-menu>
|
||||||
>
|
<el-dropdown-item @click.stop="editLogTitle(row)">
|
||||||
</el-dropdown-menu>
|
<el-icon><EditPen /></el-icon>
|
||||||
|
{{ $t('common.edit') }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click.stop="deleteLog(row)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
{{ $t('common.delete') }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
|
||||||
</span>
|
<template #empty>
|
||||||
</div>
|
<div class="text-center">
|
||||||
<div class="right-height chat-width">
|
<el-text type="info">{{ $t('chat.noHistory') }}</el-text>
|
||||||
<AiChat
|
</div>
|
||||||
ref="AiChatRef"
|
</template>
|
||||||
v-model:applicationDetails="applicationDetail"
|
</common-list>
|
||||||
:available="applicationAvailable"
|
</div>
|
||||||
type="ai-chat"
|
<div v-if="chatLogData?.length" class="gradient-divider lighter mt-8">
|
||||||
:appId="applicationDetail?.id"
|
<span>{{ $t('chat.only20history') }}</span>
|
||||||
:record="currentRecordList"
|
</div>
|
||||||
:chatId="currentChatId"
|
</el-scrollbar>
|
||||||
@refresh="refresh"
|
|
||||||
@scroll="handleScroll"
|
|
||||||
>
|
|
||||||
</AiChat>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse">
|
<div class="chat-pc__right">
|
||||||
<el-button @click="isCollapse = !isCollapse">
|
<div class="right-header border-b mb-24 p-16-24 flex-between">
|
||||||
<el-icon> <component :is="isCollapse ? 'Fold' : 'Expand'" /></el-icon>
|
<h4 class="ellipsis-1" style="width: 66%">
|
||||||
</el-button>
|
{{ currentChatName }}
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<span class="flex align-center" v-if="currentRecordList.length">
|
||||||
|
<AppIcon
|
||||||
|
v-if="paginationConfig.total"
|
||||||
|
iconName="app-chat-record"
|
||||||
|
class="info mr-8"
|
||||||
|
style="font-size: 16px"
|
||||||
|
></AppIcon>
|
||||||
|
<span v-if="paginationConfig.total" class="lighter">
|
||||||
|
{{ paginationConfig.total }} {{ $t('chat.question_count') }}
|
||||||
|
</span>
|
||||||
|
<el-dropdown class="ml-8">
|
||||||
|
<AppIcon
|
||||||
|
iconName="app-export"
|
||||||
|
class="cursor"
|
||||||
|
:title="$t('chat.exportRecords')"
|
||||||
|
></AppIcon>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item @click="exportMarkdown"
|
||||||
|
>{{ $t('common.export') }} Markdown</el-dropdown-item
|
||||||
|
>
|
||||||
|
<el-dropdown-item @click="exportHTML"
|
||||||
|
>{{ $t('common.export') }} HTML</el-dropdown-item
|
||||||
|
>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="right-height chat-width">
|
||||||
|
<AiChat
|
||||||
|
ref="AiChatRef"
|
||||||
|
v-model:applicationDetails="applicationDetail"
|
||||||
|
:available="applicationAvailable"
|
||||||
|
type="ai-chat"
|
||||||
|
:appId="applicationDetail?.id"
|
||||||
|
:record="currentRecordList"
|
||||||
|
:chatId="currentChatId"
|
||||||
|
@refresh="refresh"
|
||||||
|
@scroll="handleScroll"
|
||||||
|
>
|
||||||
|
</AiChat>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="collapse">
|
||||||
|
<el-button @click="isCollapse = !isCollapse">
|
||||||
|
<el-icon> <component :is="isCollapse ? 'Fold' : 'Expand'" /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<EditTitleDialog ref="EditTitleDialogRef" @refresh="refreshFieldTitle" />
|
<EditTitleDialog ref="EditTitleDialogRef" @refresh="refreshFieldTitle" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -181,7 +173,7 @@ const isCollapse = ref(false)
|
|||||||
const customStyle = computed(() => {
|
const customStyle = computed(() => {
|
||||||
return {
|
return {
|
||||||
background: applicationDetail.value?.custom_theme?.theme_color,
|
background: applicationDetail.value?.custom_theme?.theme_color,
|
||||||
color: applicationDetail.value?.custom_theme?.header_font_color
|
color: applicationDetail.value?.custom_theme?.header_font_color,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -189,13 +181,13 @@ const classObj = computed(() => {
|
|||||||
return {
|
return {
|
||||||
mobile: common.isMobile(),
|
mobile: common.isMobile(),
|
||||||
hideLeft: !isCollapse.value,
|
hideLeft: !isCollapse.value,
|
||||||
openLeft: isCollapse.value
|
openLeft: isCollapse.value,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const newObj = {
|
const newObj = {
|
||||||
id: 'new',
|
id: 'new',
|
||||||
abstract: t('chat.createChat')
|
abstract: t('chat.createChat'),
|
||||||
}
|
}
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
application_profile: any
|
application_profile: any
|
||||||
@ -209,7 +201,7 @@ const applicationDetail = computed({
|
|||||||
get: () => {
|
get: () => {
|
||||||
return props.application_profile
|
return props.application_profile
|
||||||
},
|
},
|
||||||
set: (v) => {}
|
set: (v) => {},
|
||||||
})
|
})
|
||||||
|
|
||||||
const chatLogData = ref<any[]>([])
|
const chatLogData = ref<any[]>([])
|
||||||
@ -217,7 +209,7 @@ const chatLogData = ref<any[]>([])
|
|||||||
const paginationConfig = ref({
|
const paginationConfig = ref({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
total: 0
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentRecordList = ref<any>([])
|
const currentRecordList = ref<any>([])
|
||||||
@ -286,7 +278,7 @@ function newChat() {
|
|||||||
function getChatLog(id: string, refresh?: boolean) {
|
function getChatLog(id: string, refresh?: boolean) {
|
||||||
const page = {
|
const page = {
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20
|
page_size: 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
chatLog.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
|
chatLog.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
|
||||||
@ -313,7 +305,7 @@ function getChatRecord() {
|
|||||||
currentChatId.value,
|
currentChatId.value,
|
||||||
paginationConfig.value,
|
paginationConfig.value,
|
||||||
loading,
|
loading,
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
paginationConfig.value.total = res.data.total
|
paginationConfig.value.total = res.data.total
|
||||||
@ -323,7 +315,7 @@ function getChatRecord() {
|
|||||||
v['record_id'] = v.id
|
v['record_id'] = v.id
|
||||||
})
|
})
|
||||||
currentRecordList.value = [...list, ...currentRecordList.value].sort((a, b) =>
|
currentRecordList.value = [...list, ...currentRecordList.value].sort((a, b) =>
|
||||||
a.create_time.localeCompare(b.create_time)
|
a.create_time.localeCompare(b.create_time),
|
||||||
)
|
)
|
||||||
if (paginationConfig.value.current_page === 1) {
|
if (paginationConfig.value.current_page === 1) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user