translator: allow specifying llama url

This commit is contained in:
galister 2026-07-04 01:36:25 +09:00
parent 6dd624e046
commit 8baac0d298
2 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import * as fsp from "fs/promises";
import path from "path";
import * as fs from "fs";
const base_url = process.env["LLAMA_BASE_URL"] as string;
const model_name = process.env["MODEL"] as string;
const template_name = process.env["TEMPLATE"] as string;
let lang_path = process.env["LANG_PATH"] as string;
@ -203,7 +204,7 @@ async function run() {
english_translation,
);
const response = await fetch("http://localhost:8080/v1/chat/completions", {
const response = await fetch(base_url + "/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({

View File

@ -21,6 +21,10 @@ if [ -z "${MODEL}" ]; then
export MODEL="gemma-4-26B-A4B-it-UD-Q3_K_M"
fi
if [ -z "${LLAMA_BASE_URL}" ]; then
export LLAMA_BASE_URL="http://127.0.0.1:8080"
fi
TEMPLATE="pl" bun main.ts
TEMPLATE="de" bun main.ts
TEMPLATE="ja" bun main.ts