Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #
  2. # Copyright 2024 The InfiniFlow Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. import os
  17. import logging
  18. from api.utils import get_base_config, decrypt_database_config
  19. from api.utils.file_utils import get_project_base_directory
  20. # Server
  21. RAG_CONF_PATH = os.path.join(get_project_base_directory(), "conf")
  22. ES = get_base_config("es", {})
  23. INFINITY = get_base_config("infinity", {"uri": "infinity:23817"})
  24. AZURE = get_base_config("azure", {})
  25. S3 = get_base_config("s3", {})
  26. MINIO = decrypt_database_config(name="minio")
  27. OSS = get_base_config("oss", {})
  28. try:
  29. REDIS = decrypt_database_config(name="redis")
  30. except Exception:
  31. REDIS = {}
  32. pass
  33. DOC_MAXIMUM_SIZE = int(os.environ.get("MAX_CONTENT_LENGTH", 128 * 1024 * 1024))
  34. SVR_QUEUE_NAME = "rag_flow_svr_queue"
  35. SVR_QUEUE_RETENTION = 60*60
  36. SVR_QUEUE_MAX_LEN = 1024
  37. SVR_CONSUMER_NAME = "rag_flow_svr_consumer"
  38. SVR_CONSUMER_GROUP_NAME = "rag_flow_svr_consumer_group"
  39. PAGERANK_FLD = "pagerank_fea"
  40. TAG_FLD = "tag_feas"
  41. def print_rag_settings():
  42. logging.info(f"MAX_CONTENT_LENGTH: {DOC_MAXIMUM_SIZE}")
  43. logging.info(f"SERVER_QUEUE_MAX_LEN: {SVR_QUEUE_MAX_LEN}")
  44. logging.info(f"SERVER_QUEUE_RETENTION: {SVR_QUEUE_RETENTION}")
  45. logging.info(f"MAX_FILE_COUNT_PER_USER: {int(os.environ.get('MAX_FILE_NUM_PER_USER', 0))}")