1
0
mirror of https://github.com/containers/ramalama.git synced 2026-02-05 06:46:39 +01:00

Add colors to "ramalama serve" if we can

I don't notice any difference but a lot of things are LOG_INFO in
llama.cpp

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
This commit is contained in:
Eric Curtin
2025-06-15 00:57:41 +01:00
parent 7a2c30415a
commit ee4ccffb29

View File

@@ -50,6 +50,11 @@ with the default RamaLama
$(error)s"""
def should_colorize():
t = os.getenv("TERM")
return t and t != "dumb" and sys.stdout.isatty()
def is_split_file_model(model_path):
"""returns true if ends with -%05d-of-%05d.gguf"""
return bool(re.match(SPLIT_MODEL_RE, model_path))
@@ -533,6 +538,9 @@ class Model(ModelBase):
else:
exec_args += ["--jinja"]
if should_colorize():
exec_args += ["--log-colors"]
exec_args += [
"--alias",
self.model,