Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

settings.py 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. from api.utils.log_utils import LoggerFactory, getLogger
  21. # Server
  22. RAG_CONF_PATH = os.path.join(get_project_base_directory(), "conf")
  23. SUBPROCESS_STD_LOG_NAME = "std.log"
  24. ES = get_base_config("es", {})
  25. INFINITY = get_base_config("infinity", {"uri": "infinity:23817"})
  26. AZURE = get_base_config("azure", {})
  27. S3 = get_base_config("s3", {})
  28. MINIO = decrypt_database_config(name="minio")
  29. try:
  30. REDIS = decrypt_database_config(name="redis")
  31. except Exception:
  32. REDIS = {}
  33. pass
  34. DOC_MAXIMUM_SIZE = int(os.environ.get("MAX_CONTENT_LENGTH", 128 * 1024 * 1024))
  35. # Logger
  36. LoggerFactory.set_directory(
  37. os.path.join(
  38. get_project_base_directory(),
  39. "logs",
  40. "rag"))
  41. # {CRITICAL: 50, FATAL:50, ERROR:40, WARNING:30, WARN:30, INFO:20, DEBUG:10, NOTSET:0}
  42. LoggerFactory.LEVEL = 30
  43. doc_store_logger = getLogger("doc_store")
  44. minio_logger = getLogger("minio")
  45. s3_logger = getLogger("s3")
  46. azure_logger = getLogger("azure")
  47. cron_logger = getLogger("cron_logger")
  48. chunk_logger = getLogger("chunk_logger")
  49. database_logger = getLogger("database")
  50. formatter = logging.Formatter("%(asctime)-15s %(levelname)-8s (%(process)d) %(message)s")
  51. for logger in [doc_store_logger, minio_logger, s3_logger, azure_logger, cron_logger, chunk_logger, database_logger]:
  52. logger.setLevel(logging.INFO)
  53. for handler in logger.handlers:
  54. handler.setFormatter(fmt=formatter)
  55. SVR_QUEUE_NAME = "rag_flow_svr_queue"
  56. SVR_QUEUE_RETENTION = 60*60
  57. SVR_QUEUE_MAX_LEN = 1024
  58. SVR_CONSUMER_NAME = "rag_flow_svr_consumer"
  59. SVR_CONSUMER_GROUP_NAME = "rag_flow_svr_consumer_group"