加入限流策略。防止过度消耗资源
This commit is contained in:
@@ -136,7 +136,7 @@ class DifyPlugin(MessagePluginInterface):
|
|||||||
|
|
||||||
@plugin_stats_decorator(plugin_name="Dify聊天")
|
@plugin_stats_decorator(plugin_name="Dify聊天")
|
||||||
@plugin_points_cost(2, "AI聊天消耗积分", FEATURE_KEY)
|
@plugin_points_cost(2, "AI聊天消耗积分", FEATURE_KEY)
|
||||||
@group_feature_rate_limit(max_per_minute=1, feature_key=FEATURE_KEY)
|
@group_feature_rate_limit(max_per_minute=5, feature_key=FEATURE_KEY)
|
||||||
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||||
"""处理消息"""
|
"""处理消息"""
|
||||||
content = str(message.get("content", "")).strip()
|
content = str(message.get("content", "")).strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user