-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/chore-fix' into dev/plugin-deploy
- Loading branch information
Showing
5 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from flask_login import current_user | ||
from flask_restful import Resource | ||
|
||
from controllers.console import api | ||
from controllers.console.wraps import account_initialization_required, setup_required | ||
from core.model_runtime.utils.encoders import jsonable_encoder | ||
from libs.login import login_required | ||
from services.agent_service import AgentService | ||
|
||
|
||
class AgentProviderListApi(Resource): | ||
@setup_required | ||
@login_required | ||
@account_initialization_required | ||
def get(self): | ||
user = current_user | ||
|
||
user_id = user.id | ||
tenant_id = user.current_tenant_id | ||
|
||
return jsonable_encoder(AgentService.list_agent_providers(user_id, tenant_id)) | ||
|
||
|
||
class AgentProviderApi(Resource): | ||
@setup_required | ||
@login_required | ||
@account_initialization_required | ||
def get(self, provider_name: str): | ||
user = current_user | ||
user_id = user.id | ||
tenant_id = user.current_tenant_id | ||
return jsonable_encoder(AgentService.get_agent_provider(user_id, tenant_id, provider_name)) | ||
|
||
|
||
api.add_resource(AgentProviderListApi, "/workspaces/current/agent-providers") | ||
api.add_resource(AgentProviderApi, "/workspaces/current/agent-provider/<path:provider_name>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters