mirror of
https://github.com/openai/codex.git
synced 2026-05-03 21:01:55 +03:00
feat: add search term to thread list (#12578)
Add `searchTerm` to `thread/list` that will search for a match in the titles (the condition being `searchTerm` $$\in$$ `title`)
This commit is contained in:
@@ -160,6 +160,7 @@ fn sanitize_rollout_item_for_persistence(
|
||||
|
||||
impl RolloutRecorder {
|
||||
/// List threads (rollout files) under the provided Codex home directory.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn list_threads(
|
||||
config: &Config,
|
||||
page_size: usize,
|
||||
@@ -168,6 +169,7 @@ impl RolloutRecorder {
|
||||
allowed_sources: &[SessionSource],
|
||||
model_providers: Option<&[String]>,
|
||||
default_provider: &str,
|
||||
search_term: Option<&str>,
|
||||
) -> std::io::Result<ThreadsPage> {
|
||||
Self::list_threads_with_db_fallback(
|
||||
config,
|
||||
@@ -178,11 +180,13 @@ impl RolloutRecorder {
|
||||
model_providers,
|
||||
default_provider,
|
||||
false,
|
||||
search_term,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// List archived threads (rollout files) under the archived sessions directory.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn list_archived_threads(
|
||||
config: &Config,
|
||||
page_size: usize,
|
||||
@@ -191,6 +195,7 @@ impl RolloutRecorder {
|
||||
allowed_sources: &[SessionSource],
|
||||
model_providers: Option<&[String]>,
|
||||
default_provider: &str,
|
||||
search_term: Option<&str>,
|
||||
) -> std::io::Result<ThreadsPage> {
|
||||
Self::list_threads_with_db_fallback(
|
||||
config,
|
||||
@@ -201,6 +206,7 @@ impl RolloutRecorder {
|
||||
model_providers,
|
||||
default_provider,
|
||||
true,
|
||||
search_term,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -215,6 +221,7 @@ impl RolloutRecorder {
|
||||
model_providers: Option<&[String]>,
|
||||
default_provider: &str,
|
||||
archived: bool,
|
||||
search_term: Option<&str>,
|
||||
) -> std::io::Result<ThreadsPage> {
|
||||
let codex_home = config.codex_home.as_path();
|
||||
// Filesystem-first listing intentionally overfetches so we can repair stale/missing
|
||||
@@ -275,6 +282,7 @@ impl RolloutRecorder {
|
||||
allowed_sources,
|
||||
model_providers,
|
||||
archived,
|
||||
search_term,
|
||||
)
|
||||
.await
|
||||
{
|
||||
@@ -312,6 +320,7 @@ impl RolloutRecorder {
|
||||
allowed_sources,
|
||||
model_providers,
|
||||
false,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
else {
|
||||
@@ -1154,6 +1163,7 @@ mod tests {
|
||||
&[],
|
||||
None,
|
||||
default_provider.as_str(),
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(page1.items.len(), 1);
|
||||
@@ -1168,6 +1178,7 @@ mod tests {
|
||||
&[],
|
||||
None,
|
||||
default_provider.as_str(),
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(page2.items.len(), 1);
|
||||
@@ -1229,6 +1240,7 @@ mod tests {
|
||||
&[],
|
||||
None,
|
||||
default_provider.as_str(),
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(page.items.len(), 0);
|
||||
@@ -1295,6 +1307,7 @@ mod tests {
|
||||
&[],
|
||||
None,
|
||||
default_provider.as_str(),
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(page.items.len(), 1);
|
||||
|
||||
@@ -226,6 +226,7 @@ pub async fn list_threads_db(
|
||||
allowed_sources: &[SessionSource],
|
||||
model_providers: Option<&[String]>,
|
||||
archived: bool,
|
||||
search_term: Option<&str>,
|
||||
) -> Option<codex_state::ThreadsPage> {
|
||||
let ctx = context?;
|
||||
if ctx.codex_home() != codex_home {
|
||||
@@ -257,6 +258,7 @@ pub async fn list_threads_db(
|
||||
allowed_sources.as_slice(),
|
||||
model_providers.as_deref(),
|
||||
archived,
|
||||
search_term,
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user