Jelajahi Sumber

文件上传接口

chd 5 bulan lalu
induk
melakukan
cf2f70f92a

+ 1 - 1
src/entrypoints/sidepanel/Chat.vue

@@ -571,7 +571,7 @@ onMounted(async () => {
   border-radius: 8px;
   transition: border-color 0.3s;
   resize: none;
-  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
+  box-shadow: none;
 }
 
 .input-area :deep(.el-textarea__inner) {

+ 1 - 1
src/entrypoints/sidepanel/component/tools.vue

@@ -19,7 +19,7 @@ const emit = defineEmits(['readClick', 'uploadFile'])
     </el-tooltip>
     <span class="separator"></span>
     <el-upload style="display:inline-block" :before-upload="(file: any) => emit('uploadFile', file)" :multiple="false"
-      name="file" :show-file-list="false" :accept="'.xlsx,.pdf'">
+      name="file" :show-file-list="false" :accept="'.xlsx,.pdf,.doc,.docx'">
       <el-tooltip effect="dark" content="文件上传" placement="top">
         <el-button :icon="Paperclip" circle />
       </el-tooltip>

+ 2 - 2
src/utils/ai-service.js

@@ -10,9 +10,9 @@ export const openai = new OpenAI(
         dangerouslyAllowBrowser: true,
     }
 )
-export async function upload(data) {
+export async function upload(data,ext) {
     try {
-        const res = await fetch('http://180.76.147.97:18899/upload_file', {
+        const res = await fetch('http://192.168.1.108:8000/upload-pdf', {
             method: 'post',
             body: data,
         }).then(res => res.json())