Skip to content

fix(godcmd): answer when #model is given more than one argument - #3305

Merged
zhayujie merged 1 commit into
zhayujie:masterfrom
Lesereingrape:fix/godcmd-model-argument
Sep 29, 2026
Merged

zhayujie merged 1 commit into
zhayujie:masterfrom
Lesereingrape:fix/godcmd-model-argument

Conversation

@Lesereingrape

Copy link
Copy Markdown
Contributor

What

#model (#模型) handled no arguments and exactly one argument, and nothing else, so #model gpt-4o now matched no branch and left the internal result = "string" placeholder (plugins/godcmd/godcmd.py:262) as the reply body -- the bot sent the bare word string back to the user. The branch now answers a wrong argument count with usage text, 请提供一个模型名称, the way its two one-argument siblings already do (set_openai_api_key line 305, set_gpt_model line 319). Zero-argument and single-argument behaviour is untouched, including the existing 模型名称不存在 answer.

Fixes #3304

Checks

  • RED on the current tip (86718f9), production code untouched -- pytest tests/test_godcmd_model_argument_count.py fails the first case with AssertionError: assert 'string' != 'string', i.e. the reply the user is handed really is the placeholder.
  • GREEN after the change: 3 passed.
  • Whole suite on the same tip, before and after: the FAILED set is identical (32 pre-existing failures, all environment-bound on Windows -- scheduler timezone, symlink pruning, the rg backend parity case, /proc/self/environ probes). passed goes 2259 -> 2262, exactly the three new cases.
  • Repo's own lint gate (ruff check --select F --ignore F403,F405) on both changed files: All checks passed.

The new tests build the plugin against a tmp_path config carrying admin_users and stub conf() and Bridge, so no network is touched and no Bridge().reset_bot() is called; conf()["model"] is never written.

The model branch only handled no arguments and exactly one, so "#model gpt-4o
now" matched nothing and left the internal result = "string" placeholder as
the reply body the user was sent. Its two one-argument siblings,
set_openai_api_key and set_gpt_model, both answer a wrong argument count with
usage text; the branch now does the same.
@zhayujie
zhayujie merged commit 1c4b7fc into zhayujie:master Sep 29, 2026
3 checks passed
@zhayujie

Copy link
Copy Markdown
Owner

Merged, thanks! We'll tweak the message on master to "只能指定一个模型名称", since this branch only fires on more than one argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

godcmd: #model with more than one argument replies with the internal placeholder "string"

2 participants