mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
Merge branch 'main' of https://github.com/maxkb-dev/maxkb
This commit is contained in:
commit
ea1650251c
|
|
@ -67,6 +67,20 @@ const initChat=(root)=>{
|
|||
const chat_button_img=root.querySelector('.maxkb-chat-button > img')
|
||||
// 对话框元素
|
||||
const chat_container=root.querySelector('#maxkb-chat-container')
|
||||
// 引导层
|
||||
const mask_content = root.querySelector('.maxkb-mask > .maxkb-content')
|
||||
const mask_tips = root.querySelector('.maxkb-tips')
|
||||
chat_button_img.onload=(event)=>{
|
||||
if(mask_content){
|
||||
mask_content.style.width = chat_button_img.width + 'px'
|
||||
mask_content.style.height = chat_button_img.height + 'px'
|
||||
if('{{x_type}}'=='left'){
|
||||
mask_tips.style.marginLeft = (chat_button_img.naturalWidth>500?500:chat_button_img.naturalWidth)-64 + 'px'
|
||||
}else{
|
||||
mask_tips.style.marginRight = (chat_button_img.naturalWidth>500?500:chat_button_img.naturalWidth)-64 + 'px'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const viewport=root.querySelector('.maxkb-openviewport')
|
||||
const closeviewport=root.querySelector('.maxkb-closeviewport')
|
||||
|
|
@ -90,17 +104,16 @@ const initChat=(root)=>{
|
|||
}
|
||||
const drag=(e)=>{
|
||||
if (['touchmove','touchstart'].includes(e.type)) {
|
||||
chat_button.style.top=(e.touches[0].clientY-25)+'px'
|
||||
chat_button.style.left=(e.touches[0].clientX-25)+'px'
|
||||
chat_button.style.top=(e.touches[0].clientY-chat_button_img.naturalHeight/2)+'px'
|
||||
chat_button.style.left=(e.touches[0].clientX-chat_button_img.naturalWidth/2)+'px'
|
||||
} else {
|
||||
chat_button.style.top=(e.y-25)+'px'
|
||||
chat_button.style.left=(e.x-25)+'px'
|
||||
chat_button.style.top=(e.y-chat_button_img.naturalHeight/2)+'px'
|
||||
chat_button.style.left=(e.x-chat_button_img.naturalWidth/2)+'px'
|
||||
}
|
||||
chat_button.style.width =chat_button_img.naturalWidth+'px'
|
||||
chat_button.style.height =chat_button_img.naturalHeight+'px'
|
||||
}
|
||||
if({{is_draggable}}){
|
||||
console.dir(chat_button_img)
|
||||
chat_button.addEventListener("drag",drag)
|
||||
chat_button.addEventListener("dragover",(e)=>{
|
||||
e.preventDefault()
|
||||
|
|
@ -155,7 +168,7 @@ function initMaxkbStyle(root){
|
|||
|
||||
#maxkb .maxkb-mask {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
z-index: 10001;
|
||||
background-color: transparent;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
|
@ -242,8 +255,6 @@ function initMaxkbStyle(root){
|
|||
{{x_type}}: {{x_value}}px;
|
||||
{{y_type}}: {{y_value}}px;
|
||||
cursor: pointer;
|
||||
max-height:500px;
|
||||
max-width:500px;
|
||||
z-index:10000;
|
||||
}
|
||||
#maxkb #maxkb-chat-container{
|
||||
|
|
@ -306,4 +317,4 @@ function embedChatbot() {
|
|||
initMaxkb()
|
||||
} else console.error('invalid parameter')
|
||||
}
|
||||
window.onload = embedChatbot
|
||||
window.addEventListener('load',embedChatbot)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@
|
|||
<template v-for="(item, index) in document_list" :key="index">
|
||||
<el-card shadow="never" style="--el-card-padding: 8px" class="download-file cursor">
|
||||
<div class="download-button flex align-center" @click="downloadFile(item)">
|
||||
<el-icon class="mr-4"><Download /></el-icon>点击下载文件
|
||||
<el-icon class="mr-4">
|
||||
<Download />
|
||||
</el-icon>
|
||||
点击下载文件
|
||||
</div>
|
||||
<div class="show flex align-center">
|
||||
<img :src="getImgUrl(item && item?.name)" alt="" width="24" />
|
||||
|
|
@ -61,6 +64,7 @@
|
|||
import { type chatType } from '@/api/type/application'
|
||||
import { getImgUrl, getAttrsArray, downloadByURL } from '@/utils/utils'
|
||||
import { onMounted, computed } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
application: any
|
||||
chatRecord: chatType
|
||||
|
|
@ -68,20 +72,20 @@ const props = defineProps<{
|
|||
const document_list = computed(() => {
|
||||
if (props.chatRecord?.upload_meta) {
|
||||
return props.chatRecord.upload_meta?.document_list || []
|
||||
} else if (props.chatRecord.execution_details?.length > 0) {
|
||||
return props.chatRecord.execution_details[0]?.document_list || []
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
const startNode = props.chatRecord.execution_details?.find(
|
||||
(detail) => detail.type === 'start-node'
|
||||
)
|
||||
return startNode?.document_list || []
|
||||
})
|
||||
const image_list = computed(() => {
|
||||
if (props.chatRecord?.upload_meta) {
|
||||
return props.chatRecord.upload_meta?.image_list || []
|
||||
} else if (props.chatRecord.execution_details?.length > 0) {
|
||||
return props.chatRecord.execution_details[0]?.image_list || []
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
const startNode = props.chatRecord.execution_details?.find(
|
||||
(detail) => detail.type === 'start-node'
|
||||
)
|
||||
return startNode?.image_list || []
|
||||
})
|
||||
|
||||
function downloadFile(item: any) {
|
||||
|
|
@ -94,21 +98,26 @@ onMounted(() => {})
|
|||
.download-file {
|
||||
width: 200px;
|
||||
height: 43px;
|
||||
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
border: 1px solid var(--el-color-primary);
|
||||
|
||||
.download-button {
|
||||
display: block;
|
||||
text-align: center;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.show {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.download-button {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue