Merge main

This commit is contained in:
Yeuoly
2024-09-14 02:47:01 +08:00
959 changed files with 25695 additions and 24057 deletions

View File

@ -38,6 +38,7 @@ class PluginInvokeLLMApi(Resource):
return compact_generate_response(generator())
class PluginInvokeTextEmbeddingApi(Resource):
@setup_required
@plugin_inner_api_only
@ -113,6 +114,7 @@ class PluginInvokeNodeApi(Resource):
def post(self, user_id: str, tenant_model: Tenant, payload: RequestInvokeNode):
pass
class PluginInvokeAppApi(Resource):
@setup_required
@plugin_inner_api_only
@ -134,6 +136,7 @@ class PluginInvokeAppApi(Resource):
PluginAppBackwardsInvocation.convert_to_event_stream(response)
)
class PluginInvokeEncryptApi(Resource):
@setup_required
@plugin_inner_api_only
@ -145,6 +148,7 @@ class PluginInvokeEncryptApi(Resource):
"""
return PluginEncrypter.invoke_encrypt(tenant_model, payload)
api.add_resource(PluginInvokeLLMApi, '/invoke/llm')
api.add_resource(PluginInvokeTextEmbeddingApi, '/invoke/text-embedding')
api.add_resource(PluginInvokeRerankApi, '/invoke/rerank')

View File

@ -48,6 +48,7 @@ def get_tenant(view: Optional[Callable] = None):
else:
return decorator(view)
def plugin_data(view: Optional[Callable] = None, *, payload_type: type[BaseModel]):
def decorator(view_func):
def decorated_view(*args, **kwargs):

View File

@ -63,6 +63,7 @@ def enterprise_inner_api_user_auth(view):
return decorated
def plugin_inner_api_only(view):
@wraps(view)
def decorated(*args, **kwargs):