feat: 扫描 Gemini history/ 目录并支持按模型名搜索会话
- gemini.rs: list_chat_files() 同时扫描 tmp/(进行中)和 history/ (已归档)目录,修复已完成的 Gemini 会话不可见的问题 - conversations.rs: 搜索过滤新增 model 字段匹配, 支持按模型名搜索会话(如 'gemini-2.5-pro'、'claude-sonnet')
This commit is contained in:
@@ -84,6 +84,10 @@ fn list_conversations_sync(
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|b| b.to_lowercase().contains(&query_lower))
|
.map(|b| b.to_lowercase().contains(&query_lower))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|
|| s.model
|
||||||
|
.as_ref()
|
||||||
|
.map(|m| m.to_lowercase().contains(&query_lower))
|
||||||
|
.unwrap_or(false)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,18 +49,23 @@ impl GeminiParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn list_chat_files(&self) -> Vec<PathBuf> {
|
fn list_chat_files(&self) -> Vec<PathBuf> {
|
||||||
let tmp_dir = self.tmp_dir();
|
let mut files: Vec<PathBuf> = Vec::new();
|
||||||
if !tmp_dir.exists() {
|
|
||||||
return Vec::new();
|
// Scan both tmp/ (active sessions) and history/ (archived sessions)
|
||||||
|
for dir in [self.tmp_dir(), self.history_dir()] {
|
||||||
|
if !dir.exists() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let found = WalkDir::new(&dir)
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|e| e.ok())
|
||||||
|
.map(|e| e.path().to_path_buf())
|
||||||
|
.filter(|p| p.is_file() && Self::is_chat_file(p));
|
||||||
|
files.extend(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut files: Vec<PathBuf> = WalkDir::new(&tmp_dir)
|
|
||||||
.into_iter()
|
|
||||||
.filter_map(|e| e.ok())
|
|
||||||
.map(|e| e.path().to_path_buf())
|
|
||||||
.filter(|p| p.is_file() && Self::is_chat_file(p))
|
|
||||||
.collect();
|
|
||||||
files.sort();
|
files.sort();
|
||||||
|
files.dedup();
|
||||||
files
|
files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user