feat(quota management): add end-user quota check for shared conversations
fix(default free plan): adjust free plan quota limits feat(application service): add functionality to reset Agent model parameters to default values
This commit is contained in:
@@ -271,6 +271,20 @@ def update_agent_config(
|
||||
return success(data=app_schema.AgentConfig.model_validate(cfg))
|
||||
|
||||
|
||||
@router.post("/{app_id}/config/reset", summary="重置 Agent 配置为默认状态")
|
||||
@cur_workspace_access_guard()
|
||||
def reset_agent_config(
|
||||
app_id: uuid.UUID,
|
||||
db: Session = Depends(get_db),
|
||||
current_user=Depends(get_current_user),
|
||||
):
|
||||
workspace_id = current_user.current_workspace_id
|
||||
service = AppService(db)
|
||||
cfg = service.reset_agent_config(app_id=app_id, workspace_id=workspace_id)
|
||||
cfg = enrich_agent_config(cfg)
|
||||
return success(data=app_schema.AgentConfig.model_validate(cfg), msg="Agent 配置已重置为默认状态")
|
||||
|
||||
|
||||
@router.get("/{app_id}/config", summary="获取 Agent 配置")
|
||||
@cur_workspace_access_guard()
|
||||
def get_agent_config(
|
||||
|
||||
@@ -10,6 +10,7 @@ from sqlalchemy.orm import Session
|
||||
from app.core.error_codes import BizCode
|
||||
from app.core.exceptions import BusinessException
|
||||
from app.core.logging_config import get_business_logger
|
||||
from app.core.quota_manager import check_end_user_quota
|
||||
from app.core.response_utils import success, fail
|
||||
from app.db import get_db, get_db_read
|
||||
from app.dependencies import get_share_user_id, ShareTokenData
|
||||
@@ -308,6 +309,7 @@ def get_conversation(
|
||||
"/chat",
|
||||
summary="发送消息(支持流式和非流式)"
|
||||
)
|
||||
@check_end_user_quota
|
||||
async def chat(
|
||||
payload: conversation_schema.ChatRequest,
|
||||
share_data: ShareTokenData = Depends(get_share_user_id),
|
||||
|
||||
Reference in New Issue
Block a user