2 Commits
Author SHA1 Message Date
Will Miao fa6712cff9 feat(settings): create folders from the directory picker
The settings folder picker could only select existing directories, so
creating a model root meant leaving the UI to create the folder first.

- Add POST /api/lm/create-directory, backed by create_directory() in
  py/utils/directory_browser.py: it creates one subfolder of the browsed
  directory and rejects names that are not a single safe path segment
  (separators, dot names, Windows-invalid characters and reserved names,
  over-long names) plus duplicates, missing/non-directory parents and
  permission errors, each with a stable error_code.
- Add a New Folder button and an inline name row to the picker; the
  created folder is entered immediately so it can be selected with one
  click. Esc dismisses the row before closing the modal, and the button
  is disabled on the Windows drive-list level where there is no
  directory to create in.
- Map the server error codes to localized picker messages.
- Cover the endpoint and the picker flow with backend and frontend tests.
2026-11-06 12:46:53 +08:00
Will Miao d45a523fb5 feat(settings): directory picker and live validation for path settings
Add a reusable directory-picker modal backed by a new generic
POST /api/lm/browse-directory endpoint (browse logic extracted from the
recipe batch-import handler into py/utils/directory_browser.py) and wire
a browse button plus advisory validate-path feedback (POST
/api/lm/validate-path) into the settings path inputs: recipes path,
example images path/local root, and the extra-folder/model-path rows.

The browse button insets into the right edge of static inputs so narrow
settings rows keep their single-control layout.

Translations for the new settings.directoryPicker and
settings.pathValidation keys are filled in for all 9 locales.
2026-09-18 21:05:32 +08:00