Skip to content

Commit 3875c51

Browse files
committed
Bump version to 3.0.45
1 parent b2e8cb1 commit 3875c51

5 files changed

Lines changed: 40 additions & 10 deletions

File tree

llms/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
HAS_PIL = False
5858

5959
_ROOT = None
60-
VERSION = "3.0.44"
60+
VERSION = "3.0.45"
6161
DEBUG = os.getenv("DEBUG") == "1"
6262
MOCK = os.getenv("MOCK") == "1"
6363
MOCK_DIR = os.getenv("MOCK_DIR")

llms/ui/ai.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const headers = { 'Accept': 'application/json' }
66
const prefsKey = 'llms.prefs'
77

88
export const o = {
9-
version: '3.0.44',
9+
version: '3.0.45',
1010
base,
1111
prefsKey,
1212
welcome: 'Welcome to llms.py',

llms/ui/ctx.mjs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import { reactive, markRaw } from 'vue'
3-
import { EventBus, humanize, combinePaths } from "@servicestack/client"
3+
import { EventBus, humanize, combinePaths, pick } from "@servicestack/client"
44
import { storageObject, isHtml, sanitizeHtml } from './utils.mjs'
55

66
export class ExtensionScope {
@@ -141,6 +141,7 @@ export class AppContext {
141141
cacheBreaker: new Date().getTime(),
142142
theme,
143143
styles: theme.styles,
144+
profile: localStorage.getItem('llms.profile') || 'default',
144145
})
145146
this.events = new EventBus()
146147
this.modalComponents = {}
@@ -158,7 +159,18 @@ export class AppContext {
158159
this.left = {}
159160
this.leftTop = {}
160161
this.layout = reactive(storageObject(`llms.layout`))
161-
this.prefs = reactive(storageObject(ai.prefsKey))
162+
163+
const oldPrefsKey = ai.prefsKey
164+
const prefsKey = ai.prefsKey + '.' + this.state.profile
165+
if (localStorage.getItem(oldPrefsKey)) {
166+
if (!localStorage.getItem(prefsKey)) {
167+
const oldPrefs = storageObject(oldPrefsKey)
168+
storageObject(prefsKey, oldPrefs)
169+
}
170+
localStorage.removeItem(oldPrefsKey)
171+
}
172+
this.prefs = reactive(storageObject(prefsKey))
173+
162174
this._onRouterBeforeEach = []
163175
this._onClass = []
164176

@@ -204,9 +216,7 @@ export class AppContext {
204216
let html = document.documentElement
205217
html.classList.toggle('dark', darkMode)
206218
html.style.setProperty('color-scheme', darkMode ? 'dark' : null)
207-
if (localStorage.getItem('color-scheme') === null) {
208-
localStorage.setItem('color-scheme', darkMode ? 'dark' : 'light')
209-
}
219+
localStorage.setItem('color-scheme', darkMode ? 'dark' : 'light')
210220
}
211221
getUserAvatar() {
212222
const theme = this.getPrefs().theme || this.getColorScheme()
@@ -219,11 +229,30 @@ export class AppContext {
219229
incCacheBreaker() {
220230
this.state.cacheBreaker++
221231
}
232+
getPrefsKey() {
233+
return this.ai.prefsKey + '.' + this.state.profile
234+
}
235+
changeProfile(profile) {
236+
console.log('changeProfile', JSON.stringify(profile, null, 2))
237+
this.selectTheme(profile?.theme)
238+
239+
const profileId = profile?.id || 'default'
240+
if (this.state.profile == profileId) return
241+
this.state.profile = profileId
242+
if (profile) {
243+
const profilePrefs = pick(profile, ['model', 'tools', 'skills'])
244+
this.setPrefs(profilePrefs)
245+
if (profile.model) {
246+
this.state.selectedModel = model
247+
}
248+
}
249+
this.prefs = reactive(storageObject(this.getPrefsKey()))
250+
}
222251
getPrefs() {
223252
return this.prefs
224253
}
225254
setPrefs(o) {
226-
storageObject(this.ai.prefsKey, Object.assign(this.prefs, o))
255+
storageObject(this.getPrefsKey(), Object.assign(this.prefs, o))
227256
}
228257
_validateComponents(componentMap) {
229258
Object.entries(componentMap).forEach(([id, def]) => {
@@ -546,6 +575,7 @@ export class AppContext {
546575
}
547576

548577
changeTheme(theme) {
578+
console.log('changeTheme', theme)
549579

550580
const fullTheme = this.createTheme(theme)
551581
Object.assign(this.state.theme, fullTheme)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "llms-py"
7-
version = "3.0.44"
7+
version = "3.0.45"
88
description = "A lightweight CLI tool and OpenAI-compatible server for querying multiple Large Language Model (LLM) providers"
99
readme = "README.md"
1010
license = "BSD-3-Clause"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name="llms-py",
18-
version="3.0.44",
18+
version="3.0.45",
1919
author="ServiceStack",
2020
author_email="team@servicestack.net",
2121
description="A lightweight CLI tool and OpenAI-compatible server for querying multiple Large Language Model (LLM) providers",

0 commit comments

Comments
 (0)