Skip to content

Commit

Permalink
ToolConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 committed Jun 15, 2024
1 parent cf47865 commit 006dc60
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
4 changes: 0 additions & 4 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
'INVITE_EXPIRY_HOURS': 72,
'ETL_TYPE': 'dify',
'KEYWORD_STORE': 'jieba',
'TOOL_ICON_CACHE_MAX_AGE': 3600,
'MILVUS_DATABASE': 'default',
'KEYWORD_DATA_SOURCE_TYPE': 'database',
'INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH': 1000,
Expand Down Expand Up @@ -261,9 +260,6 @@ def __init__(self):
# Indexing Configurations.
self.INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH = get_env('INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH')

# Tool Configurations.
self.TOOL_ICON_CACHE_MAX_AGE = get_env('TOOL_ICON_CACHE_MAX_AGE')

# ------------------------
# Platform Configurations.
# ------------------------
Expand Down
32 changes: 22 additions & 10 deletions api/configs/feature/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,33 @@ class ModerationConfigs(BaseModel):
)


class ToolConfigs(BaseModel):
"""
Tool configs
"""

TOOL_ICON_CACHE_MAX_AGE: PositiveInt = Field(
description='max age in seconds for tool icon caching',
default=3600,
)


class FeatureConfigs(
OAuthConfigs,
ModerationConfigs,
AppExecutionConfigs,
BillingConfigs,
CodeExecutionSandboxConfigs,
EndpointConfigs,
FileAccessConfigs,
FileUploadConfigs,
HttpConfigs,
InnerAPIConfigs,
LoggingConfigs,
ModelLoadBalanceConfigs,
ModerationConfigs,
OAuthConfigs,
SecurityConfigs,
InnerAPIConfigs,
AppExecutionConfigs,
WorkflowConfigs,
CodeExecutionSandboxConfigs,
FileUploadConfigs,
FileAccessConfigs,
ToolConfigs,
UpdateConfigs,
ModelLoadBalanceConfigs,
BillingConfigs,
WorkflowConfigs,
):
pass
2 changes: 1 addition & 1 deletion api/controllers/console/workspace/tool_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ToolBuiltinProviderIconApi(Resource):
@setup_required
def get(self, provider):
icon_bytes, mimetype = BuiltinToolManageService.get_builtin_tool_provider_icon(provider)
icon_cache_max_age = int(current_app.config.get('TOOL_ICON_CACHE_MAX_AGE'))
icon_cache_max_age = current_app.config.get('TOOL_ICON_CACHE_MAX_AGE')
return send_file(io.BytesIO(icon_bytes), mimetype=mimetype, max_age=icon_cache_max_age)

class ToolApiProviderAddApi(Resource):
Expand Down

0 comments on commit 006dc60

Please sign in to comment.