Skip to content

Commit 4947265

Browse files
committed
tests: fixed broken test in CI
1 parent 6d00be7 commit 4947265

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

gptme/tools/chats.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def _format_message_snippet(msg: Message, max_length: int = 100) -> str:
2323
)
2424

2525

26-
def _get_matching_messages(log_manager, query: str) -> list[Message]:
26+
def _get_matching_messages(log_manager, query: str, system=False) -> list[Message]:
2727
"""Get messages matching the query."""
2828
return [
2929
msg
3030
for msg in log_manager.log
3131
if query.lower() in msg.content.lower()
32-
if msg.role != "system"
32+
if msg.role != "system" or system
3333
]
3434

3535

@@ -91,13 +91,14 @@ def list_chats(max_results: int = 5, include_summary: bool = False) -> None:
9191
print("\n".join(summary_lines))
9292

9393

94-
def search_chats(query: str, max_results: int = 5) -> None:
94+
def search_chats(query: str, max_results: int = 5, system=False) -> None:
9595
"""
9696
Search past conversation logs for the given query and print a summary of the results.
9797
9898
Args:
9999
query (str): The search query.
100100
max_results (int): Maximum number of conversations to display.
101+
system (bool): Whether to include system messages in the search.
101102
"""
102103
# noreorder
103104
from ..logmanager import LogManager, get_conversations # fmt: skip
@@ -107,7 +108,7 @@ def search_chats(query: str, max_results: int = 5) -> None:
107108
log_path = Path(conv["path"])
108109
log_manager = LogManager.load(log_path)
109110

110-
matching_messages = _get_matching_messages(log_manager, query)
111+
matching_messages = _get_matching_messages(log_manager, query, system)
111112

112113
if matching_messages:
113114
results.append(

tests/test_tools_chats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ def test_list_chats(capsys):
88

99

1010
def test_search_chats(capsys):
11-
search_chats("python")
11+
search_chats("python", system=True)
1212
captured = capsys.readouterr()
1313
assert "Found matches" in captured.out

0 commit comments

Comments
 (0)