|
@@ -20,17 +20,17 @@ export function useMsg(scrollbar?: any, xlsxData?: any, fetchDataAndProcess?: Fu
|
|
|
const {useStore} = inject('indexedDBHook') as any;
|
|
|
|
|
|
|
|
|
- const getFileValue = async (file: any, form: 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
|
|
|
- })
|
|
|
+ const getFileValue = async (file: any, form: 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
|
|
@@ -50,7 +50,7 @@ export function useMsg(scrollbar?: any, xlsxData?: any, fetchDataAndProcess?: Fu
|
|
|
|
|
|
await streamRes(buildObjPrompt(response.data, form), false)
|
|
|
}
|
|
|
- console.log(res.data,file);
|
|
|
+ console.log(res.data, file);
|
|
|
|
|
|
if (type.value === '') {
|
|
|
console.log(getFileSummaryPrompt(res.data, file.name));
|
|
@@ -62,34 +62,9 @@ export function useMsg(scrollbar?: any, xlsxData?: any, fetchDataAndProcess?: Fu
|
|
|
|
|
|
obj.content = '解析出错'
|
|
|
} finally {
|
|
|
- try {
|
|
|
- sendLoading.value = true
|
|
|
- messages.value.push(obj)
|
|
|
- nextTick(() => scrollbar.value?.setScrollTop(99999))
|
|
|
- let formData = new FormData();
|
|
|
- formData.append("file", file);
|
|
|
- const res = await getFileContent(formData)
|
|
|
- console.log({
|
|
|
- body: form,
|
|
|
- input_data: res.data
|
|
|
- });
|
|
|
-
|
|
|
- const response = await getFormKey({
|
|
|
- body: form,
|
|
|
- input_data: res.data
|
|
|
- })
|
|
|
- xlsxData.value = response.data
|
|
|
- console.log(xlsxData.value);
|
|
|
- console.log(type.value);
|
|
|
-
|
|
|
- await streamRes(buildObjPrompt(response.data, form), false)
|
|
|
- } catch (error) {
|
|
|
- obj.content = '解析出错'
|
|
|
- } finally {
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
// 发送消息
|
|
|
const addMessage = (msg: any, fetch: any) => {
|
|
|
if (!msg) return
|