Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

settings.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. try:
  28. REDIS = decrypt_database_config(name="redis")
  29. except Exception:
  30. REDIS = {}
  31. pass
  32. DOC_MAXIMUM_SIZE = int(os.environ.get("MAX_CONTENT_LENGTH", 128 * 1024 * 1024))
  33. SVR_QUEUE_NAME = "rag_flow_svr_queue"
  34. SVR_QUEUE_RETENTION = 60*60
  35. SVR_QUEUE_MAX_LEN = 1024
  36. SVR_CONSUMER_NAME = "rag_flow_svr_consumer"
  37. SVR_CONSUMER_GROUP_NAME = "rag_flow_svr_consumer_group"
  38. def print_rag_settings():
  39. logging.info(f"MAX_CONTENT_LENGTH: {DOC_MAXIMUM_SIZE}")
  40. logging.info(f"SERVER_QUEUE_MAX_LEN: {SVR_QUEUE_MAX_LEN}")
  41. logging.info(f"SERVER_QUEUE_RETENTION: {SVR_QUEUE_RETENTION}")
  42. logging.info(f"MAX_FILE_COUNT_PER_USER: {int(os.environ.get('MAX_FILE_NUM_PER_USER', 0))}")