@@ -229,6 +229,7 @@ class AddTokenRequest(BaseModel):
229229 project_id : Optional [str ] = None # 用户可选输入project_id
230230 project_name : Optional [str ] = None
231231 remark : Optional [str ] = None
232+ captcha_proxy_url : Optional [str ] = None
232233 image_enabled : bool = True
233234 video_enabled : bool = True
234235 image_concurrency : int = - 1
@@ -240,6 +241,7 @@ class UpdateTokenRequest(BaseModel):
240241 project_id : Optional [str ] = None # 用户可选输入project_id
241242 project_name : Optional [str ] = None
242243 remark : Optional [str ] = None
244+ captcha_proxy_url : Optional [str ] = None
243245 image_enabled : Optional [bool ] = None
244246 video_enabled : Optional [bool ] = None
245247 image_concurrency : Optional [int ] = None
@@ -301,6 +303,7 @@ class ImportTokenItem(BaseModel):
301303 access_token : Optional [str ] = None
302304 session_token : Optional [str ] = None
303305 is_active : bool = True
306+ captcha_proxy_url : Optional [str ] = None
304307 image_enabled : bool = True
305308 video_enabled : bool = True
306309 image_concurrency : int = - 1
@@ -411,6 +414,7 @@ async def get_tokens(token: str = Depends(verify_admin_token)):
411414 "user_paygate_tier" : row .get ("user_paygate_tier" ),
412415 "current_project_id" : row .get ("current_project_id" ), # 🆕 项目ID
413416 "current_project_name" : row .get ("current_project_name" ), # 🆕 项目名称
417+ "captcha_proxy_url" : row .get ("captcha_proxy_url" ) or "" ,
414418 "image_enabled" : bool (row .get ("image_enabled" )),
415419 "video_enabled" : bool (row .get ("video_enabled" )),
416420 "image_concurrency" : row .get ("image_concurrency" ),
@@ -433,6 +437,7 @@ async def add_token(
433437 project_id = request .project_id , # 🆕 支持用户指定project_id
434438 project_name = request .project_name ,
435439 remark = request .remark ,
440+ captcha_proxy_url = request .captcha_proxy_url .strip () if request .captcha_proxy_url is not None else None ,
436441 image_enabled = request .image_enabled ,
437442 video_enabled = request .video_enabled ,
438443 image_concurrency = request .image_concurrency ,
@@ -495,6 +500,7 @@ async def update_token(
495500 project_id = request .project_id ,
496501 project_name = request .project_name ,
497502 remark = request .remark ,
503+ captcha_proxy_url = request .captcha_proxy_url .strip () if request .captcha_proxy_url is not None else None ,
498504 image_enabled = request .image_enabled ,
499505 video_enabled = request .video_enabled ,
500506 image_concurrency = request .image_concurrency ,
@@ -695,6 +701,7 @@ async def import_tokens(
695701 st = st ,
696702 at = at ,
697703 at_expires = at_expires ,
704+ captcha_proxy_url = item .captcha_proxy_url .strip () if item .captcha_proxy_url is not None else None ,
698705 image_enabled = item .image_enabled ,
699706 video_enabled = item .video_enabled ,
700707 image_concurrency = item .image_concurrency ,
@@ -707,6 +714,7 @@ async def import_tokens(
707714 existing .st = st
708715 existing .at = at
709716 existing .at_expires = at_expires
717+ existing .captcha_proxy_url = item .captcha_proxy_url
710718 existing .image_enabled = item .image_enabled
711719 existing .video_enabled = item .video_enabled
712720 existing .image_concurrency = item .image_concurrency
@@ -716,6 +724,7 @@ async def import_tokens(
716724 # 添加新Token
717725 new_token = await token_manager .add_token (
718726 st = st ,
727+ captcha_proxy_url = item .captcha_proxy_url .strip () if item .captcha_proxy_url is not None else None ,
719728 image_enabled = item .image_enabled ,
720729 video_enabled = item .video_enabled ,
721730 image_concurrency = item .image_concurrency ,
0 commit comments