From d5522e7c08bc600f21ea4c4d6b70763cbfd6adde Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 27 Mar 2023 19:29:10 +0100 Subject: [PATCH] prep things --- application/app.py | 2 +- application/worker.py | 2 +- frontend/src/preferences/preferenceSlice.ts | 14 ++++++++++++-- frontend/src/upload/Upload.tsx | 15 +++++++++++++-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/application/app.py b/application/app.py index 2dafefc0..70bd189b 100644 --- a/application/app.py +++ b/application/app.py @@ -335,7 +335,7 @@ def upload_file(): os.makedirs(save_dir) file.save(os.path.join(save_dir, filename)) - task = ingest.delay('temp', [".rst", ".md", ".pdf"], job_name, filename, user) + task = ingest.delay('temp', [".rst", ".md", ".pdf", ".txt"], job_name, filename, user) # task id task_id = task.id return {"status": 'ok', "task_id": task_id} diff --git a/application/worker.py b/application/worker.py index 90bc9bf8..ce2c82d5 100644 --- a/application/worker.py +++ b/application/worker.py @@ -96,4 +96,4 @@ def ingest_worker(self, directory, formats, name_job, filename, user): # delete local shutil.rmtree(full_path) - return {'directory': directory, 'formats': formats, 'name_job': name_job, 'filename': filename, 'user': user} + return {'directory': directory, 'formats': formats, 'name_job': name_job, 'filename': filename, 'user': user, 'limited': False} diff --git a/frontend/src/preferences/preferenceSlice.ts b/frontend/src/preferences/preferenceSlice.ts index 78951e74..edf582ce 100644 --- a/frontend/src/preferences/preferenceSlice.ts +++ b/frontend/src/preferences/preferenceSlice.ts @@ -13,8 +13,18 @@ interface Preference { } const initialState: Preference = { - apiKey: '', - selectedDocs: null, + apiKey: 'xxx', + selectedDocs: { + name: 'default', + language: 'default', + location: 'default', + version: 'default', + description: 'default', + fullName: 'default', + dat: 'default', + docLink: 'default', + model: 'openai_text-embedding-ada-002', + } as Doc, sourceDocs: null, }; diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index 9a0f62d0..0bb62f1a 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -151,10 +151,18 @@ export default function Upload({ const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, - multiple: true, + multiple: false, onDragEnter: doNothing, onDragOver: doNothing, onDragLeave: doNothing, + maxSize: 25000000, + accept: { + 'application/pdf': ['.pdf'], + 'text/plain': ['.txt'], + 'text/x-rst': ['.rst'], + 'text/x-markdown': ['.md'], + 'application/zip': ['.zip'], + }, }); let view; @@ -165,7 +173,10 @@ export default function Upload({ } else { view = ( <> -

Upload New Documentation

+

Upload New Documentation

+

+ Please upload .pdf, .txt, .rst, .md, .zip limited to 25mb +