You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 11 месеца
преди 1 година
преди 11 месеца
преди 7 месеца
преди 7 месеца
преди 1 година
преди 1 година
преди 1 година
Introduce Plugins (#13836) Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
преди 8 месеца
преди 11 месеца
преди 1 година
преди 7 месеца
преди 1 година
преди 1 година
преди 1 година
Introduce Plugins (#13836) Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
преди 8 месеца
преди 1 година
преди 7 месеца
преди 1 година
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
преди 11 месеца
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. from enum import StrEnum
  2. from pydantic import BaseModel, ConfigDict
  3. from configs import dify_config
  4. from services.billing_service import BillingService
  5. from services.enterprise.enterprise_service import EnterpriseService
  6. class SubscriptionModel(BaseModel):
  7. plan: str = "sandbox"
  8. interval: str = ""
  9. class BillingModel(BaseModel):
  10. enabled: bool = False
  11. subscription: SubscriptionModel = SubscriptionModel()
  12. class LimitationModel(BaseModel):
  13. size: int = 0
  14. limit: int = 0
  15. class LicenseStatus(StrEnum):
  16. NONE = "none"
  17. INACTIVE = "inactive"
  18. ACTIVE = "active"
  19. EXPIRING = "expiring"
  20. EXPIRED = "expired"
  21. LOST = "lost"
  22. class LicenseModel(BaseModel):
  23. status: LicenseStatus = LicenseStatus.NONE
  24. expired_at: str = ""
  25. class FeatureModel(BaseModel):
  26. billing: BillingModel = BillingModel()
  27. members: LimitationModel = LimitationModel(size=0, limit=1)
  28. apps: LimitationModel = LimitationModel(size=0, limit=10)
  29. vector_space: LimitationModel = LimitationModel(size=0, limit=5)
  30. knowledge_rate_limit: int = 10
  31. annotation_quota_limit: LimitationModel = LimitationModel(size=0, limit=10)
  32. documents_upload_quota: LimitationModel = LimitationModel(size=0, limit=50)
  33. docs_processing: str = "standard"
  34. can_replace_logo: bool = False
  35. model_load_balancing_enabled: bool = False
  36. dataset_operator_enabled: bool = False
  37. # pydantic configs
  38. model_config = ConfigDict(protected_namespaces=())
  39. class KnowledgeRateLimitModel(BaseModel):
  40. enabled: bool = False
  41. limit: int = 10
  42. subscription_plan: str = ""
  43. class SystemFeatureModel(BaseModel):
  44. sso_enforced_for_signin: bool = False
  45. sso_enforced_for_signin_protocol: str = ""
  46. sso_enforced_for_web: bool = False
  47. sso_enforced_for_web_protocol: str = ""
  48. enable_web_sso_switch_component: bool = False
  49. enable_marketplace: bool = False
  50. max_plugin_package_size: int = dify_config.PLUGIN_MAX_PACKAGE_SIZE
  51. enable_email_code_login: bool = False
  52. enable_email_password_login: bool = True
  53. enable_social_oauth_login: bool = False
  54. is_allow_register: bool = False
  55. is_allow_create_workspace: bool = False
  56. is_email_setup: bool = False
  57. license: LicenseModel = LicenseModel()
  58. class FeatureService:
  59. @classmethod
  60. def get_features(cls, tenant_id: str) -> FeatureModel:
  61. features = FeatureModel()
  62. cls._fulfill_params_from_env(features)
  63. if dify_config.BILLING_ENABLED and tenant_id:
  64. cls._fulfill_params_from_billing_api(features, tenant_id)
  65. return features
  66. @classmethod
  67. def get_knowledge_rate_limit(cls, tenant_id: str):
  68. knowledge_rate_limit = KnowledgeRateLimitModel()
  69. if dify_config.BILLING_ENABLED and tenant_id:
  70. knowledge_rate_limit.enabled = True
  71. limit_info = BillingService.get_knowledge_rate_limit(tenant_id)
  72. knowledge_rate_limit.limit = limit_info.get("limit", 10)
  73. knowledge_rate_limit.subscription_plan = limit_info.get("subscription_plan", "sandbox")
  74. return knowledge_rate_limit
  75. @classmethod
  76. def get_system_features(cls) -> SystemFeatureModel:
  77. system_features = SystemFeatureModel()
  78. cls._fulfill_system_params_from_env(system_features)
  79. if dify_config.ENTERPRISE_ENABLED:
  80. system_features.enable_web_sso_switch_component = True
  81. cls._fulfill_params_from_enterprise(system_features)
  82. if dify_config.MARKETPLACE_ENABLED:
  83. system_features.enable_marketplace = True
  84. return system_features
  85. @classmethod
  86. def _fulfill_system_params_from_env(cls, system_features: SystemFeatureModel):
  87. system_features.enable_email_code_login = dify_config.ENABLE_EMAIL_CODE_LOGIN
  88. system_features.enable_email_password_login = dify_config.ENABLE_EMAIL_PASSWORD_LOGIN
  89. system_features.enable_social_oauth_login = dify_config.ENABLE_SOCIAL_OAUTH_LOGIN
  90. system_features.is_allow_register = dify_config.ALLOW_REGISTER
  91. system_features.is_allow_create_workspace = dify_config.ALLOW_CREATE_WORKSPACE
  92. system_features.is_email_setup = dify_config.MAIL_TYPE is not None and dify_config.MAIL_TYPE != ""
  93. @classmethod
  94. def _fulfill_params_from_env(cls, features: FeatureModel):
  95. features.can_replace_logo = dify_config.CAN_REPLACE_LOGO
  96. features.model_load_balancing_enabled = dify_config.MODEL_LB_ENABLED
  97. features.dataset_operator_enabled = dify_config.DATASET_OPERATOR_ENABLED
  98. @classmethod
  99. def _fulfill_params_from_billing_api(cls, features: FeatureModel, tenant_id: str):
  100. billing_info = BillingService.get_info(tenant_id)
  101. features.billing.enabled = billing_info["enabled"]
  102. features.billing.subscription.plan = billing_info["subscription"]["plan"]
  103. features.billing.subscription.interval = billing_info["subscription"]["interval"]
  104. if "members" in billing_info:
  105. features.members.size = billing_info["members"]["size"]
  106. features.members.limit = billing_info["members"]["limit"]
  107. if "apps" in billing_info:
  108. features.apps.size = billing_info["apps"]["size"]
  109. features.apps.limit = billing_info["apps"]["limit"]
  110. if "vector_space" in billing_info:
  111. features.vector_space.size = billing_info["vector_space"]["size"]
  112. features.vector_space.limit = billing_info["vector_space"]["limit"]
  113. if "documents_upload_quota" in billing_info:
  114. features.documents_upload_quota.size = billing_info["documents_upload_quota"]["size"]
  115. features.documents_upload_quota.limit = billing_info["documents_upload_quota"]["limit"]
  116. if "annotation_quota_limit" in billing_info:
  117. features.annotation_quota_limit.size = billing_info["annotation_quota_limit"]["size"]
  118. features.annotation_quota_limit.limit = billing_info["annotation_quota_limit"]["limit"]
  119. if "docs_processing" in billing_info:
  120. features.docs_processing = billing_info["docs_processing"]
  121. if "can_replace_logo" in billing_info:
  122. features.can_replace_logo = billing_info["can_replace_logo"]
  123. if "model_load_balancing_enabled" in billing_info:
  124. features.model_load_balancing_enabled = billing_info["model_load_balancing_enabled"]
  125. if "knowledge_rate_limit" in billing_info:
  126. features.knowledge_rate_limit = billing_info["knowledge_rate_limit"]["limit"]
  127. @classmethod
  128. def _fulfill_params_from_enterprise(cls, features):
  129. enterprise_info = EnterpriseService.get_info()
  130. if "sso_enforced_for_signin" in enterprise_info:
  131. features.sso_enforced_for_signin = enterprise_info["sso_enforced_for_signin"]
  132. if "sso_enforced_for_signin_protocol" in enterprise_info:
  133. features.sso_enforced_for_signin_protocol = enterprise_info["sso_enforced_for_signin_protocol"]
  134. if "sso_enforced_for_web" in enterprise_info:
  135. features.sso_enforced_for_web = enterprise_info["sso_enforced_for_web"]
  136. if "sso_enforced_for_web_protocol" in enterprise_info:
  137. features.sso_enforced_for_web_protocol = enterprise_info["sso_enforced_for_web_protocol"]
  138. if "enable_email_code_login" in enterprise_info:
  139. features.enable_email_code_login = enterprise_info["enable_email_code_login"]
  140. if "enable_email_password_login" in enterprise_info:
  141. features.enable_email_password_login = enterprise_info["enable_email_password_login"]
  142. if "is_allow_register" in enterprise_info:
  143. features.is_allow_register = enterprise_info["is_allow_register"]
  144. if "is_allow_create_workspace" in enterprise_info:
  145. features.is_allow_create_workspace = enterprise_info["is_allow_create_workspace"]
  146. if "license" in enterprise_info:
  147. license_info = enterprise_info["license"]
  148. if "status" in license_info:
  149. features.license.status = LicenseStatus(license_info.get("status", LicenseStatus.INACTIVE))
  150. if "expired_at" in license_info:
  151. features.license.expired_at = license_info["expired_at"]