mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 01:26:33 +08:00
feat: add knowledge pipeline creation feature
This commit is contained in:
parent
153d5e8f03
commit
cfc555d05d
@ -9,6 +9,7 @@ from controllers.console.wraps import (
|
|||||||
account_initialization_required,
|
account_initialization_required,
|
||||||
enterprise_license_required,
|
enterprise_license_required,
|
||||||
setup_required,
|
setup_required,
|
||||||
|
knowledge_pipeline_publish_enabled,
|
||||||
)
|
)
|
||||||
from extensions.ext_database import db
|
from extensions.ext_database import db
|
||||||
from libs.login import login_required
|
from libs.login import login_required
|
||||||
@ -116,6 +117,7 @@ class PublishCustomizedPipelineTemplateApi(Resource):
|
|||||||
@login_required
|
@login_required
|
||||||
@account_initialization_required
|
@account_initialization_required
|
||||||
@enterprise_license_required
|
@enterprise_license_required
|
||||||
|
@knowledge_pipeline_publish_enabled
|
||||||
def post(self, pipeline_id: str):
|
def post(self, pipeline_id: str):
|
||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
@ -261,3 +261,13 @@ def is_allow_transfer_owner(view):
|
|||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
return decorated
|
return decorated
|
||||||
|
|
||||||
|
|
||||||
|
def knowledge_pipeline_publish_enabled(view):
|
||||||
|
@wraps(view)
|
||||||
|
def decorated(*args, **kwargs):
|
||||||
|
features = FeatureService.get_features(current_user.current_tenant_id)
|
||||||
|
if features.knowledge_pipeline.publish_enabled:
|
||||||
|
return view(*args, **kwargs)
|
||||||
|
abort(403)
|
||||||
|
return decorated
|
||||||
|
|||||||
@ -87,6 +87,8 @@ class WebAppAuthModel(BaseModel):
|
|||||||
allow_email_code_login: bool = False
|
allow_email_code_login: bool = False
|
||||||
allow_email_password_login: bool = False
|
allow_email_password_login: bool = False
|
||||||
|
|
||||||
|
class KnowledgePipeline(BaseModel):
|
||||||
|
publish_enabled: bool = False
|
||||||
|
|
||||||
class PluginInstallationScope(StrEnum):
|
class PluginInstallationScope(StrEnum):
|
||||||
NONE = "none"
|
NONE = "none"
|
||||||
@ -126,6 +128,7 @@ class FeatureModel(BaseModel):
|
|||||||
is_allow_transfer_workspace: bool = True
|
is_allow_transfer_workspace: bool = True
|
||||||
# pydantic configs
|
# pydantic configs
|
||||||
model_config = ConfigDict(protected_namespaces=())
|
model_config = ConfigDict(protected_namespaces=())
|
||||||
|
knowledge_pipeline: KnowledgePipeline = KnowledgePipeline()
|
||||||
|
|
||||||
|
|
||||||
class KnowledgeRateLimitModel(BaseModel):
|
class KnowledgeRateLimitModel(BaseModel):
|
||||||
@ -265,6 +268,9 @@ class FeatureService:
|
|||||||
if "knowledge_rate_limit" in billing_info:
|
if "knowledge_rate_limit" in billing_info:
|
||||||
features.knowledge_rate_limit = billing_info["knowledge_rate_limit"]["limit"]
|
features.knowledge_rate_limit = billing_info["knowledge_rate_limit"]["limit"]
|
||||||
|
|
||||||
|
if "knowledge_pipeline_publish_enabled" in billing_info:
|
||||||
|
features.knowledge_pipeline.publish_enabled = billing_info["knowledge_pipeline_publish_enabled"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _fulfill_params_from_enterprise(cls, features: SystemFeatureModel):
|
def _fulfill_params_from_enterprise(cls, features: SystemFeatureModel):
|
||||||
enterprise_info = EnterpriseService.get_info()
|
enterprise_info = EnterpriseService.get_info()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user