diff --git a/api/apps/api_app.py b/api/apps/api_app.py index c2fd871b9..26df561e9 100644 --- a/api/apps/api_app.py +++ b/api/apps/api_app.py @@ -87,7 +87,7 @@ def token_list(): if not tenants: return get_data_error_result(retmsg="Tenant not found!") - id = request.args.get("dialog_id", request.args["canvas_id"]) + id = request.args["dialog_id"] if "dialog_id" in request.args else request.args["canvas_id"] objs = APITokenService.query(tenant_id=tenants[0].tenant_id, dialog_id=id) return get_json_result(data=[o.to_dict() for o in objs]) except Exception as e: @@ -121,11 +121,11 @@ def stats(): "from_date", (datetime.now() - timedelta( - days=7)).strftime("%Y-%m-%d 24:00:00")), + days=7)).strftime("%Y-%m-%d 00:00:00")), request.args.get( "to_date", datetime.now().strftime("%Y-%m-%d %H:%M:%S")), - "agent" if request.args.get("canvas_id") else None) + "agent" if "canvas_id" in request.args else None) res = { "pv": [(o["dt"], o["pv"]) for o in objs], "uv": [(o["dt"], o["uv"]) for o in objs], diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 94db0c22e..76a0e4b54 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -487,7 +487,7 @@ def upload_and_parse(): def dummy(prog=None, msg=""): pass - parser_config = {"chunk_token_num": 4096, "delimiter": "\n!?。;!?", "layout_recognize": False} + parser_config = {"chunk_token_num": 4096, "delimiter": "\n!?;。;!?", "layout_recognize": False} exe = ThreadPoolExecutor(max_workers=12) threads = [] for d, blob in files: diff --git a/api/db/services/file_service.py b/api/db/services/file_service.py index 56950326c..27db6db56 100644 --- a/api/db/services/file_service.py +++ b/api/db/services/file_service.py @@ -372,6 +372,8 @@ class FileService(CommonService): doc["parser_id"] = ParserType.AUDIO.value if re.search(r"\.(ppt|pptx|pages)$", filename): doc["parser_id"] = ParserType.PRESENTATION.value + if re.search(r"\.(eml)$", filename): + doc["parser_id"] = ParserType.EMAIL.value DocumentService.insert(doc) FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id)