Skip to content

armgit / Wake

Public Imported from GitHub
0

All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.

Rust

fix: offer a file picker for memory locations on Windows and Linux (#68)

Corey Chiu69eeb0cc9295
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 97c43d7..114d9ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
## [Unreleased]
- Fix: Refresh picks up sessions you deleted in OpenCode while it was still running, instead of listing them until Wake restarts (#70, thanks @lin-code-world)
+- Fix: On Windows and Linux, adding a memory location offers a file picker next to the folder picker, so a single file no longer has to be typed in by hand (#68, thanks @lin-code-world)
## [0.9.3] — 2026-10-13
diff --git a/crates/wake/locales/zh-Hans.json b/crates/wake/locales/zh-Hans.json
index aeb27b7..f246c0f 100644
--- a/crates/wake/locales/zh-Hans.json
+++ b/crates/wake/locales/zh-Hans.json
@@ -56,6 +56,7 @@
"Checking…": "正在检查…",
"Choose": "选择",
"Choose a folder": "选择文件夹",
+ "Choose a file": "选择文件",
"Choose a folder or file": "选择文件夹或文件",
"Choose where Wake looks for local agent sessions.": "选择 Wake 查找本地 agent 会话的位置。",
"Choose which memory and instruction files Wake indexes.": "选择 Wake 索引哪些记忆与指令文件。",
diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rs
index 77b4787..a101018 100644
--- a/crates/wake/src/workbench.rs
+++ b/crates/wake/src/workbench.rs
@@ -2542,6 +2542,26 @@ enum FormTarget {
},
}
+/// 路径表单的一颗选择按钮选什么
+#[derive(Clone, Copy)]
+enum LocationPick {
+ Folder,
+ File,
+ Either,
+}
+
+impl LocationPick {
+ /// 收文件的表单(记忆来源)在系统选择器不能一个对话框里两样都选时给两颗按钮:Windows
+ /// 一要文件夹就只认文件夹,Linux 的 portal 也是二选一(#68)
+ fn buttons(pick_files: bool, mixed: bool) -> &'static [LocationPick] {
+ match (pick_files, mixed) {
+ (false, _) => &[LocationPick::Folder],
+ (true, true) => &[LocationPick::Either],
+ (true, false) => &[LocationPick::Folder, LocationPick::File],
+ }
+ }
+}
+
/// 路径表单的一份规格:Session locations 与 Memory locations 共用同一个表单(agent
/// 下拉 + 路径输入 + 选择钮,Cancel/Save 只在有改动时出现;编辑态动作行左 Remove、
/// 右 Show in Finder),两页的差别全在这里
@@ -3743,28 +3763,48 @@ impl Workbench {
.child(field_label),
)
.child(div().flex_1().min_w_0().child(Input::new(&browse_input)))
- .child(
- Button::new("loc-browse")
- .outline()
- .rounded(RADIUS_BUTTON)
- .icon(icon("icons/folder.svg").with_size(zpx(13.)))
- .tooltip(if pick_files {
- t("Choose a folder or file")
- } else {
- t("Choose a folder")
- })
- .on_click({
- let entity = browse_entity.clone();
- let input = browse_input.clone();
- move |_, window, cx| {
- let input = input.clone();
- entity.update(cx, |this, cx| {
- this.browse_for_location(
- input, pick_files, window, cx,
- )
- });
- }
- }),
+ .children(
+ LocationPick::buttons(
+ pick_files,
+ cx.can_select_mixed_files_and_dirs(),
+ )
+ .iter()
+ .map(|&pick| {
+ let (id, glyph, tooltip) = match pick {
+ LocationPick::Folder => (
+ "loc-browse",
+ "icons/folder.svg",
+ t("Choose a folder"),
+ ),
+ LocationPick::Either => (
+ "loc-browse",
+ "icons/folder.svg",
+ t("Choose a folder or file"),
+ ),
+ LocationPick::File => (
+ "loc-browse-file",
+ "icons/file-text.svg",
+ t("Choose a file"),
+ ),
+ };
+ Button::new(id)
+ .outline()
+ .rounded(RADIUS_BUTTON)
+ .icon(icon(glyph).with_size(zpx(13.)))
+ .tooltip(tooltip)
+ .on_click({
+ let entity = browse_entity.clone();
+ let input = browse_input.clone();
+ move |_, window, cx| {
+ let input = input.clone();
+ entity.update(cx, |this, cx| {
+ this.browse_for_location(
+ input, pick, window, cx,
+ )
+ });
+ }
+ })
+ }),
),
)
.when(remove.is_some() || reveal.is_some(), |el| {
@@ -3869,18 +3909,17 @@ impl Workbench {
});
}
- /// 表单的选择按钮:系统选择器,选中即回填输入框(取消无事发生);记忆来源的
- /// 表单也收文件
+ /// 表单的选择按钮:系统选择器,选中即回填输入框(取消无事发生)
fn browse_for_location(
&mut self,
input: Entity<InputState>,
- files: bool,
+ pick: LocationPick,
window: &mut Window,
cx: &mut Context<Self>,
) {
let rx = cx.prompt_for_paths(PathPromptOptions {
- files,
- directories: true,
+ files: !matches!(pick, LocationPick::Folder),
+ directories: !matches!(pick, LocationPick::File),
multiple: false,
prompt: Some(t("Choose").into()),
});