Kevin Hu
commited on
Commit
·
6fd4084
1
Parent(s):
e066661
remove file size check for sdk API (#3066)
Browse files### What problem does this PR solve?
### Type of change
- [ ] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [x] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
api/apps/sdk/doc.py
CHANGED
@@ -46,14 +46,6 @@ from rag.utils.es_conn import ELASTICSEARCH
|
|
46 |
from rag.utils.storage_factory import STORAGE_IMPL
|
47 |
import os
|
48 |
|
49 |
-
MAXIMUM_OF_UPLOADING_FILES = 256
|
50 |
-
|
51 |
-
MAXIMUM_OF_UPLOADING_FILES = 256
|
52 |
-
|
53 |
-
MAXIMUM_OF_UPLOADING_FILES = 256
|
54 |
-
|
55 |
-
MAXIMUM_OF_UPLOADING_FILES = 256
|
56 |
-
|
57 |
|
58 |
@manager.route('/datasets/<dataset_id>/documents', methods=['POST'])
|
59 |
@token_required
|
@@ -66,21 +58,11 @@ def upload(dataset_id, tenant_id):
|
|
66 |
if file_obj.filename == '':
|
67 |
return get_result(
|
68 |
retmsg='No file selected!', retcode=RetCode.ARGUMENT_ERROR)
|
69 |
-
|
70 |
-
total_size = 0
|
71 |
-
for file_obj in file_objs:
|
72 |
-
file_obj.seek(0, os.SEEK_END)
|
73 |
-
total_size += file_obj.tell()
|
74 |
-
file_obj.seek(0)
|
75 |
-
MAX_TOTAL_FILE_SIZE=10*1024*1024
|
76 |
-
if total_size > MAX_TOTAL_FILE_SIZE:
|
77 |
-
return get_result(
|
78 |
-
retmsg=f'Total file size exceeds 10MB limit! ({total_size / (1024 * 1024):.2f} MB)',
|
79 |
-
retcode=RetCode.ARGUMENT_ERROR)
|
80 |
e, kb = KnowledgebaseService.get_by_id(dataset_id)
|
81 |
if not e:
|
82 |
raise LookupError(f"Can't find the dataset with ID {dataset_id}!")
|
83 |
-
err, files= FileService.upload_document(kb, file_objs, tenant_id)
|
84 |
if err:
|
85 |
return get_result(
|
86 |
retmsg="\n".join(err), retcode=RetCode.SERVER_ERROR)
|
|
|
46 |
from rag.utils.storage_factory import STORAGE_IMPL
|
47 |
import os
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
@manager.route('/datasets/<dataset_id>/documents', methods=['POST'])
|
51 |
@token_required
|
|
|
58 |
if file_obj.filename == '':
|
59 |
return get_result(
|
60 |
retmsg='No file selected!', retcode=RetCode.ARGUMENT_ERROR)
|
61 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
e, kb = KnowledgebaseService.get_by_id(dataset_id)
|
63 |
if not e:
|
64 |
raise LookupError(f"Can't find the dataset with ID {dataset_id}!")
|
65 |
+
err, files = FileService.upload_document(kb, file_objs, tenant_id)
|
66 |
if err:
|
67 |
return get_result(
|
68 |
retmsg="\n".join(err), retcode=RetCode.SERVER_ERROR)
|
intergrations/chatgpt-on-wechat/plugins/README.md
CHANGED
@@ -52,6 +52,6 @@ This file must be configured to point to your RAGFlow instance, with the `ragflo
|
|
52 |
Before you can use this plugin, ensure the following are in place:
|
53 |
|
54 |
1. You have installed and configured [ChatGPT-on-WeChat](https://github.com/zhayujie/chatgpt-on-wechat).
|
55 |
-
2. You have deployed and are running the [RAGFlow](https://github.com/
|
56 |
|
57 |
Make sure both `config.json` files (ChatGPT-on-WeChat and RAGFlow Chat Plugin) are correctly set up as per the examples above.
|
|
|
52 |
Before you can use this plugin, ensure the following are in place:
|
53 |
|
54 |
1. You have installed and configured [ChatGPT-on-WeChat](https://github.com/zhayujie/chatgpt-on-wechat).
|
55 |
+
2. You have deployed and are running the [RAGFlow](https://github.com/infiniflow/ragflow) server.
|
56 |
|
57 |
Make sure both `config.json` files (ChatGPT-on-WeChat and RAGFlow Chat Plugin) are correctly set up as per the examples above.
|