2121# Hard-coded interface so the workflow stays deterministic.
2222OPENAI_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
2323OPENAI_MODEL = "deepseek-chat"
24- QQ_ENDPOINT = "http://119.23.57.80:53000/_send_group_notice"
25- QQ_GROUP_ID = 457054386
2624QQ_MAX_RETRIES = 5
2725PROMPT_TEMPLATE_PATH = Path (__file__ ).with_name ("design_announce_prompt.txt" )
2826
@@ -419,18 +417,18 @@ def _http_post(url: str, payload: bytes, headers: dict[str, str]) -> str:
419417 raise RuntimeError (f"HTTP request failed: { exc } " ) from exc
420418
421419
422- def send_to_qq (message : str , path : Path , dry_run : bool ) -> None :
420+ def send_to_qq (message : str , path : Path , dry_run : bool , qq_endpoint : str , qq_group_id : int ) -> None :
423421 if dry_run :
424422 logging .info ("Dry run QQ dispatch for %s:\n %s" , path , message )
425423 return
426- payload = json .dumps ({"group_id" : QQ_GROUP_ID , "content" : message }).encode ("utf-8" )
424+ payload = json .dumps ({"group_id" : qq_group_id , "content" : message }).encode ("utf-8" )
427425 headers = {
428426 "Content-Type" : "application/json" ,
429427 "Authorization" : "Bearer rmstoken" ,
430428 }
431429 for attempt in range (1 , QQ_MAX_RETRIES + 1 ):
432430 try :
433- _http_post (QQ_ENDPOINT , payload , headers )
431+ _http_post (qq_endpoint , payload , headers )
434432 logging .info ("QQ announcement sent for %s on attempt %d" , path , attempt )
435433 return
436434 except RuntimeError as exc :
@@ -468,6 +466,19 @@ def main() -> int:
468466 if not api_key :
469467 logging .error ("API key is missing; use --key or set OPENAI_API_KEY" )
470468 return 1
469+ qq_endpoint = os .getenv ("QQ_ENDPOINT" )
470+ if not qq_endpoint :
471+ logging .error ("QQ endpoint is missing; set QQ_ENDPOINT environment variable" )
472+ return 1
473+ qq_group_id_str = os .getenv ("QQ_GROUP_ID" )
474+ if not qq_group_id_str :
475+ logging .error ("QQ group ID is missing; set QQ_GROUP_ID environment variable" )
476+ return 1
477+ try :
478+ qq_group_id = int (qq_group_id_str )
479+ except ValueError :
480+ logging .error ("QQ_GROUP_ID must be an integer, got: %s" , qq_group_id_str )
481+ return 1
471482 range_spec , base_commit = determine_range (args .base )
472483 repo_root = get_repo_root ()
473484 changed_files = gather_changed_files (range_spec )
@@ -486,7 +497,7 @@ def main() -> int:
486497 return 0
487498 # Generate single combined announcement for all files.
488499 announcement = summarize_all_files (files_with_chunks , args .dry_run , api_key )
489- send_to_qq (announcement , Path ("combined" ), args .dry_run )
500+ send_to_qq (announcement , Path ("combined" ), args .dry_run , qq_endpoint , qq_group_id )
490501 logging .info ("Processed %d markdown files in single announcement." , len (files_with_chunks ))
491502 return 0
492503
0 commit comments