Browse Source

大模型增加下载模式

master
xueyinfei 1 week ago
parent
commit
c84a6d2e89
  1. 3
      vue-fastapi-frontend/src/main.js
  2. 14
      vue-fastapi-frontend/src/views/aichat/MdRenderer.vue
  3. 3
      vue-fastapi-frontend/src/views/aichat/aichat.vue

3
vue-fastapi-frontend/src/main.js

@ -52,8 +52,7 @@ const app = createApp(App)
// 全局方法挂载
app.config.globalProperties.useDict = useDict
app.config.globalProperties.download = download
app.config.globalProperties.download = download
app.config.globalProperties.formatDateTime = formatDateTime
app.config.globalProperties.formatDateTime = formatDateTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange

14
vue-fastapi-frontend/src/views/aichat/MdRenderer.vue

@ -15,6 +15,11 @@
<el-icon><FullScreen/></el-icon>
</el-button>
</div>
<div v-if="item.type === 'docs'" style="width: 100%;margin-top: 5px">
<div v-for="doc in item.docs">
<el-link type="primary" @click="downLoadFile(doc)" :underline="false">{{ doc.file_name }}</el-link>
</div>
</div>
<div v-else style="width: 100%;margin-top: 5px">
<markdown :markdown-string="item.content"></markdown>
</div>
@ -29,7 +34,7 @@ import chatTable from './chatTable.vue'
import htmlCharts from './htmlCharts.vue'
import {Download, FullScreen} from "@element-plus/icons-vue";
import { ref, watch} from 'vue'
const { proxy } = getCurrentInstance();
const props = defineProps({
source: Array,
is_large: Boolean,
@ -41,6 +46,13 @@ function fullscreenG6(data){
emit('fullscreenG6',data)
}
function downLoadFile(doc){
let data = {file:doc.file_name,bucket: doc.bucket,sessionId: doc.session_id}
proxy.download("/default-api/aichat/file/download", {
...data,
}, doc.file_name);
}
function downLoadTable(data){
const worksheet = XLSX.utils.json_to_sheet(data);
// 簿簿

3
vue-fastapi-frontend/src/views/aichat/aichat.vue

@ -180,7 +180,6 @@
<script setup>
import { ref, nextTick, computed, watch, reactive, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import antvg6 from './antv-g6.vue'
import OperationButton from './OperationButton.vue'
import MdRenderer from '@/views/aichat/MdRenderer.vue'
import fullscreenG6 from '@/views/aichat/fullscreenG6.vue'
@ -525,7 +524,7 @@ const getWrite = (reader) => {
// 5
if (chunk.docs?.length) {
lastMsg.content.push({ content: chunk.docs[0], type: "docs" });
lastMsg.content.push({ content: chunk.docs, type: "docs" });
} else if (chunk.G6_ER?.length) {
lastMsg.content.push({ content: chunk.G6_ER, type: "G6_ER" });
} else if (chunk.html_image?.length) {

Loading…
Cancel
Save