|
@@ -40,6 +40,7 @@ import { useRouter } from 'vue-router'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import StructDataPlugin from '/@/components/markdown/plugins/struct-data'
|
|
|
import { useFileDialog } from '@vueuse/core'
|
|
|
+import download from 'downloadjs'
|
|
|
|
|
|
const plugins: Array<MarkdownPlugin<any>> = [EChartsPlugin(), ToolsLoadingPlugin(), TablePlugin(), StructDataPlugin()]
|
|
|
|
|
@@ -264,7 +265,7 @@ const promptDialogVisible = ref(false)
|
|
|
const chatInstance = ref<(() => void) | undefined>(undefined)
|
|
|
onUnmounted(() => chatInstance.value?.())
|
|
|
// 是否正在对话
|
|
|
-const isConversationActive = computed(() => chatInstance.value !== undefined)
|
|
|
+const isConversationActive = computed(() => chatInstance.value !== undefined || loadingUpload.value)
|
|
|
|
|
|
const { loading: loadingClearMessage, doLoading: clearMessage } = useLoading(async () => {
|
|
|
stopConversation()
|
|
@@ -284,7 +285,7 @@ const { loading: loadingClearMessage, doLoading: clearMessage } = useLoading(asy
|
|
|
})
|
|
|
|
|
|
const {loading:loadingUpload,doLoading: doUpload} = useLoading(async ()=> {
|
|
|
- return selectedFiles.value.length === 0 ? undefined : (await common.upload.multi(selectedFiles.value,0)) as Message['files']
|
|
|
+ return selectedFiles.value.length === 0 ? undefined : (await common.upload.multi(selectedFiles.value)) as Message['files']
|
|
|
})
|
|
|
// 发送消息
|
|
|
const sendMessage = async () => {
|
|
@@ -626,8 +627,9 @@ const { loading: loadingDeleteConversation, doLoading: deleteConversation } = us
|
|
|
ElMessage.success('删除成功')
|
|
|
activeConversationId.value = undefined
|
|
|
messages.value = []
|
|
|
- await nextTick()
|
|
|
- await doLoadConversations()
|
|
|
+ conversations.value = conversations.value.filter((item) => item.session_id !== id)
|
|
|
+ // await nextTick()
|
|
|
+ // await doLoadConversations()
|
|
|
})
|
|
|
|
|
|
const multiDeleteConversationModel = ref({
|
|
@@ -743,7 +745,7 @@ const getUserInfos = ref<{
|
|
|
}>(Local.get('userInfo') || {})
|
|
|
|
|
|
const canSendMessage = computed(() => {
|
|
|
- return !inputMessage.value.trim() || loadingModels.value || loadConversations.value || loadingMessage.value || loadingUpload.value
|
|
|
+ return !inputMessage.value.trim() || loadingModels.value || loadingEmbeddingModels.value || loadingPromptList.value || loadConversations.value || loadingMessage.value || loadingUpload.value
|
|
|
})
|
|
|
|
|
|
const router = useRouter()
|
|
@@ -815,23 +817,7 @@ const exportToMarkDown = (message: Message) => {
|
|
|
// 创建CSV内容
|
|
|
const csvContent = message.render_content
|
|
|
|
|
|
- // 创建Blob对象
|
|
|
- const blob = new Blob([csvContent], { type: 'text/markdown;charset=utf-8;' })
|
|
|
-
|
|
|
- // 创建下载链接
|
|
|
- const link = document.createElement('a')
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
- link.setAttribute('href', url)
|
|
|
- link.setAttribute('download', `export_${new Date().getTime()}.md`)
|
|
|
- link.style.visibility = 'hidden'
|
|
|
-
|
|
|
- // 触发下载
|
|
|
- document.body.appendChild(link)
|
|
|
- link.click()
|
|
|
- document.body.removeChild(link)
|
|
|
-
|
|
|
- // 清理URL对象
|
|
|
- URL.revokeObjectURL(url)
|
|
|
+ download(csvContent, `export_${new Date().getTime()}.md`)
|
|
|
}
|
|
|
|
|
|
// 导出对话历史
|