Skip to content

Commit 1d05eee

Browse files
committed
add webui option
1 parent 336c8f1 commit 1d05eee

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

cli/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ echo "Building the binary with PyInstaller..."
1919
# The entry point is the main function in the homl_cli package
2020
ENTRY_POINT="homl_cli/main.py"
2121
# We need to bundle the docker-compose template
22-
DATA_FILE="homl_cli/docker-compose.yml.template"
22+
DATA_FILE="homl_cli/data/*"
2323
# The binary will be named 'homl'
2424
BINARY_NAME="homl"
2525
if [ -z "$CLI_VERSION" ]; then
@@ -33,7 +33,7 @@ pyinstaller \
3333
--onefile \
3434
--console \
3535
--add-data "homl_cli/__version.txt:." \
36-
--add-data "$DATA_FILE:." \
36+
--add-data "$DATA_FILE:data/" \
3737
"$ENTRY_POINT"
3838

3939
echo "---"

cli/homl_cli/docker-compose.yml.template renamed to cli/homl_cli/data/docker-compose.yml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ services:
1717
pid: "host"
1818
ports:
1919
- "${HOML_PORT}:8080"
20-
deploy: ${HOML_DEPLOY_RESOURCES}
20+
deploy: ${HOML_DEPLOY_RESOURCES}

cli/homl_cli/data/openui.template

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
open-webui:
2+
image: ghcr.io/open-webui/open-webui:main
3+
ports:
4+
- "${WEBUI_PORT}:8080"
5+
environment:
6+
- WEBUI_AUTH=false
7+
- ENABLE_OLLAMA_API=false
8+
- OPENAI_API_BASE_URL=http://homl-server:8080/v1
9+
- OFFLINE_MODE=true

cli/homl_cli/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ def restart():
128128
@click.option('--insecure-socket', is_flag=True, help="Use a world-writable socket (less secure).")
129129
@click.option('--upgrade', is_flag=True, help="Force reinstallation even if the server is already running.")
130130
@click.option('--gptoss', is_flag=True, help="Use the GPTOSS image instead of the default.")
131-
def install(insecure_socket, upgrade, gptoss):
132-
install_utils.install(insecure_socket=insecure_socket, upgrade=upgrade, gptoss=gptoss)
131+
@click.option('--webui', is_flag=True, help="Install the Open WebUI alongside the server.")
132+
def install(insecure_socket, upgrade, gptoss, webui):
133+
install_utils.install(insecure_socket=insecure_socket, upgrade=upgrade, gptoss=gptoss, install_webui=webui)
133134

134135
@main.command()
135136
@click.argument('model_name')

cli/homl_cli/utils/install_utils.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def check_and_install_nvidia_runtime():
135135
return False
136136

137137

138-
def install(insecure_socket: bool, upgrade: bool, gptoss: bool):
138+
def install(insecure_socket: bool, upgrade: bool, gptoss: bool, install_webui: bool = False):
139139
"""Installs and starts the HoML server using Docker Compose."""
140140
click.echo("🚀 Starting HoML server installation...")
141141

@@ -179,7 +179,7 @@ def install(insecure_socket: bool, upgrade: bool, gptoss: bool):
179179
f"Removing old module info cache at {module_info_cache_path}")
180180
shutil.rmtree(module_info_cache_path)
181181
compose_path = homl_dir / "docker-compose.yml"
182-
template_path = get_resource_path("docker-compose.yml.template")
182+
template_path = get_resource_path("data/docker-compose.yml.template")
183183
user_etc_path = homl_dir / "etc_pwd_tmp"
184184

185185
socket_dir.mkdir(parents=True, exist_ok=True)
@@ -212,6 +212,14 @@ def install(insecure_socket: bool, upgrade: bool, gptoss: bool):
212212
HOML_MODEL_UNLOAD_IDLE_TIME=str(model_unload_idle_time)
213213
)
214214

215+
if install_webui:
216+
template_path = get_resource_path("data/openui.template")
217+
with open(template_path, 'r') as f:
218+
openui_template = Template(f.read())
219+
compose_content += openui_template.substitute(
220+
WEBUI_PORT=str(7457)
221+
)
222+
215223
with open(compose_path, 'w') as f:
216224
f.write(compose_content)
217225

@@ -228,6 +236,9 @@ def print_post_install_message():
228236
click.echo(" 3. Chat with it: 'homl chat qwen3:0.6b'")
229237
click.echo("\nYour OpenAI-compatible API is available at:")
230238
click.secho(f" http://0.0.0.0:{port}", fg="cyan")
239+
if install_webui:
240+
click.echo("\nYour Open WebUI is available at:")
241+
click.secho(f" http://0.0.0.0:7457", fg="cyan")
231242

232243
try:
233244
if upgrade:

0 commit comments

Comments
 (0)