fix: select and update models folder in settings (#13412)

This commit is contained in:
Eva H
2025-12-12 11:09:37 -05:00
committed by GitHub
parent 9f7822851c
commit 95fdd8d619
2 changed files with 36 additions and 28 deletions

View File

@@ -169,7 +169,11 @@ DlgResult fileDlg(FileDlgParams* params) {
} }
NSArray* urls = [panel URLs]; NSArray* urls = [panel URLs];
if(self->params->allowMultiple && [urls count] >= 1) { if([urls count] == 0) {
return DLG_CANCEL;
}
if(self->params->allowMultiple) {
// For multiple files, we need to return all paths separated by null bytes // For multiple files, we need to return all paths separated by null bytes
char* bufPtr = self->params->buf; char* bufPtr = self->params->buf;
int remainingBuf = self->params->nbuf; int remainingBuf = self->params->nbuf;
@@ -200,6 +204,12 @@ DlgResult fileDlg(FileDlgParams* params) {
bufPtr += pathLen + 1; bufPtr += pathLen + 1;
} }
*bufPtr = '\0'; // Final null terminator *bufPtr = '\0'; // Final null terminator
} else {
// Single file/directory selection - write path to buffer
NSURL* url = [urls firstObject];
if(![url getFileSystemRepresentation:self->params->buf maxLength:self->params->nbuf]) {
return DLG_URLFAIL;
}
} }
return DLG_OK; return DLG_OK;

View File

@@ -224,9 +224,7 @@ func (s *Server) cmd(ctx context.Context) (*exec.Cmd, error) {
if _, err := os.Stat(settings.Models); err == nil { if _, err := os.Stat(settings.Models); err == nil {
env["OLLAMA_MODELS"] = settings.Models env["OLLAMA_MODELS"] = settings.Models
} else { } else {
slog.Warn("models path not accessible, clearing models setting", "path", settings.Models, "err", err) slog.Warn("models path not accessible, using default", "path", settings.Models, "err", err)
settings.Models = ""
s.store.SetSettings(settings)
} }
} }
if settings.ContextLength > 0 { if settings.ContextLength > 0 {