diff --git a/CHANGELOG.md b/CHANGELOG.md index d827cff9c..1249a626a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.104] - UNRELEASED + +### Added + +- Check for updates in Settings > About. + ## [0.1.103] - 2024-02-25 ### Added diff --git a/backend/constants.py b/backend/constants.py index cb802c7f4..006fa7bbe 100644 --- a/backend/constants.py +++ b/backend/constants.py @@ -47,3 +47,4 @@ class ERROR_MESSAGES(str, Enum): INCORRECT_FORMAT = ( lambda err="": f"Invalid format. Please use the correct format{err if err else ''}" ) + RATE_LIMIT_EXCEEDED = "API rate limit exceeded" diff --git a/backend/main.py b/backend/main.py index 3f971d395..94938b249 100644 --- a/backend/main.py +++ b/backend/main.py @@ -139,15 +139,11 @@ async def get_app_latest_release_version(): response.raise_for_status() latest_version = response.json()["tag_name"] - # Compare versions - return { - "current": VERSION, - "latest": latest_version[1:], - } + return {"current": VERSION, "latest": latest_version[1:]} except Exception as e: raise HTTPException( status_code=status.HTTP_503_SERVICE_UNAVAILABLE, - detail=ERROR_MESSAGES.NOT_FOUND, + detail=ERROR_MESSAGES.RATE_LIMIT_EXCEEDED, ) diff --git a/package.json b/package.json index 7938558db..4a33ec43a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-webui", - "version": "0.1.103", + "version": "0.1.104", "private": true, "scripts": { "dev": "vite dev --host", diff --git a/src/lib/apis/index.ts b/src/lib/apis/index.ts index db29e5485..b7b346c0d 100644 --- a/src/lib/apis/index.ts +++ b/src/lib/apis/index.ts @@ -19,6 +19,10 @@ export const getBackendConfig = async () => { return null; }); + if (error) { + throw error; + } + return res; }; @@ -41,5 +45,35 @@ export const getChangelog = async () => { return null; }); + if (error) { + throw error; + } + + return res; +}; + +export const getVersionUpdates = async () => { + let error = null; + + const res = await fetch(`${WEBUI_BASE_URL}/api/version/updates`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }) + .then(async (res) => { + if (!res.ok) throw await res.json(); + return res.json(); + }) + .catch((err) => { + console.log(err); + error = err; + return null; + }); + + if (error) { + throw error; + } + return res; }; diff --git a/src/lib/components/chat/Settings/About.svelte b/src/lib/components/chat/Settings/About.svelte index 60c0d7168..78a76bc63 100644 --- a/src/lib/components/chat/Settings/About.svelte +++ b/src/lib/components/chat/Settings/About.svelte @@ -1,14 +1,39 @@ @@ -20,10 +45,17 @@ {$WEBUI_NAME} Version -