Skip to content

Commit

Permalink
refac: rename build hash vars
Browse files Browse the repository at this point in the history
  • Loading branch information
cheahjs committed May 26, 2024
1 parent a579f5f commit 4fdb26f
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY package.json package-lock.json ./
RUN npm ci

COPY . .
ENV WEBUI_VERSION=${BUILD_HASH}
ENV APP_BUILD_HASH=${BUILD_HASH}
RUN npm run build

######## WebUI backend ########
Expand Down Expand Up @@ -159,6 +159,6 @@ HEALTHCHECK CMD curl --silent --fail http://localhost:8080/health | jq -e '.stat

USER $UID:$GID

ENV WEBUI_VERSION=${BUILD_HASH}
ENV WEBUI_BUILD_VERSION=${BUILD_HASH}

CMD [ "bash", "start.sh"]
2 changes: 1 addition & 1 deletion backend/apps/web/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
utils,
)
from config import (
WEBUI_VERSION,
WEBUI_BUILD_HASH,
WEBUI_AUTH,
DEFAULT_MODELS,
DEFAULT_PROMPT_SUGGESTIONS,
Expand Down
4 changes: 2 additions & 2 deletions backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ def parse_section(section):


####################################
# WEBUI_VERSION
# WEBUI_BUILD_HASH
####################################

WEBUI_VERSION = os.environ.get("WEBUI_VERSION", "v1.0.0-alpha.100")
WEBUI_BUILD_HASH = os.environ.get("WEBUI_BUILD_HASH", "dev-build")

####################################
# DATA/FRONTEND BUILD DIR
Expand Down
4 changes: 2 additions & 2 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
WEBHOOK_URL,
ENABLE_ADMIN_EXPORT,
AppConfig,
WEBUI_VERSION,
WEBUI_BUILD_HASH,
)
from constants import ERROR_MESSAGES

Expand Down Expand Up @@ -92,7 +92,7 @@ async def get_response(self, path: str, scope):
v{VERSION} - building the best open-source AI user interface.
{f"Commit: {WEBUI_VERSION}" if WEBUI_VERSION != "v1.0.0-alpha.100" else ""}
{f"Commit: {WEBUI_BUILD_HASH}" if WEBUI_BUILD_HASH != "dev-build" else ""}
https://github.com/open-webui/open-webui
"""
)
Expand Down
2 changes: 1 addition & 1 deletion hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ def initialize(self, version, build_data):
stderr.write("### npm install\n")
subprocess.run([npm, "install"], check=True) # noqa: S603
stderr.write("\n### npm run build\n")
os.environ["WEBUI_VERSION"] = version
os.environ["APP_BUILD_HASH"] = version
subprocess.run([npm, "run", "build"], check=True) # noqa: S603
4 changes: 2 additions & 2 deletions src/lib/components/chat/Settings/About.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { getVersionUpdates } from '$lib/apis';
import { getOllamaVersion } from '$lib/apis/ollama';
import { WEBUI_HASH, WEBUI_VERSION } from '$lib/constants';
import { WEBUI_BUILD_HASH, WEBUI_VERSION } from '$lib/constants';
import { WEBUI_NAME, config, showChangelog } from '$lib/stores';
import { compareVersion } from '$lib/utils';
import { onMount, getContext } from 'svelte';
Expand Down Expand Up @@ -54,7 +54,7 @@
<div class="flex w-full justify-between items-center">
<div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
<div class="flex gap-1">
<Tooltip content={WEBUI_HASH}>
<Tooltip content={WEBUI_BUILD_HASH}>
v{WEBUI_VERSION}
</Tooltip>

Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const IMAGES_API_BASE_URL = `${WEBUI_BASE_URL}/images/api/v1`;
export const RAG_API_BASE_URL = `${WEBUI_BASE_URL}/rag/api/v1`;

export const WEBUI_VERSION = APP_VERSION;
export const WEBUI_HASH = APP_HASH;
export const WEBUI_BUILD_HASH = APP_BUILD_HASH;
export const REQUIRED_OLLAMA_VERSION = '0.1.16';

export const SUPPORTED_FILE_TYPE = [
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineConfig({
plugins: [sveltekit()],
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version),
APP_HASH: JSON.stringify(process.env.WEBUI_VERSION || 'dev-build')
APP_BUILD_HASH: JSON.stringify(process.env.APP_BUILD_HASH || 'dev-build')
},
worker: {
format: 'es'
Expand Down

0 comments on commit 4fdb26f

Please sign in to comment.