Metadata-Version: 2.4
Name: llama-ui-termux
Version: 0.4.4
Summary: A Rich terminal interface for llama.cpp
Author: Llama-UI contributors
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console
Classifier: Operating System :: Android
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rich>=13.7.0
Dynamic: license-file

# Llama-UI 0.4.4

A Python package providing a Rich-powered terminal frontend for `llama.cpp`, designed with Termux on Android in mind.

## Install in Termux

### PyPI

> You can now install it via Python `pip`
> Run:
> ```bash
> pip install llama-ui-termux
> ```

### Building from source 

First make sure Python and pip are available:

```bash
pkg install python
```

Extract this project ZIP, enter the extracted `Llama-UI-Python` directory, then install it:

```bash
python -m pip install .
```

Run the application:

```bash
llama-ui
```

You can also launch it as a Python module:

```bash
python -m llama_ui
```

No Bash launcher or shell installer is included. The `llama-ui` command is created by Python packaging.

## Requirements

- Python 3.9 or newer
- `rich` (installed automatically by pip from `pyproject.toml`)
- A working `llama.cpp` build that provides `llama-server`

Llama-UI does not include or compile llama.cpp itself.

## First launch

The setup wizard asks which llama.cpp build you use:

1. **Termux repository package** — uses `llama-server` from your `PATH`.
2. **Compiled from source** — asks for the directory containing `llama-server` and the directories containing its shared libraries.

It then asks for your GGUF model folder and startup flags. After selecting a model, you can set its system prompt and generation parameters. Both are saved separately for each GGUF model and loaded automatically when you switch models; models without custom values use the defaults.

## Features

- Rich menus, tables, panels and Markdown rendering.
- Import/copy a local `.gguf` file.
- Download a public Hugging Face GGUF using its repository ID and exact filename.
- Configure llama-server startup flags, per-model system prompts, and per-model generation parameters (temperature, top_p, top_k and repeat_penalty).
- Chat commands:
  - `/edit` — edit the last user message and submit it again.
  - `/regen` — regenerate the answer to the last user message.
  - `/new` — start a fresh conversation.
  - `/save` — save the current conversation.
  - `/exit` — return to the main menu.
- Ctrl+C interrupts a response while it is streaming.
- History: view, load and delete saved conversations.
- System prompt: view, edit and delete the selected model’s prompt.
- Server controls: start, stop and inspect logs.

## Startup flags

Enter `llama-server` flags only, for example:

```text
-c 4096 -t 4 -ngl 0
```

Llama-UI adds the selected model (`-m`), host and port itself. Do not include those options in the flags field.

## Source build library paths

For source builds, enter the directory containing the `llama-server` binary and the directories containing its shared libraries. The app sets `LD_LIBRARY_PATH` for the server process. Exact paths vary by build configuration.

## Configuration files

- Configuration, per-model generation parameters, and per-model system prompts: `~/.config/llama-ui/config.json`
- Chat history: `~/.config/llama-ui/chats/`
- Server log: `~/.config/llama-ui/server.log`
- Default model folder: `~/models`

## Important notes

- Check GGUF file size before downloading; models may be several GB and use substantial mobile data.
- Public Hugging Face files are supported; private/gated repositories are not.
- Generation speed is approximate words/second, not tokenizer-accurate tokens/second.
- GPU offload depends on your particular llama.cpp build and Android device.
- The app starts/stops servers it launches itself. It does not automatically stop a server that was already running.
