|
@@ -10,7 +10,7 @@ import {
|
|
|
sendMessage
|
|
|
} from '../utils/ai-service.js'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
-import { getPageInfo } from '../utils/index.js'
|
|
|
+import { getPageInfo, getFileValue } from '../utils/index.js'
|
|
|
import { mockData, mockData2 } from '../mock'
|
|
|
import { useMsgStore } from '@/store/modules/msg'
|
|
|
import { FunctionList } from '../mock'
|
|
@@ -25,31 +25,6 @@ export function useMsg(scrollbar?: any) {
|
|
|
const formMap = ref([])
|
|
|
// 获取父组件提供的 Hook 实例
|
|
|
const { useStore } = inject('indexedDBHook') as any
|
|
|
-
|
|
|
- const getFileSummary = async (file: any) => {
|
|
|
- const obj = reactive({
|
|
|
- id: moment(),
|
|
|
- username: '用户1',
|
|
|
- rawContent: '',
|
|
|
- content: '解析文件中',
|
|
|
- timestamp: moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- isSelf: false,
|
|
|
- avatar: avator,
|
|
|
- addToHistory: !taklToHtml.value
|
|
|
- })
|
|
|
- try {
|
|
|
- sendLoading.value = true
|
|
|
- messages.value.push(obj)
|
|
|
- nextTick(() => scrollbar.value?.setScrollTop(99999))
|
|
|
- const res = await getFileValue(file)
|
|
|
- console.log(res.data, file)
|
|
|
- await streamRes()
|
|
|
- } catch (error) {
|
|
|
- obj.content = '解析出错'
|
|
|
- } finally {
|
|
|
- sendLoading.value = false
|
|
|
- }
|
|
|
- }
|
|
|
const getFormKeyAndValue = async (file: any, form?: any) => {
|
|
|
// const obj = reactive({
|
|
|
// id: moment(),
|
|
@@ -363,7 +338,6 @@ export function useMsg(scrollbar?: any) {
|
|
|
fetchRes,
|
|
|
streamRes,
|
|
|
getFormKeyAndValue,
|
|
|
- getFileSummary,
|
|
|
requestFlowFn
|
|
|
}
|
|
|
}
|