mirror of
https://mirror.skon.top/github.com/langgenius/dify.git
synced 2026-04-20 23:40:16 +08:00
Some checks failed
autofix.ci / autofix (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
Main CI Pipeline / Check Changed Files (push) Has been cancelled
Main CI Pipeline / API Tests (push) Has been cancelled
Main CI Pipeline / Web Tests (push) Has been cancelled
Main CI Pipeline / Style Check (push) Has been cancelled
Main CI Pipeline / VDB Tests (push) Has been cancelled
Main CI Pipeline / DB Migration Test (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
from flask_restx import Resource, fields
|
|
|
|
from controllers.console import console_ns
|
|
from controllers.console.wraps import account_initialization_required, setup_required
|
|
from dify_graph.model_runtime.utils.encoders import jsonable_encoder
|
|
from libs.login import current_account_with_tenant, login_required
|
|
from services.agent_service import AgentService
|
|
|
|
|
|
@console_ns.route("/workspaces/current/agent-providers")
|
|
class AgentProviderListApi(Resource):
|
|
@console_ns.doc("list_agent_providers")
|
|
@console_ns.doc(description="Get list of available agent providers")
|
|
@console_ns.response(
|
|
200,
|
|
"Success",
|
|
fields.List(fields.Raw(description="Agent provider information")),
|
|
)
|
|
@setup_required
|
|
@login_required
|
|
@account_initialization_required
|
|
def get(self):
|
|
current_user, current_tenant_id = current_account_with_tenant()
|
|
user = current_user
|
|
|
|
user_id = user.id
|
|
tenant_id = current_tenant_id
|
|
|
|
return jsonable_encoder(AgentService.list_agent_providers(user_id, tenant_id))
|
|
|
|
|
|
@console_ns.route("/workspaces/current/agent-provider/<path:provider_name>")
|
|
class AgentProviderApi(Resource):
|
|
@console_ns.doc("get_agent_provider")
|
|
@console_ns.doc(description="Get specific agent provider details")
|
|
@console_ns.doc(params={"provider_name": "Agent provider name"})
|
|
@console_ns.response(
|
|
200,
|
|
"Success",
|
|
fields.Raw(description="Agent provider details"),
|
|
)
|
|
@setup_required
|
|
@login_required
|
|
@account_initialization_required
|
|
def get(self, provider_name: str):
|
|
current_user, current_tenant_id = current_account_with_tenant()
|
|
return jsonable_encoder(AgentService.get_agent_provider(current_user.id, current_tenant_id, provider_name))
|