瀏覽代碼

数据源支持pdf word文件,兼容电投知英简历表单60%

chd 5 月之前
父節點
當前提交
ee4d8211bf
共有 2 個文件被更改,包括 17 次插入13 次删除
  1. 16 12
      src/entrypoints/sidepanel/Chat.vue
  2. 1 1
      src/entrypoints/sidepanel/hook/useMsg.ts

+ 16 - 12
src/entrypoints/sidepanel/Chat.vue

@@ -205,12 +205,18 @@ const handleUpload = (file) => {
   });
 
 }
-
+let str = ''
 async function fetchDataAndProcess(input, obj) {
-  console.log(input);
+  if (input.startsWith('/智能填表')) {
+    input = input.split('/智能填表')[1]
+  }
+  str = input
+  console.log(str);
 
   const pageInfo = await getPageInfo();
-
+  await new Promise(res => setTimeout(() => {
+    res()
+  }, 1000))
   const res = await hepl({
       input_data: input,
       body:pageInfo.content.mainContent
@@ -226,7 +232,6 @@ async function fetchDataAndProcess(input, obj) {
 
 async function handleClick(res, msgObj) {
   await new Promise(resolve => setTimeout(resolve, 2000))
-  if (res.action === 'click') {
     msgObj.content = `点击${res.tag}元素`
     chrome.runtime.sendMessage({
       type: 'FROM_SIDE_PANEL_TO_ACTION',
@@ -238,19 +243,18 @@ async function handleClick(res, msgObj) {
       } else {
         if (res.next === '是') {
           indexTemp.value++
-          fetchDataAndProcess('', msgObj)
+          const arr = str.split(',')
+          arr.shift()
+          str = arr.join(',')
+          fetchDataAndProcess(str, msgObj)
         } else {
-          ElMessage({ message: '操作执行完成', type: 'success', duration: 2 * 1000, grouping: true })
-          index = 0
+          msgObj.content = `请上传数据`
+          ElMessage({ message: '请上传数据', type: 'success', duration: 4 * 1000, grouping: true })
         }
       }
       return true
     });
-  }
-  if (res.action === 'show') {
-    msgObj.content = `请上传数据`
-    ElMessage({ message: '请上传数据', type: 'success', duration: 4 * 1000, grouping: true })
-  }
+  
   //     chrome.runtime.sendMessage({
   //          type: 'FROM_SIDE_PANEL_TO_ACTION',
   //                 data:obj

+ 1 - 1
src/entrypoints/sidepanel/hook/useMsg.ts

@@ -3,7 +3,7 @@ import { ref, reactive } from 'vue';
 import avator from '@/public/icon/32.png';
 import moment from 'moment'
 // import { sendMessage } from '@/utils/ai-service';
-export function useMsg(scrollbar: any, xlsxData: any, fetchDataAndProcess: Function) {
+export function useMsg(scrollbar: any, type: any, xlsxData: any, fetchDataAndProcess: Function) {
   const inputMessage = ref('');
   const indexTemp = ref(0);
   const taklToHtml = ref<any>(false);