Kevin Hu
commited on
Commit
·
d98ee8e
1
Parent(s):
2b252d0
fix api argument error (#1920)
Browse files### What problem does this PR solve?
#1918
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- api/apps/api_app.py +3 -3
- api/apps/document_app.py +1 -1
- api/db/services/file_service.py +2 -0
api/apps/api_app.py
CHANGED
@@ -87,7 +87,7 @@ def token_list():
|
|
87 |
if not tenants:
|
88 |
return get_data_error_result(retmsg="Tenant not found!")
|
89 |
|
90 |
-
id = request.args
|
91 |
objs = APITokenService.query(tenant_id=tenants[0].tenant_id, dialog_id=id)
|
92 |
return get_json_result(data=[o.to_dict() for o in objs])
|
93 |
except Exception as e:
|
@@ -121,11 +121,11 @@ def stats():
|
|
121 |
"from_date",
|
122 |
(datetime.now() -
|
123 |
timedelta(
|
124 |
-
days=7)).strftime("%Y-%m-%d
|
125 |
request.args.get(
|
126 |
"to_date",
|
127 |
datetime.now().strftime("%Y-%m-%d %H:%M:%S")),
|
128 |
-
"agent" if
|
129 |
res = {
|
130 |
"pv": [(o["dt"], o["pv"]) for o in objs],
|
131 |
"uv": [(o["dt"], o["uv"]) for o in objs],
|
|
|
87 |
if not tenants:
|
88 |
return get_data_error_result(retmsg="Tenant not found!")
|
89 |
|
90 |
+
id = request.args["dialog_id"] if "dialog_id" in request.args else request.args["canvas_id"]
|
91 |
objs = APITokenService.query(tenant_id=tenants[0].tenant_id, dialog_id=id)
|
92 |
return get_json_result(data=[o.to_dict() for o in objs])
|
93 |
except Exception as e:
|
|
|
121 |
"from_date",
|
122 |
(datetime.now() -
|
123 |
timedelta(
|
124 |
+
days=7)).strftime("%Y-%m-%d 00:00:00")),
|
125 |
request.args.get(
|
126 |
"to_date",
|
127 |
datetime.now().strftime("%Y-%m-%d %H:%M:%S")),
|
128 |
+
"agent" if "canvas_id" in request.args else None)
|
129 |
res = {
|
130 |
"pv": [(o["dt"], o["pv"]) for o in objs],
|
131 |
"uv": [(o["dt"], o["uv"]) for o in objs],
|
api/apps/document_app.py
CHANGED
@@ -487,7 +487,7 @@ def upload_and_parse():
|
|
487 |
def dummy(prog=None, msg=""):
|
488 |
pass
|
489 |
|
490 |
-
parser_config = {"chunk_token_num": 4096, "delimiter": "\n
|
491 |
exe = ThreadPoolExecutor(max_workers=12)
|
492 |
threads = []
|
493 |
for d, blob in files:
|
|
|
487 |
def dummy(prog=None, msg=""):
|
488 |
pass
|
489 |
|
490 |
+
parser_config = {"chunk_token_num": 4096, "delimiter": "\n!?;。;!?", "layout_recognize": False}
|
491 |
exe = ThreadPoolExecutor(max_workers=12)
|
492 |
threads = []
|
493 |
for d, blob in files:
|
api/db/services/file_service.py
CHANGED
@@ -372,6 +372,8 @@ class FileService(CommonService):
|
|
372 |
doc["parser_id"] = ParserType.AUDIO.value
|
373 |
if re.search(r"\.(ppt|pptx|pages)$", filename):
|
374 |
doc["parser_id"] = ParserType.PRESENTATION.value
|
|
|
|
|
375 |
DocumentService.insert(doc)
|
376 |
|
377 |
FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id)
|
|
|
372 |
doc["parser_id"] = ParserType.AUDIO.value
|
373 |
if re.search(r"\.(ppt|pptx|pages)$", filename):
|
374 |
doc["parser_id"] = ParserType.PRESENTATION.value
|
375 |
+
if re.search(r"\.(eml)$", filename):
|
376 |
+
doc["parser_id"] = ParserType.EMAIL.value
|
377 |
DocumentService.insert(doc)
|
378 |
|
379 |
FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id)
|