mirror of
https://github.com/open-webui/assistant
synced 2025-05-13 00:10:34 +00:00
refac
This commit is contained in:
parent
847d47e17c
commit
580aa0f6e7
39
src/App.vue
39
src/App.vue
@ -6,6 +6,9 @@ import { ref, onBeforeMount } from 'vue';
|
|||||||
const url = ref('http://localhost:3000')
|
const url = ref('http://localhost:3000')
|
||||||
const token = ref('your_jwt')
|
const token = ref('your_jwt')
|
||||||
|
|
||||||
|
const connected = ref(false)
|
||||||
|
|
||||||
|
|
||||||
const models = ref([])
|
const models = ref([])
|
||||||
const selectedModel = ref('')
|
const selectedModel = ref('')
|
||||||
|
|
||||||
@ -20,17 +23,22 @@ const saveHandler = async () => {
|
|||||||
url: url.value,
|
url: url.value,
|
||||||
token: token.value
|
token: token.value
|
||||||
})
|
})
|
||||||
const res = await window.electron.checkConnection()
|
|
||||||
|
|
||||||
new Notification("Open WebUI", { body: res ? 'Server Connection Verified' : 'Server Connection Failed' })
|
|
||||||
|
|
||||||
if (res) {
|
connected.value = await window.electron.checkConnection()
|
||||||
|
|
||||||
|
new Notification("Open WebUI", { body: connected.value ? 'Server Connection Verified' : 'Server Connection Failed' })
|
||||||
|
|
||||||
|
if (connected.value) {
|
||||||
models.value = await window.electron.getModels()
|
models.value = await window.electron.getModels()
|
||||||
|
|
||||||
console.log(models.value)
|
console.log(models.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const editHandler = () => {
|
||||||
|
connected.value = false
|
||||||
|
}
|
||||||
|
|
||||||
const selectModelHandler = async () => {
|
const selectModelHandler = async () => {
|
||||||
console.log(selectedModel.value)
|
console.log(selectedModel.value)
|
||||||
|
|
||||||
@ -60,18 +68,29 @@ onBeforeMount(async () => {
|
|||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class=" text-sm font-semibold">Open WebUI Assistant</div>
|
<div class=" text-sm font-semibold">Open WebUI Assistant</div>
|
||||||
|
|
||||||
<button class="bg-neutral-700 hover:bg-neutral-800 transition text-white text-xs px-3 py-1 rounded-lg"
|
<div v-if="connected">
|
||||||
@click="saveHandler">Save</button>
|
<button
|
||||||
|
class="bg-green-100 hover:bg-green-200 text-green-700 font-medium transition text-xs px-3 py-1 rounded-lg"
|
||||||
|
@click="editHandler">Connected</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<button
|
||||||
|
class="bg-neutral-700 hover:bg-neutral-800 transition text-white text-xs px-3 py-1 rounded-lg"
|
||||||
|
@click="saveHandler">Connect</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1.5">
|
<div class="flex flex-col gap-1.5">
|
||||||
|
|
||||||
|
|
||||||
<input v-model="url"
|
<input v-model="url"
|
||||||
class=" w-full bg-gray-100 hover:bg-gray-200 transition rounded-lg py-1 px-2 text-xs outline-none"
|
class=" w-full bg-gray-100 hover:bg-gray-200 transition rounded-lg py-1 px-2 text-xs outline-none disabled:bg-gray-100 disabled:text-gray-500 dark:disabled:text-gray-500"
|
||||||
placeholder="Open WebUI URL" />
|
placeholder="Open WebUI URL" :disabled='connected' />
|
||||||
<input v-model="token"
|
<input v-model="token"
|
||||||
class=" w-full bg-gray-100 hover:bg-gray-200 transition rounded-lg py-1 px-2 text-xs outline-none"
|
class=" w-full bg-gray-100 hover:bg-gray-200 transition rounded-lg py-1 px-2 text-xs outline-none disabled:bg-gray-100 disabled:text-gray-500 dark:disabled:text-gray-500"
|
||||||
placeholder="Open WebUI Token" />
|
placeholder="Open WebUI Token" :disabled='connected' />
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user