@@ -23,13 +23,13 @@ def _format_message_snippet(msg: Message, max_length: int = 100) -> str:
23
23
)
24
24
25
25
26
- def _get_matching_messages (log_manager , query : str ) -> list [Message ]:
26
+ def _get_matching_messages (log_manager , query : str , system = False ) -> list [Message ]:
27
27
"""Get messages matching the query."""
28
28
return [
29
29
msg
30
30
for msg in log_manager .log
31
31
if query .lower () in msg .content .lower ()
32
- if msg .role != "system"
32
+ if msg .role != "system" or system
33
33
]
34
34
35
35
@@ -91,13 +91,14 @@ def list_chats(max_results: int = 5, include_summary: bool = False) -> None:
91
91
print ("\n " .join (summary_lines ))
92
92
93
93
94
- def search_chats (query : str , max_results : int = 5 ) -> None :
94
+ def search_chats (query : str , max_results : int = 5 , system = False ) -> None :
95
95
"""
96
96
Search past conversation logs for the given query and print a summary of the results.
97
97
98
98
Args:
99
99
query (str): The search query.
100
100
max_results (int): Maximum number of conversations to display.
101
+ system (bool): Whether to include system messages in the search.
101
102
"""
102
103
# noreorder
103
104
from ..logmanager import LogManager , get_conversations # fmt: skip
@@ -107,7 +108,7 @@ def search_chats(query: str, max_results: int = 5) -> None:
107
108
log_path = Path (conv ["path" ])
108
109
log_manager = LogManager .load (log_path )
109
110
110
- matching_messages = _get_matching_messages (log_manager , query )
111
+ matching_messages = _get_matching_messages (log_manager , query , system )
111
112
112
113
if matching_messages :
113
114
results .append (
0 commit comments