{"record":{"id":"7592786ab4648ab4","repo":"binary-husky/gpt_academic","slug":"model-override","errorCode":null,"errorMessage":"模型覆盖参数 '{model_override}' 指向一个暂不支持的模型，请检查配置文件。","messagePattern":"模型覆盖参数 '(.+?)' 指向一个暂不支持的模型，请检查配置文件。","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"request_llms/bridge_all.py","lineNumber":1532,"sourceCode":"\n        window_mutex[-1] = False # stop mutex thread\n        res = '<br/><br/>\\n\\n---\\n\\n'.join(return_string_collect)\n        return res\n\n# 根据基础功能区 ModelOverride 参数调整模型类型，用于 `predict` 中\nimport importlib\nimport core_functional\nfrom shared_utils.doc_loader_dynamic import start_with_url, load_web_content, contain_uploaded_files, load_uploaded_files\n\ndef execute_model_override(llm_kwargs, additional_fn, method):\n    functional = core_functional.get_core_functions()\n    if (additional_fn in functional) and 'ModelOverride' in functional[additional_fn]:\n        # 热更新Prompt & ModelOverride\n        importlib.reload(core_functional)\n        functional = core_functional.get_core_functions()\n        model_override = functional[additional_fn]['ModelOverride']\n        if model_override not in model_info:\n            raise ValueError(f\"模型覆盖参数 '{model_override}' 指向一个暂不支持的模型，请检查配置文件。\")\n        method = model_info[model_override][\"fn_with_ui\"]\n        llm_kwargs['llm_model'] = model_override\n        return llm_kwargs, additional_fn, method\n    # 默认返回原参数\n    return llm_kwargs, additional_fn, method\n\ndef predict(inputs:str, llm_kwargs:dict, plugin_kwargs:dict, chatbot,\n            history:list=[], system_prompt:str='', stream:bool=True, additional_fn:str=None):\n    \"\"\"\n    发送至LLM，流式获取输出。\n    用于基础的对话功能。\n\n    完整参数列表：\n        predict(\n            inputs:str,                     # 是本次问询的输入\n            llm_kwargs:dict,                # 是LLM的内部调优参数\n            plugin_kwargs:dict,             # 是插件的内部参数\n            chatbot:ChatBotWithCookies,     # 原样传递，负责向用户前端展示对话，兼顾前端状态的功能","sourceCodeStart":1514,"sourceCodeEnd":1550,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/request_llms/bridge_all.py#L1514-L1550","documentation":"execute_model_override looks up the 'ModelOverride' value of the selected core function (additional_fn) inside model_info; if that model name is not a registered model, it raises ValueError pointing at the config. model_info is the full registry built at import of bridge_all (built-in providers plus AZURE_CFG_ARRAY entries), so this error means the override target is unknown to that registry.","triggerScenarios":"core_functional config defines a function (e.g. a '翻译' button) with ModelOverride: 'gpt-4-something' while model_info only knows names like 'gpt-3.5-turbo', 'azure-...', etc.; triggered on the first predict() call that uses that additional_fn. Also occurs if the override names an AZURE_CFG_ARRAY model on a host where the Azure config block is empty.","commonSituations":"See trigger scenarios.","solutions":["Print/inspect the valid names: from request_llms.bridge_all import model_info; print(list(model_info)) and pick one of those for ModelOverride.","Fix the ModelOverride string in the core function config (exact name, watch case and hyphens).","If the target is an Azure model, ensure AZURE_CFG_ARRAY defines it (with the azure- prefix, see error 97) on this machine.","Remove the ModelOverride key entirely if the default model should be used."],"exampleFix":"# before (core_functional config)\n'翻译': {'ModelOverride': 'GPT4-32k', ...}\n\n# after\nfrom request_llms.bridge_all import model_info\nassert 'gpt-4-32k' in model_info  # pick a name from this list\n'翻译': {'ModelOverride': 'gpt-4-32k', ...}","handlingStrategy":"validation","validationCode":"from request_llms.bridge_all import model_info\n\ndef override_ok(fn_cfg: dict) -> bool:\n    mo = fn_cfg.get('ModelOverride')\n    return mo is None or mo in model_info\n\nfor name, cfg in core_functional.get_core_functions().items():\n    if not override_ok(cfg):\n        raise SystemExit(f'{name}: ModelOverride {cfg[\"ModelOverride\"]!r} is not a known model')","typeGuard":null,"tryCatchPattern":"try:\n    predict(inputs, llm_kwargs, plugin_kwargs, chatbot, additional_fn=fn)\nexcept ValueError as e:\n    if 'ModelOverride' in str(e):\n        chatbot.append(['Model override misconfigured', str(e)])\n        return  # keep chat alive, skip this generation\n    raise","preventionTips":["After editing ModelOverride, assert the name exists in model_info before starting a session.","Keep a one-line script listing valid model names next to your config for copy-paste.","Remember AZURE_CFG_ARRAY models exist only on hosts where that block is configured."],"tags":["configuration","model-registry","model-override","validation","bridge"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}