{"record":{"id":"f3ccc6d6c95a84c7","repo":"binary-husky/gpt_academic","slug":"endpoint-azure-endpoint-endpoint-e","errorCode":null,"errorMessage":"Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:{endpoint}","messagePattern":"Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"request_llms/bridge_openrouter.py","lineNumber":119,"sourceCode":"    try:\n        chunkjson = json.loads(chunk_decoded[6:])\n        has_choices = 'choices' in chunkjson\n        if has_choices: choice_valid = (len(chunkjson['choices']) > 0)\n        if has_choices and choice_valid: has_content = (\"content\" in chunkjson['choices'][0][\"delta\"])\n        if has_content: has_content = (chunkjson['choices'][0][\"delta\"][\"content\"] is not None)\n        if has_choices and choice_valid: has_role = \"role\" in chunkjson['choices'][0][\"delta\"]\n    except:\n        pass\n    return chunk_decoded, chunkjson, has_choices, choice_valid, has_content, has_role\n\nfrom functools import lru_cache\n@lru_cache(maxsize=32)\ndef verify_endpoint(endpoint):\n    \"\"\"\n        检查endpoint是否可用\n    \"\"\"\n    if \"你亲手写的api名称\" in endpoint:\n        raise ValueError(\"Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:\" + endpoint)\n    return endpoint\n\ndef predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str=\"\", observe_window:list=None, console_silence:bool=False):\n    \"\"\"\n    发送至chatGPT，等待回复，一次性完成，不显示中间过程。但内部用stream的方法避免中途网线被掐。\n    inputs：\n        是本次问询的输入\n    sys_prompt:\n        系统静默prompt\n    llm_kwargs：\n        chatGPT的内部调优参数\n    history：\n        是之前的对话列表\n    observe_window = None：\n        用于负责跨越线程传递已经输出的部分，大部分时候仅仅为了fancy的视觉效果，留空即可。observe_window[0]：观测窗。observe_window[1]：看门狗\n    \"\"\"\n    from request_llms.bridge_all import model_info\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_openrouter.py#L101-L137","documentation":"ValueError from verify_endpoint in bridge_openrouter, an lru_cache'd guard that rejects any AZURE_ENDPOINT still containing the literal placeholder text '你亲手写的api名称' ('the api name you wrote by hand') copied from the config template. It exists to fail fast before an HTTP request is made with an obviously unedited endpoint.","triggerScenarios":"AZURE_ENDPOINT in config.py (or environment) left as the template placeholder; deploying with the stock config_private.py.example values; cached stale config after editing but before process restart (lru_cache also caches the pass result).","commonSituations":"Fresh clone where the user copied config.py defaults without filling in their Azure deployment name; CI using template config; renaming the Azure deployment but not the config.","solutions":["Set AZURE_ENDPOINT in config_private.py to your real Azure OpenAI endpoint URL (https://<resource>.openai.azure.com)","Restart the process after editing config so the lru_cache on verify_endpoint is cleared","Grep the config for leftover placeholder text (你亲手写的api名称) and replace every occurrence"],"exampleFix":"# before\nAZURE_ENDPOINT = \"https://你亲手写的api名称.openai.azure.com\"\n\n# after\nAZURE_ENDPOINT = \"https://my-real-resource.openai.azure.com\"","handlingStrategy":"validation","validationCode":"from config import AZURE_ENDPOINT\nassert AZURE_ENDPOINT and '你亲手写的api名称' not in AZURE_ENDPOINT, \\\n    'AZURE_ENDPOINT still contains the template placeholder'\nassert AZURE_ENDPOINT.startswith('https://') and '.openai.azure.com' in AZURE_ENDPOINT","typeGuard":null,"tryCatchPattern":"try:\n    verify_endpoint(endpoint)\nexcept ValueError as e:\n    print(f'Fix config before running: {e}')\n    sys.exit(2)","preventionTips":["Add a startup config lint that rejects known template placeholders across all config keys","Restart the process after config edits - verify_endpoint is lru_cached","Use config_private.py so template text in config.py never leaks into runtime"],"tags":["openrouter","azure","configuration","endpoint","validation"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}