mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 23:47:54 +08:00
cli/slash: remove the /clear command
This commit is contained in:
@@ -478,14 +478,6 @@ slash.add_command(quit_cmd, name="exit")
|
|||||||
slash.add_command(quit_cmd, name="q")
|
slash.add_command(quit_cmd, name="q")
|
||||||
|
|
||||||
|
|
||||||
@slash.command("clear")
|
|
||||||
@click.pass_obj
|
|
||||||
def clear_cmd(state: ReplState) -> None:
|
|
||||||
"""Clear in-memory conversation (keeps session id)."""
|
|
||||||
state.agent.messages.clear()
|
|
||||||
click.echo("conversation cleared (in-memory only; DB history kept)")
|
|
||||||
|
|
||||||
|
|
||||||
@slash.command("edit")
|
@slash.command("edit")
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def edit_cmd(state: ReplState) -> None:
|
def edit_cmd(state: ReplState) -> None:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ for every printed row (``-vv``).
|
|||||||
Numbering is a **display ordinal** over the conversation rows (1-based, in the
|
Numbering is a **display ordinal** over the conversation rows (1-based, in the
|
||||||
order the session holds them): it is what ``/history`` prints and what
|
order the session holds them): it is what ``/history`` prints and what
|
||||||
``/history --message N`` addresses. Database row numbers are deliberately never
|
``/history --message N`` addresses. Database row numbers are deliberately never
|
||||||
shown or used — they are an implementation detail that shifts with ``/clear``.
|
shown or used — they are an implementation detail of the store.
|
||||||
Local-only rows (the injected system prompt) have no number.
|
Local-only rows (the injected system prompt) have no number.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ def test_completer_help_commands(tmp_path: object, monkeypatch: object) -> None:
|
|||||||
found.append(item)
|
found.append(item)
|
||||||
index += 1
|
index += 1
|
||||||
assert "compact" in found
|
assert "compact" in found
|
||||||
assert "clear" in found
|
assert "config" in found
|
||||||
|
|
||||||
|
|
||||||
def test_completer_stream_on_off(tmp_path: object, monkeypatch: object) -> None:
|
def test_completer_stream_on_off(tmp_path: object, monkeypatch: object) -> None:
|
||||||
|
|||||||
@@ -87,11 +87,8 @@ async def state(tmp_path: Path) -> AsyncIterator[ReplState]:
|
|||||||
await memory.close()
|
await memory.close()
|
||||||
|
|
||||||
|
|
||||||
async def test_help_and_clear(state: ReplState) -> None:
|
async def test_help(state: ReplState) -> None:
|
||||||
assert await handle_slash(state, "/help") is True
|
assert await handle_slash(state, "/help") is True
|
||||||
state.agent.messages.append(AssistantChatMessage(content="x"))
|
|
||||||
assert await handle_slash(state, "/clear") is True
|
|
||||||
assert state.agent.messages == []
|
|
||||||
|
|
||||||
|
|
||||||
async def test_auto_continue_limits_installs_on_limit(tmp_path: Path) -> None:
|
async def test_auto_continue_limits_installs_on_limit(tmp_path: Path) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user