[PR #14859] fix: respect OLLAMA_MODELS for history file path #25417

Open
opened 2026-04-19 18:12:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14859
Author: @fuleinist
Created: 3/15/2026
Status: 🔄 Open

Base: mainHead: fix/issue-14847


📝 Commits (2)

  • 3cd99eb fix: respect OLLAMA_MODELS for history file path
  • 50a8274 fix: improve history path derivation for OLLAMA_MODELS

📊 Changes

2 files changed (+107 additions, -4 deletions)

View changed files

📝 readline/history.go (+10 -4)
readline/history_test.go (+97 -0)

📄 Description

Summary

The history file path now respects the OLLAMA_MODELS environment variable, consistent with how other paths in the application are determined.

Problem

When users set OLLAMA_MODELS to make Ollama portable (e.g., on a USB drive), all data is correctly stored in the configured location except for the readline history file, which is still written to %USERPROFILE%/.ollama/history.

Solution

Modified readline/history.go to check for OLLAMA_MODELS environment variable first:

  • If OLLAMA_MODELS is set, the history file is stored in its parent directory
  • If not set, falls back to the previous behavior (user home directory)

Testing

  • Verified the code compiles with go build ./readline/...
  • The logic correctly handles both cases

Fixes #14847


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14859 **Author:** [@fuleinist](https://github.com/fuleinist) **Created:** 3/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/issue-14847` --- ### 📝 Commits (2) - [`3cd99eb`](https://github.com/ollama/ollama/commit/3cd99eba11df34a7d204328df2de0bde72cbca2e) fix: respect OLLAMA_MODELS for history file path - [`50a8274`](https://github.com/ollama/ollama/commit/50a8274a017042d8dc88399d3c7fb79b8685615e) fix: improve history path derivation for OLLAMA_MODELS ### 📊 Changes **2 files changed** (+107 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `readline/history.go` (+10 -4) ➕ `readline/history_test.go` (+97 -0) </details> ### 📄 Description ## Summary The history file path now respects the `OLLAMA_MODELS` environment variable, consistent with how other paths in the application are determined. ## Problem When users set `OLLAMA_MODELS` to make Ollama portable (e.g., on a USB drive), all data is correctly stored in the configured location except for the readline history file, which is still written to `%USERPROFILE%/.ollama/history`. ## Solution Modified `readline/history.go` to check for `OLLAMA_MODELS` environment variable first: - If `OLLAMA_MODELS` is set, the history file is stored in its parent directory - If not set, falls back to the previous behavior (user home directory) ## Testing - Verified the code compiles with `go build ./readline/...` - The logic correctly handles both cases Fixes #14847 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 18:12:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#25417