Skip to content

Commit c321f28

Browse files
committed
show modal only on api key error
1 parent 1ba60e9 commit c321f28

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const authenticate = async () => {
1919
hasError.value = false
2020
updateAuthKey(authKey.value)
2121
const status = await getStatus()
22-
hasError.value = status == undefined
22+
hasError.value = status == 'Invalid API Key'
2323
if (!hasError.value) {
2424
authBox.value?.toggleModal()
2525
isReadyAndAuth.value = true
@@ -32,7 +32,7 @@ const currentComponentLoading = computed(() => {
3232
const routeName = route.name?.toString()
3333
let store
3434
if (routeName !== undefined && !routesToExclude.includes(routeName)) {
35-
store = storeMapping[routeName]
35+
store = storeMapping[routeName as keyof typeof storeMapping]
3636
const { currentState } = storeToRefs(store)
3737
return store && currentState.value.loading
3838
}

src/stores/useSettings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ export const useSettings = defineStore('settings', () => {
3535

3636
const getStatus = async () => {
3737
const result = await tryRequest(apiClient.api?.status.home(), 'Getting Cheshire Cat status', 'Unable to fetch Cheshire Cat status')
38-
return result.data
38+
return result.data ?? result.message
3939
}
4040

4141
const { state: cat } = useAsyncState(getStatus, {} as Status)
4242

4343
watchEffect(() => {
44-
isReadyAndAuth.value = cat.value != undefined
44+
isReadyAndAuth.value = cat.value != 'Invalid API Key'
4545
})
4646

4747
return {

src/utils/storeRouteMapping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function useStoreMapping() {
99
const storePlugins = usePlugins()
1010
const storeMemory = useMemory()
1111

12-
const storeMapping: Record<string, typeof storeEmbedder | typeof storeLLM | typeof storeMemory | typeof storePlugins> = {
12+
const storeMapping = {
1313
embedders: storeEmbedder,
1414
providers: storeLLM,
1515
memory: storeMemory,

src/views/SettingsView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import SidePanel from '@components/SidePanel.vue'
33
import { useSettings } from '@stores/useSettings'
4+
45
defineProps<{
56
loading: boolean
67
}>()
@@ -27,7 +28,7 @@ const openSidePanel = (title: keyof typeof panelTitles) => {
2728
<p class="text-lg font-bold">
2829
Cheshire Cat AI - Version
2930
<span class="text-primary">
30-
{{ cat?.version ?? 'unknown' }}
31+
{{ typeof cat == 'string' ? 'unknown' : cat.version }}
3132
</span>
3233
</p>
3334
</div>

0 commit comments

Comments
 (0)