fix(stage-ui/stores/providers): dead code from player2, check for health
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useLocalStorage } from '@vueuse/core'
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { useProvidersStore } from '../providers'
|
||||
|
||||
@@ -65,33 +65,6 @@ export const useConsciousnessStore = defineStore('consciousness', () => {
|
||||
return []
|
||||
}
|
||||
|
||||
let player2Interval: ReturnType<typeof setInterval> | undefined
|
||||
// Watch for provider changes and load models
|
||||
watch(activeProvider, async (newProvider) => {
|
||||
await loadModelsForProvider(newProvider)
|
||||
resetModelSelection()
|
||||
|
||||
if (newProvider === 'player2') {
|
||||
// Ping heal check every 60 seconds if Player2 is being used
|
||||
player2Interval = setInterval(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Sending Player2 Health check if it is being used')
|
||||
fetch(`localhost:4315/v1/health`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'player2-game-key': 'airi',
|
||||
},
|
||||
})
|
||||
.catch(() => { })
|
||||
}, 60_000)
|
||||
}
|
||||
else {
|
||||
if (player2Interval)
|
||||
clearInterval(player2Interval)
|
||||
player2Interval = undefined
|
||||
}
|
||||
})
|
||||
|
||||
const configured = computed(() => {
|
||||
return !!activeProvider.value && !!activeModel.value
|
||||
})
|
||||
|
||||
@@ -1427,8 +1427,16 @@ export const useProvidersStore = defineStore('providers', () => {
|
||||
],
|
||||
},
|
||||
validators: {
|
||||
validateProviderConfig: (config) => {
|
||||
return !!config.baseUrl
|
||||
validateProviderConfig: async (config) => {
|
||||
// Check if the Ollama server is reachable
|
||||
return !!config.baseUrl && await fetch(`localhost:4315/v1/health`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'player2-game-key': 'airi',
|
||||
},
|
||||
})
|
||||
.then(response => response.ok)
|
||||
.catch(() => false)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user