mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-18 02:39:47 +00:00
Working socketio for new app
This commit is contained in:
parent
f886db99b4
commit
2de29b23cf
2
app.py
2
app.py
@ -161,7 +161,7 @@ try:
|
||||
CORS(app)
|
||||
from flask_compress import Compress
|
||||
# async_mode='gevent', ping_timeout=1200, ping_interval=120,
|
||||
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='gevent', ping_timeout=1200, ping_interval=120)
|
||||
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='gevent', ping_timeout=1200, ping_interval=120, path='/socket.io')
|
||||
#socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading',engineio_options={'websocket_compression': True, 'websocket_ping_interval': 20, 'websocket_ping_timeout': 120, 'websocket_max_queue': 100})
|
||||
compress = Compress(app)
|
||||
app.config['SECRET_KEY'] = 'secret!'
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e42ec2c799310d9a1b7450491484e7485b0fb809
|
||||
Subproject commit 9d8db7a0da156287f325adf0971cf0f5bce07b5e
|
10
new_app.py
10
new_app.py
@ -18,25 +18,25 @@ from ascii_colors import ASCIIColors
|
||||
import socketio
|
||||
import uvicorn
|
||||
import argparse
|
||||
from socketio import ASGIApp
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# Create a Socket.IO server
|
||||
sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins="*") # Enable CORS for all origins
|
||||
app.mount("/socket.io", socketio.ASGIApp(sio))
|
||||
|
||||
# Define a WebSocket event handler
|
||||
@sio.event
|
||||
async def connect(sid, environ):
|
||||
print(f"Connected: {sid}")
|
||||
ASCIIColors.yellow(f"Connected: {sid}")
|
||||
|
||||
@sio.event
|
||||
async def disconnect(sid):
|
||||
print(f"Disconnected: {sid}")
|
||||
ASCIIColors.yellow(f"Disconnected: {sid}")
|
||||
|
||||
@sio.event
|
||||
async def message(sid, data):
|
||||
print(f"Message from {sid}: {data}")
|
||||
ASCIIColors.yellow(f"Message from {sid}: {data}")
|
||||
await sio.send(sid, "Message received!")
|
||||
|
||||
|
||||
@ -84,5 +84,7 @@ if __name__ == "__main__":
|
||||
|
||||
app.mount("/", StaticFiles(directory=Path(__file__).parent/"web"/"dist", html=True), name="static")
|
||||
|
||||
app = ASGIApp(socketio_server=sio, other_asgi_app=app)
|
||||
|
||||
|
||||
uvicorn.run(app, host=config.host, port=6523)#config.port)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,8 +5,8 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue</title>
|
||||
<script type="module" crossorigin src="/assets/index-BiFwvWxo.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-4PiIduat.css">
|
||||
<script type="module" crossorigin src="/assets/index-26HIjSQ3.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-uMQcfNrh.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -13,6 +13,7 @@
|
||||
"feather-icons": "^4.29.1",
|
||||
"flowbite": "^2.2.1",
|
||||
"postcss": "^8.4.32",
|
||||
"socket.io-client": "^4.7.3",
|
||||
"tailwind-scrollbar": "^3.0.5",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"vue": "^3.3.11",
|
||||
@ -692,6 +693,11 @@
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@socket.io/component-emitter": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
|
||||
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg=="
|
||||
},
|
||||
"node_modules/@vitejs/plugin-vue": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-4.6.2.tgz",
|
||||
@ -1101,6 +1107,22 @@
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
@ -1134,6 +1156,26 @@
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
|
||||
},
|
||||
"node_modules/engine.io-client": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz",
|
||||
"integrity": "sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1",
|
||||
"engine.io-parser": "~5.2.1",
|
||||
"ws": "~8.11.0",
|
||||
"xmlhttprequest-ssl": "~2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-parser": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz",
|
||||
"integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
@ -1570,6 +1612,11 @@
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/mz": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
|
||||
@ -1981,6 +2028,32 @@
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-client": {
|
||||
"version": "4.7.3",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.3.tgz",
|
||||
"integrity": "sha512-nU+ywttCyBitXIl9Xe0RSEfek4LneYkJxCeNnKCuhwoH4jGXO1ipIUw/VA/+Vvv2G1MTym11fzFC0SxkrcfXDw==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.2",
|
||||
"engine.io-client": "~6.5.2",
|
||||
"socket.io-parser": "~4.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-parser": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
|
||||
"integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||
@ -2423,6 +2496,34 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xmlhttprequest-ssl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
|
||||
"integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
|
||||
|
@ -14,6 +14,7 @@
|
||||
"feather-icons": "^4.29.1",
|
||||
"flowbite": "^2.2.1",
|
||||
"postcss": "^8.4.32",
|
||||
"socket.io-client": "^4.7.3",
|
||||
"tailwind-scrollbar": "^3.0.5",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"vue": "^3.3.11",
|
||||
|
@ -1,45 +1,50 @@
|
||||
<template>
|
||||
<div class="flex flex-col items-center justify-center rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2">
|
||||
<img :src = "LoLLMSLogo">
|
||||
<img :src = "LoLLMSLogo" width="200px" height="200px">
|
||||
<h1 class="text-4xl font-bold mb-4">LOLLMS installation tool</h1>
|
||||
<p class="text-left">
|
||||
Welcome to the installer of lollms. Here you can select your install profile.<br>
|
||||
Let's start by selecting the hardware.<br><br>
|
||||
</p>
|
||||
<div class="flex flex-col gap-2">
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="cpu-noavx" v-model="selectedOption" class="mr-2">
|
||||
Use CPU without AVX (for old CPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="cpu" v-model="selectedOption" class="mr-2">
|
||||
Use CPU with AVX support (new CPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="nvidia" v-model="selectedOption" class="mr-2">
|
||||
Use NVIDIA GPU without tensorcore (for old GPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="nvidia-tensorcores" v-model="selectedOption" class="mr-2">
|
||||
Use NVIDIA GPU with tensorcore (new GPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="amd-noavx" v-model="selectedOption" class="mr-2">
|
||||
Use AMD GPU with no avx
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="amd" v-model="selectedOption" class="mr-2">
|
||||
Use AMD GPU
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="apple-intel" v-model="selectedOption" class="mr-2">
|
||||
Apple with intel CPU
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="apple-silicon" v-model="selectedOption" class="mr-2">
|
||||
Apple silicon (M1, M2 M3)
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 container h-500 overflow-y-scroll">
|
||||
<div>
|
||||
<label>Personal path: </label>
|
||||
<input type="text" v-bind="personal_path">
|
||||
</div>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="cpu-noavx" v-model="selectedOption" class="mr-2">
|
||||
Use CPU without AVX (for old CPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="cpu" v-model="selectedOption" class="mr-2">
|
||||
Use CPU with AVX support (new CPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="nvidia" v-model="selectedOption" class="mr-2">
|
||||
Use NVIDIA GPU without tensorcore (for old GPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="nvidia-tensorcores" v-model="selectedOption" class="mr-2">
|
||||
Use NVIDIA GPU with tensorcore (new GPUs)
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="amd-noavx" v-model="selectedOption" class="mr-2">
|
||||
Use AMD GPU with no avx
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="amd" v-model="selectedOption" class="mr-2">
|
||||
Use AMD GPU
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="apple-intel" v-model="selectedOption" class="mr-2">
|
||||
Apple with intel CPU
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" value="apple-silicon" v-model="selectedOption" class="mr-2">
|
||||
Apple silicon (M1, M2 M3)
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<button @click="install" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 mt-4 rounded">
|
||||
Install
|
||||
</button>
|
||||
@ -53,24 +58,75 @@ import MessageBox from '../components/MessageBox.vue';
|
||||
import Toast from '../components/Toast.vue';
|
||||
import axios from 'axios';
|
||||
import LoLLMSLogo from '../assets/logo.png'
|
||||
import socket from '../services/websocket'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
LoLLMSLogo:LoLLMSLogo,
|
||||
selectedOption: "cpu",
|
||||
personal_path: '',
|
||||
};
|
||||
},
|
||||
async mounted(){
|
||||
this.personal_path = await axios.get("/get_personal_path")
|
||||
socket.on('notification', this.notify)
|
||||
},
|
||||
components:{
|
||||
MessageBox,
|
||||
Toast
|
||||
},
|
||||
methods: {
|
||||
folderSelected(event) {
|
||||
const files = event.target.files;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
console.log(files[i].webkitRelativePath);
|
||||
}
|
||||
personal_path = files[0].webkitRelativePath
|
||||
},
|
||||
notify(notif){
|
||||
self.isGenerating = false
|
||||
this.setDiscussionLoading(this.currentDiscussion.id, this.isGenerating);
|
||||
nextTick(() => {
|
||||
const msgList = document.getElementById('messages-list')
|
||||
this.scrollBottom(msgList)
|
||||
})
|
||||
if(notif.display_type==0){
|
||||
this.$store.state.toast.showToast(notif.content, notif.duration, notif.notification_type)
|
||||
}
|
||||
else if(notif.display_type==1){
|
||||
this.$store.state.messageBox.showMessage(notif.content)
|
||||
}
|
||||
else if(notif.display_type==2){
|
||||
this.$store.state.messageBox.hideMessage()
|
||||
this.$store.state.yesNoDialog.askQuestion(notif.content, 'Yes', 'No').then(yesRes => {
|
||||
socket.emit("yesNoRes",{yesRes:yesRes})
|
||||
})
|
||||
}
|
||||
else if(notif.display_type==3){
|
||||
this.$store.state.messageBox.showBlockingMessage(notif.content)
|
||||
}
|
||||
else if(notif.display_type==4){
|
||||
this.$store.state.messageBox.hideMessage()
|
||||
}
|
||||
|
||||
this.chime.play()
|
||||
},
|
||||
install() {
|
||||
this.$ref.toast.showToast(`Starting the install with option:${this.selectedOption}`, 4, true)
|
||||
this.$refs.toast.showToast(`Starting the install with option:${this.selectedOption}`, 4, true)
|
||||
axios.post("/start_installing",{mode:this.selectedOption}).then(()=>{
|
||||
this.$ref.messageBox.showMessage("Success!\nPlease close this page and open the run script from your install folder")
|
||||
this.$refs.messageBox.showMessage("Success!\nPlease close this page and open the run script from your install folder")
|
||||
});
|
||||
},
|
||||
selectFolder() {
|
||||
axios.get('/choose_path')
|
||||
.then(response => {
|
||||
this.personal_path = response.data.new_path;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -15,31 +15,24 @@ from lollms.types import MSG_TYPE, SENDER_TYPES
|
||||
from lollms.app import LollmsApplication
|
||||
from pathlib import Path
|
||||
from ascii_colors import ASCIIColors
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from starlette.responses import FileResponse
|
||||
from starlette.requests import Request
|
||||
import webbrowser
|
||||
import socketio
|
||||
from fastapi import FastAPI
|
||||
from socketio import ASGIApp
|
||||
|
||||
|
||||
root_path = Path(__file__).parent.parent.parent.parent
|
||||
global_path = root_path/"global_paths_cfg.yaml"
|
||||
if global_path.exists():
|
||||
ASCIIColors.yellow(f"global_path: {global_path}")
|
||||
lollms_paths = LollmsPaths(global_path)
|
||||
lollms_paths = LollmsPaths(global_path, prepare_configuration=False)
|
||||
config = LOLLMSConfig.autoload(lollms_paths,lollms_paths.personal_configuration_path/"local_config.yaml")
|
||||
else:
|
||||
ASCIIColors.yellow(f"global_path: {global_path}")
|
||||
lollms_paths = LollmsPaths(global_path)
|
||||
lollms_paths = LollmsPaths(global_path, prepare_configuration=False)
|
||||
config = LOLLMSConfig.autoload(lollms_paths,lollms_paths.personal_configuration_path/"local_config.yaml")
|
||||
|
||||
shared_folder = lollms_paths.personal_path/"shared"
|
||||
sd_folder = shared_folder / "auto_sd"
|
||||
output_dir = lollms_paths.personal_path / "outputs/sd"
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
script_path = sd_folder / "lollms_sd.bat"
|
||||
output_folder = lollms_paths.personal_outputs_path/"audio_out"
|
||||
|
||||
ASCIIColors.red(" ")
|
||||
ASCIIColors.red(" __ _____ __ __ _____ _____ ")
|
||||
@ -52,7 +45,6 @@ ASCIIColors.yellow(f"Root dir : {root_path}")
|
||||
|
||||
sio = socketio.AsyncServer(async_mode='asgi')
|
||||
app = FastAPI(debug=True)
|
||||
app.mount("/socket.io", socketio.ASGIApp(sio))
|
||||
|
||||
lollms_app = LollmsApplication(
|
||||
"lollms_installer",
|
||||
@ -62,13 +54,17 @@ lollms_app = LollmsApplication(
|
||||
load_model=False,
|
||||
load_voice_service=False,
|
||||
load_sd_service=False,
|
||||
socketio=sio)
|
||||
socketio=sio,
|
||||
free_mode=True)
|
||||
|
||||
app.mount("/", StaticFiles(directory=Path(__file__).parent/"frontend"/"dist", html=True), name="static")
|
||||
|
||||
class InstallProperties(BaseModel):
|
||||
mode: str
|
||||
|
||||
@app.get("/get_personal_path")
|
||||
def get_personal_path():
|
||||
return lollms_paths.personal_path
|
||||
|
||||
@app.post("/start_installing")
|
||||
def start_installing(data: InstallProperties):
|
||||
"""
|
||||
@ -140,6 +136,9 @@ def start_installing(data: InstallProperties):
|
||||
# Your code here
|
||||
return {"message": "Item created successfully"}
|
||||
|
||||
app.mount("/", StaticFiles(directory=Path(__file__).parent/"frontend"/"dist", html=True), name="static")
|
||||
app = ASGIApp(socketio_server=sio, other_asgi_app=app)
|
||||
|
||||
if __name__ == "__main__":
|
||||
webbrowser.open(f"http://localhost:8000")
|
||||
uvicorn.run(app, host="localhost", port=8000)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-5b1b5412.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-09f080f2.css">
|
||||
<script type="module" crossorigin src="/assets/index-be733980.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-0b72f569.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -7,7 +7,8 @@
|
||||
import io from 'socket.io-client';
|
||||
|
||||
// fixes issues when people not hosting this site on local network
|
||||
const URL = process.env.NODE_ENV === "production" ? undefined : (import.meta.env.VITE_LOLLMS_API);
|
||||
const URL = process.env.NODE_ENV === "production" ? "/" : (import.meta.env.VITE_LOLLMS_API)+"/";
|
||||
console.log(URL)
|
||||
const socket = new io(URL,{
|
||||
reconnection: true, // Enable reconnection
|
||||
reconnectionAttempts: 10, // Maximum reconnection attempts
|
||||
|
74
web/src/views/NodesView.vue
Normal file
74
web/src/views/NodesView.vue
Normal file
@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div style="width: 100vw; height: 100vh">
|
||||
<baklava-editor :view-model="baklava" />
|
||||
<button @click="saveGraph">Save Graph</button>
|
||||
<button @click="loadGraph">Load Graph</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from "vue";
|
||||
import {
|
||||
EditorComponent,
|
||||
useBaklava,
|
||||
DependencyEngine,
|
||||
applyResult
|
||||
} from "baklavajs";
|
||||
//import "../css/classic.css";
|
||||
import "@baklavajs/themes/dist/syrup-dark.css";
|
||||
|
||||
import { AgentNode } from "../nodes/Agent";
|
||||
import { RAGNode } from "../nodes/Rag";
|
||||
import { TaskNode } from "../nodes/Task";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
"baklava-editor": EditorComponent
|
||||
},
|
||||
setup() {
|
||||
const baklava = useBaklava();
|
||||
const engine = new DependencyEngine(baklava.editor);
|
||||
|
||||
|
||||
baklava.editor.registerNodeType(AgentNode);
|
||||
baklava.editor.registerNodeType(TaskNode);
|
||||
baklava.editor.registerNodeType(RAGNode);
|
||||
|
||||
const token = Symbol();
|
||||
engine.events.afterRun.subscribe(token, (result) => {
|
||||
engine.pause();
|
||||
applyResult(result, baklava.editor);
|
||||
engine.resume();
|
||||
});
|
||||
|
||||
engine.start();
|
||||
|
||||
function addNodeWithCoordinates(nodeType, x, y) {
|
||||
const n = new nodeType();
|
||||
baklava.displayedGraph.addNode(n);
|
||||
n.position.x = x;
|
||||
n.position.y = y;
|
||||
return n;
|
||||
}
|
||||
const node1 = addNodeWithCoordinates(TaskNode, 300, 140);
|
||||
const node2 = addNodeWithCoordinates(AgentNode, 550, 140);
|
||||
baklava.displayedGraph.addConnection(
|
||||
node1.outputs.result,
|
||||
node2.inputs.value
|
||||
);
|
||||
|
||||
return {
|
||||
baklava,
|
||||
saveGraph: () => {
|
||||
const exportedGraph = engine.export();
|
||||
localStorage.setItem('myGraph', JSON.stringify(exportedGraph));
|
||||
},
|
||||
loadGraph: () => {
|
||||
const savedGraph = JSON.parse(localStorage.getItem('myGraph'));
|
||||
engine.import(savedGraph);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user