diff --git a/CHANGELOG.md b/CHANGELOG.md index ae27515..f331d83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ until 1.0, minor versions may contain breaking changes. ## [Unreleased] +### Added + +- File manager: *Open chat here* in a folder's menu starts a chat in that folder. + ### Removed - *Settings → Config file* no longer offers to move `${NAME}` values into the configuration (a diff --git a/web/src/components/Files.tsx b/web/src/components/Files.tsx index c56c5ab..5edb1b5 100644 --- a/web/src/components/Files.tsx +++ b/web/src/components/Files.tsx @@ -9,6 +9,7 @@ import { Markdown } from "./Markdown"; import { GitPanel, type GitStatus } from "./GitPanel"; import { FilePreview, previewKind, type PreviewKind } from "./FilePreview"; import { confirmDialog, promptDialog, toast } from "../dialogs"; +import { navigate } from "../router"; const CodeEditor = lazy(() => import("./CodeEditor").then((m) => ({ default: m.CodeEditor }))); @@ -186,6 +187,16 @@ export function Files({ onMenu }: { onMenu: () => void }) { }); }; + /** New chat with the folder as working directory (default model and mode). */ + const chatHere = async (e: Entry) => { + try { + const s = await post<{ id: string }>("/sessions", { cwd: e.path }); + navigate(`/s/${s.id}`); + } catch (err) { + toast(err); + } + }; + const rename = async (e: Entry) => { const name = await promptDialog({ message: t("files.renameTo"), defaultValue: e.name }); if (name && name !== e.name) void act(() => post("/files/move", { from: e.path, to: `${dirName(e.path)}/${name}` })); @@ -324,6 +335,9 @@ export function Files({ onMenu }: { onMenu: () => void }) {
+ {e.is_dir && ( + + )} {!e.is_dir && ( diff --git a/web/src/i18n/de.ts b/web/src/i18n/de.ts index dd9c586..6484744 100644 --- a/web/src/i18n/de.ts +++ b/web/src/i18n/de.ts @@ -85,6 +85,7 @@ export const de: Messages = { "files.newFolderName": "Ordnername:", "files.renameTo": "Neuer Name:", "files.copyTo": "Name der Kopie:", + "files.chatHere": "Chat hier öffnen", "files.rename": "Umbenennen", "files.duplicate": "Duplizieren", "files.download": "Herunterladen", diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index f018c2b..68c9e89 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -84,6 +84,7 @@ export const en = { "files.newFolderName": "Folder name:", "files.renameTo": "New name:", "files.copyTo": "Name of the copy:", + "files.chatHere": "Open chat here", "files.rename": "Rename", "files.duplicate": "Duplicate", "files.download": "Download", diff --git a/web/src/whatsnew.ts b/web/src/whatsnew.ts index d3bae68..77a9a88 100644 --- a/web/src/whatsnew.ts +++ b/web/src/whatsnew.ts @@ -3,6 +3,10 @@ * under "unreleased"; scripts/release.sh renames the key to the release version. */ export const WHATS_NEW: Record = { + unreleased: { + en: ["File manager: “Open chat here” in a folder's menu"], + de: ["Dateimanager: „Chat hier öffnen“ im Ordner-Menü"], + }, "202611-00002": { en: [ "opencode: “Fetch prices” fills in prices including long-context and peak-hour pricing",