Preparing for the final move to FastAPI

This commit is contained in:
Saifeddine ALOUI 2024-01-06 02:05:07 +01:00
parent 89659d6986
commit 9f125abfbc
18 changed files with 657 additions and 441 deletions

171
app.py
View File

@ -261,94 +261,71 @@ try:
self.add_endpoint("/get_lollms_webui_version", "get_lollms_webui_version", self.get_lollms_webui_version, methods=["GET"])
self.add_endpoint("/reload_binding", "reload_binding", self.reload_binding, methods=["POST"])
self.add_endpoint("/restart_program", "restart_program", self.restart_program, methods=["GET"])
self.add_endpoint("/update_software", "update_software", self.update_software, methods=["GET"])
self.add_endpoint("/clear_uploads", "clear_uploads", self.clear_uploads, methods=["GET"])
self.add_endpoint("/selectdb", "selectdb", self.selectdb, methods=["GET"])
self.add_endpoint("/check_update", "check_update", self.check_update, methods=["GET"])
self.add_endpoint("/disk_usage", "disk_usage", self.disk_usage, methods=["GET"])
self.add_endpoint("/ram_usage", "ram_usage", self.ram_usage, methods=["GET"])
self.add_endpoint("/vram_usage", "vram_usage", self.vram_usage, methods=["GET"])
self.add_endpoint("/post_to_personality", "post_to_personality", self.post_to_personality, methods=["POST"])
self.add_endpoint("/install_model_from_path", "install_model_from_path", self.install_model_from_path, methods=["GET"])
self.add_endpoint("/list_bindings", "list_bindings", self.list_bindings, methods=["GET"])
self.add_endpoint("/install_binding", "install_binding", self.install_binding, methods=["POST"])
self.add_endpoint("/unInstall_binding", "unInstall_binding", self.unInstall_binding, methods=["POST"])
self.add_endpoint("/reinstall_binding", "reinstall_binding", self.reinstall_binding, methods=["POST"])
self.add_endpoint("/reinstall_personality", "reinstall_personality", self.reinstall_personality, methods=["POST"])
self.add_endpoint("/reinstall_extension", "reinstall_extension", self.reinstall_extension, methods=["POST"])
self.add_endpoint("/get_active_binding_settings", "get_active_binding_settings", self.get_active_binding_settings, methods=["GET"])
self.add_endpoint("/set_active_binding_settings", "set_active_binding_settings", self.set_active_binding_settings, methods=["POST"])
self.add_endpoint("/switch_personal_path", "switch_personal_path", self.switch_personal_path, methods=["POST"])
self.add_endpoint("/list_models", "list_models", self.list_models, methods=["GET"])
self.add_endpoint("/get_active_model", "get_active_model", self.get_active_model, methods=["GET"])
self.add_endpoint("/add_reference_to_local_model", "add_reference_to_local_model", self.add_reference_to_local_model, methods=["POST"])
self.add_endpoint("/add_model_reference", "add_model_reference", self.add_model_reference, methods=["POST"])
self.add_endpoint("/upload_model", "upload_model", self.upload_model, methods=["POST"])
self.add_endpoint("/upload_avatar", "upload_avatar", self.upload_avatar, methods=["POST"])
self.add_endpoint("/post_to_personality", "post_to_personality", self.post_to_personality, methods=["POST"])
self.add_endpoint("/reinstall_personality", "reinstall_personality", self.reinstall_personality, methods=["POST"])
self.add_endpoint("/list_mounted_personalities", "list_mounted_personalities", self.list_mounted_personalities, methods=["POST"])
self.add_endpoint("/list_personalities_categories", "list_personalities_categories", self.list_personalities_categories, methods=["GET"])
self.add_endpoint("/list_personalities", "list_personalities", self.list_personalities, methods=["GET"])
self.add_endpoint("/mount_personality", "mount_personality", self.p_mount_personality, methods=["POST"])
self.add_endpoint("/remount_personality", "remount_personality", self.p_remount_personality, methods=["POST"])
self.add_endpoint("/mount_extension", "mount_extension", self.p_mount_extension, methods=["POST"])
self.add_endpoint("/remount_extension", "remount_extension", self.p_remount_extension, methods=["POST"])
self.add_endpoint("/unmount_personality", "unmount_personality", self.p_unmount_personality, methods=["POST"])
self.add_endpoint("/unmount_all_personalities", "unmount_all_personalities", self.unmount_all_personalities, methods=["GET"])
self.add_endpoint("/select_personality", "select_personality", self.p_select_personality, methods=["POST"])
self.add_endpoint("/get_personality_settings", "get_personality_settings", self.get_personality_settings, methods=["POST"])
self.add_endpoint("/get_active_personality_settings", "get_active_personality_settings", self.get_active_personality_settings, methods=["GET"])
self.add_endpoint("/get_active_binding_settings", "get_active_binding_settings", self.get_active_binding_settings, methods=["GET"])
self.add_endpoint("/set_active_personality_settings", "set_active_personality_settings", self.set_active_personality_settings, methods=["POST"])
self.add_endpoint("/set_active_binding_settings", "set_active_binding_settings", self.set_active_binding_settings, methods=["POST"])
self.add_endpoint(
"/disk_usage", "disk_usage", self.disk_usage, methods=["GET"]
)
self.add_endpoint(
"/ram_usage", "ram_usage", self.ram_usage, methods=["GET"]
)
self.add_endpoint(
"/vram_usage", "vram_usage", self.vram_usage, methods=["GET"]
)
self.add_endpoint(
"/list_bindings", "list_bindings", self.list_bindings, methods=["GET"]
)
self.add_endpoint(
"/list_models", "list_models", self.list_models, methods=["GET"]
)
self.add_endpoint(
"/get_active_model", "get_active_model", self.get_active_model, methods=["GET"]
)
self.add_endpoint(
"/list_personalities_categories", "list_personalities_categories", self.list_personalities_categories, methods=["GET"]
)
self.add_endpoint(
"/list_personalities", "list_personalities", self.list_personalities, methods=["GET"]
)
self.add_endpoint(
"/list_databases", "list_databases", self.list_databases, methods=["GET"]
)
self.add_endpoint("/list_databases", "list_databases", self.list_databases, methods=["GET"])
self.add_endpoint("/select_database", "select_database", self.select_database, methods=["POST"])
# ----
self.add_endpoint("/reinstall_extension", "reinstall_extension", self.reinstall_extension, methods=["POST"])
self.add_endpoint("/mount_extension", "mount_extension", self.p_mount_extension, methods=["POST"])
self.add_endpoint("/remount_extension", "remount_extension", self.p_remount_extension, methods=["POST"])
self.add_endpoint("/switch_personal_path", "switch_personal_path", self.switch_personal_path, methods=["POST"])
self.add_endpoint("/upload_avatar", "upload_avatar", self.upload_avatar, methods=["POST"])
self.add_endpoint(
"/list_extensions_categories", "list_extensions_categories", self.list_extensions_categories, methods=["GET"]
)
@ -359,7 +336,6 @@ try:
"/list_discussions", "list_discussions", self.list_discussions, methods=["GET"]
)
self.add_endpoint("/delete_personality", "delete_personality", self.delete_personality, methods=["GET"])
self.add_endpoint("/", "", self.index, methods=["GET"])
self.add_endpoint("/settings/", "", self.index, methods=["GET"])
@ -1555,16 +1531,6 @@ try:
return jsonify(discussions)
def delete_personality(self):
category = request.args.get('category')
name = request.args.get('name')
path = self.lollms_paths.personalities_zoo_path/category/name
try:
shutil.rmtree(path)
return jsonify({'status':True})
except Exception as ex:
return jsonify({'status':False,'error':str(ex)})
def add_endpoint(
self,
endpoint=None,
@ -1720,32 +1686,6 @@ try:
"active_personality_id":self.config["active_personality_id"]
})
def install_model_from_path(self):
from tkinter import Tk
from tkinter.filedialog import askopenfilename
ASCIIColors.info(f"- Selecting model ...")
# Define the file types
filetypes = [
("Model file", self.binding.supported_file_extensions),
]
# Create the Tkinter root window
root = Tk()
# Hide the root window
root.withdraw()
# Open the file dialog
file_path = askopenfilename(filetypes=filetypes)
file_path = Path(file_path)
#
with open(str(self.lollms_paths.personal_models_path/self.config.binding_name/(file_path.stem+".reference")),"w") as f:
f.write(file_path)
return jsonify({
"status": True
})
def reinstall_extension(self):
try:
@ -1945,15 +1885,6 @@ try:
ASCIIColors.error(f"Couldn't clear the upload folder.\nMaybe some files are opened somewhere else.\Try doing it manually")
return {"status": False, 'error': "Couldn't clear the upload folder.\nMaybe some files are opened somewhere else.\Try doing it manually"}
def selectdb(self):
from tkinter import Tk, filedialog
# Initialize Tkinter
root = Tk()
root.withdraw()
# Show file selection dialog
file_path = filedialog.askopenfilename()
def check_update(self):
if self.config.auto_update:
res = check_update_()
@ -2143,14 +2074,6 @@ try:
ASCIIColors.yellow(f"Available personalities: {[p.name for p in self.mounted_personalities]}")
return jsonify({"status": False, "error":f"Personality not found @ {pth}"})
def unmount_all_personalities(self):
self.config.personalities=["generic/lollms"]
self.mounted_personalities=[]
self.personality=None
self.mount_personality(0)
self.config.save_config()
return jsonify({"status":True})
def p_unmount_personality(self):
print("- Unmounting personality ...")
try:
@ -2197,6 +2120,17 @@ try:
ASCIIColors.yellow(f"Available personalities: {[p.name for p in self.mounted_personalities]}")
return jsonify({"status": False, "error":"Couldn't unmount personality"})
def unmount_all_personalities(self):
self.config.personalities=["generic/lollms"]
self.mounted_personalities=[]
self.personality=None
self.mount_personality(0)
self.config.save_config()
return jsonify({"status":True})
def get_extension_settings(self):
print("- Retreiving extension settings")
data = request.get_json()
@ -2461,25 +2395,6 @@ try:
return jsonify({"status": False, "error":"Invalid ID"})
def add_model_reference(self):
try:
ASCIIColors.info("Creating a model reference")
path = Path(request.path)
ref_path=self.lollms_paths.personal_models_path/self.config.binding_name/(path.name+".reference")
with open(ref_path,"w") as f:
f.write(str(path))
return jsonify({"status": True})
except Exception as ex:
ASCIIColors.error(ex)
trace_exception(ex)
return jsonify({"status": False})
def upload_model(self):
file = request.files['file']
file.save(self.lollms_paths.personal_models_path/self.config.binding_name/file.filename)
return jsonify({"status": True})
def upload_avatar(self):
file = request.files['avatar']
file.save(self.lollms_paths.personal_user_infos_path/file.filename)

View File

@ -5,20 +5,82 @@ from starlette.responses import StreamingResponse
from lollms.types import MSG_TYPE
from lollms.utilities import detect_antiprompt, remove_text_from_string
from ascii_colors import ASCIIColors
from api.db import DiscussionsDB
from safe_store.text_vectorizer import TextVectorizer, VectorizationMethod, VisualizationMethod
import tqdm
class GenerateRequest(BaseModel):
text: str
class DatabaseSelectionParameters(BaseModel):
name: str
router = APIRouter()
elf_server = LOLLMSWebUI.get_instance()
lollmsElfServer = LOLLMSWebUI.get_instance()
@router.post("/generate")
def lollms_generate(request_data: GenerateRequest):
pass
@router.get("/list_discussions")
def list_discussions():
discussions = elf_server.db.get_discussions()
discussions = lollmsElfServer.db.get_discussions()
return discussions
@router.get("/list_databases")
async def list_databases():
"""List all the personal databases in the LoLLMs server."""
# Retrieve the list of database names
databases = [f.name for f in lollmsElfServer.lollms_paths.personal_databases_path.iterdir() if f.suffix == ".db"]
# Return the list of database names
return databases
@router.post("/select_database")
def select_database(data:DatabaseSelectionParameters):
if not data.name.endswith(".db"):
data.name += ".db"
print(f'Selecting database {data.name}')
# Create database object
lollmsElfServer.db = DiscussionsDB(lollmsElfServer.lollms_paths.personal_databases_path/data.name)
ASCIIColors.info("Checking discussions database... ",end="")
lollmsElfServer.db.create_tables()
lollmsElfServer.db.add_missing_columns()
lollmsElfServer.config.db_path = data.name
ASCIIColors.success("ok")
if lollmsElfServer.config.auto_save:
lollmsElfServer.config.save_config()
if lollmsElfServer.config.data_vectorization_activate and lollmsElfServer.config.use_discussions_history:
try:
ASCIIColors.yellow("0- Detected discussion vectorization request")
folder = lollmsElfServer.lollms_paths.personal_databases_path/"vectorized_dbs"
folder.mkdir(parents=True, exist_ok=True)
lollmsElfServer.long_term_memory = TextVectorizer(
vectorization_method=VectorizationMethod.TFIDF_VECTORIZER,#=VectorizationMethod.BM25_VECTORIZER,
database_path=folder/lollmsElfServer.config.db_path,
data_visualization_method=VisualizationMethod.PCA,#VisualizationMethod.PCA,
save_db=True
)
ASCIIColors.yellow("1- Exporting discussions")
lollmsElfServer.info("Exporting discussions")
discussions = lollmsElfServer.db.export_all_as_markdown_list_for_vectorization()
ASCIIColors.yellow("2- Adding discussions to vectorizer")
lollmsElfServer.info("Adding discussions to vectorizer")
index = 0
nb_discussions = len(discussions)
for (title,discussion) in tqdm(discussions):
lollmsElfServer.socketio.emit('update_progress',{'value':int(100*(index/nb_discussions))})
index += 1
if discussion!='':
skill = lollmsElfServer.learn_from_discussion(title, discussion)
lollmsElfServer.long_term_memory.add_document(title, skill, chunk_size=lollmsElfServer.config.data_vectorization_chunk_size, overlap_size=lollmsElfServer.config.data_vectorization_overlap_size, force_vectorize=False, add_as_a_bloc=False)
ASCIIColors.yellow("3- Indexing database")
lollmsElfServer.info("Indexing database",True, None)
lollmsElfServer.long_term_memory.index()
ASCIIColors.yellow("Ready")
except Exception as ex:
lollmsElfServer.error(f"Couldn't vectorize the database:{ex}")
return {"status":False}
return {"status":True}

View File

@ -0,0 +1,71 @@
"""
project: lollms_webui
file: lollms_webui_infos.py
author: ParisNeo
description:
This module contains a set of FastAPI routes that provide information about the Lord of Large Language and Multimodal Systems (LoLLMs) Web UI
application. These routes allow users to retrieve details such as the current version number, a list of available databases, and options for
updating or restarting the software.
"""
from fastapi import APIRouter, Request
import pkg_resources
from lollms_webui import LOLLMSWebUI
from ascii_colors import ASCIIColors
from lollms.utilities import load_config
from pathlib import Path
from typing import List
import sys
# Create an instance of the LoLLMSWebUI class
lollmsElfServer = LOLLMSWebUI.get_instance()
router = APIRouter()
@router.get("/get_lollms_webui_version")
async def get_lollms_webui_version():
"""Get the version of the LoLLMs Web UI application."""
# Return the version string
return lollmsElfServer.version
@router.get("/restart_program")
async def restart_program():
"""Restart the program."""
# Stop the socketIO server
lollmsElfServer.socketio.stop()
# Sleep for 1 second before rebooting
lollmsElfServer.socketio.sleep(1)
# Reboot the program
lollmsElfServer.socketio.reboot = True
@router.get("/update_software")
async def update_software():
"""Update the software."""
# Display an informative message
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("╔══════════════════════════════════════════════════╗")
ASCIIColors.info("║ Updating backend ║")
ASCIIColors.info("╚══════════════════════════════════════════════════╝")
ASCIIColors.info("")
ASCIIColors.info("")
ASCIIColors.info("")
# Stop the socketIO server
lollmsElfServer.socketio.stop()
# Run the update script using the provided arguments
lollmsElfServer.run_update_script(lollmsElfServer.args)
# Exit the program after successful update
sys.exit()
@router.get("/check_update")
def check_update():
"""Checks if an update is available"""
if lollmsElfServer.config.auto_update:
res = lollmsElfServer.check_update_()
return {'update_availability':res}
else:
return {'update_availability':False}

@ -1 +1 @@
Subproject commit de5e73c90f8b4bac5a636a8cb51a80902b2da4b4
Subproject commit e42ec2c799310d9a1b7450491484e7485b0fb809

View File

@ -14,6 +14,11 @@ from ascii_colors import ASCIIColors
from datetime import datetime
from api.db import DiscussionsDB, Discussion
from pathlib import Path
import os, sys
# The current version of the webui
lollms_webui_version="9.0 (alpha)"
import git
try:
from lollms.media import WebcamImageSender, AudioRecorder
@ -79,6 +84,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
socketio=socketio
)
self.app_name = "LOLLMSWebUI"
self.version= lollms_webui_version
self.busy = False
@ -156,4 +162,69 @@ class LOLLMSWebUI(LOLLMSElfServer):
else:
self.webcam = None
self.rec_output_folder = None
# Other methods and properties of the LoLLMSWebUI singleton class
def check_module_update_(self, repo_path, branch_name="main"):
try:
# Open the repository
ASCIIColors.yellow(f"Checking for updates from {repo_path}")
repo = git.Repo(repo_path)
# Fetch updates from the remote for the specified branch
repo.remotes.origin.fetch(refspec=f"refs/heads/{branch_name}:refs/remotes/origin/{branch_name}")
# Compare the local and remote commit IDs for the specified branch
local_commit = repo.head.commit
remote_commit = repo.remotes.origin.refs[branch_name].commit
# Check if the local branch is behind the remote branch
is_behind = repo.is_ancestor(local_commit, remote_commit) and local_commit!= remote_commit
ASCIIColors.yellow(f"update availability: {is_behind}")
# Return True if the local branch is behind the remote branch
return is_behind
except Exception as e:
# Handle any errors that may occur during the fetch process
# trace_exception(e)
return False
def check_update_(self, branch_name="main"):
try:
# Open the repository
repo_path = str(Path(__file__).parent)
if self.check_module_update_(repo_path, branch_name):
return True
repo_path = str(Path(__file__).parent/"lollms_core")
if self.check_module_update_(repo_path, branch_name):
return True
repo_path = str(Path(__file__).parent/"utilities/safe_store")
if self.check_module_update_(repo_path, branch_name):
return True
return False
except Exception as e:
# Handle any errors that may occur during the fetch process
# trace_exception(e)
return False
def run_update_script(self, args=None):
update_script = Path(__file__).parent/"update_script.py"
# Convert Namespace object to a dictionary
if args:
args_dict = vars(args)
else:
args_dict = {}
# Filter out any key-value pairs where the value is None
valid_args = {key: value for key, value in args_dict.items() if value is not None}
# Save the arguments to a temporary file
temp_file = Path(__file__).parent/"temp_args.txt"
with open(temp_file, "w") as file:
# Convert the valid_args dictionary to a string in the format "key1 value1 key2 value2 ..."
arg_string = " ".join([f"--{key} {value}" for key, value in valid_args.items()])
file.write(arg_string)
os.system(f"python {update_script}")
sys.exit(0)

View File

@ -21,9 +21,6 @@ import argparse
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))
@ -67,14 +64,25 @@ if __name__ == "__main__":
# Import all endpoints
from lollms.server.endpoints.lollms_infos import router as lollms_infos_router
from lollms.server.endpoints.lollms_hardware_infos import router as lollms_hardware_infos_router
from lollms.server.endpoints.lollms_binding_infos import router as lollms_binding_infos_router
from lollms.server.endpoints.lollms_models_infos import router as lollms_models_infos_router
from lollms.server.endpoints.lollms_personalities_infos import router as lollms_personalities_infos_router
from lollms.server.endpoints.lollms_generator import router as lollms_generator_router
from endpoints.lollms_discussion import router as lollms_discussion_router
from endpoints.lollms_webui_infos import router as lollms_webui_infos_router
app.include_router(lollms_infos_router)
app.include_router(lollms_hardware_infos_router)
app.include_router(lollms_binding_infos_router)
app.include_router(lollms_models_infos_router)
app.include_router(lollms_personalities_infos_router)
app.include_router(lollms_webui_infos_router)
app.include_router(lollms_generator_router)
app.include_router(lollms_discussion_router)
app.mount("/", StaticFiles(directory=Path(__file__).parent/"web"/"dist", html=True), name="static")
uvicorn.run(app, host=config.host, port=config.port)
uvicorn.run(app, host=config.host, port=6523)#config.port)

17
package-lock.json generated
View File

@ -2,5 +2,20 @@
"name": "lollms-webui",
"lockfileVersion": 3,
"requires": true,
"packages": {}
"packages": {
"": {
"dependencies": {
"vue-draggable-resizable": "^2.3.0"
}
},
"node_modules/vue-draggable-resizable": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/vue-draggable-resizable/-/vue-draggable-resizable-2.3.0.tgz",
"integrity": "sha512-77CLRj1TPwB30pwsjOf3pkd1UzYanCdKXbqhILJ0Oo5QQl50lvBfyQCXxMFzwWwTc3sbBbQH3FfWSV+BkoSElA==",
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
}
}
}
}

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"vue-draggable-resizable": "^2.3.0"
}
}

View File

@ -118,10 +118,6 @@ Content-Type: application/json
"folder": "text2bulletpoints"
}
############################################
### Install model from path
############################################
GET http://localhost:9600/install_model_from_path
############################################
### Get active personality settings

8
web/dist/assets/index-09f080f2.css vendored Normal file

File diff suppressed because one or more lines are too long

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
View File

@ -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-23a37a61.js"></script>
<link rel="stylesheet" href="/assets/index-154a09dc.css">
<script type="module" crossorigin src="/assets/index-5b1b5412.js"></script>
<link rel="stylesheet" href="/assets/index-09f080f2.css">
</head>
<body>
<div id="app"></div>

60
web/package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "0.0.0",
"dependencies": {
"axios": "^1.3.6",
"baklavajs": "^2.3.0",
"feather-icons": "^4.29.0",
"flowbite": "^1.6.5",
"flowbite-vue": "^0.0.10",
@ -75,6 +76,53 @@
"node": ">=6.0.0"
}
},
"node_modules/@baklavajs/core": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@baklavajs/core/-/core-2.3.0.tgz",
"integrity": "sha512-2PvcOa+ldtmxOfOVqEaadFK3X7d53zclN2W9aKDIvyndhQ6oBl/b/wxIe9er/uhKw2uJwPvVmX4P3x/0icLKZw==",
"dependencies": {
"@baklavajs/events": "^2.3.0",
"uuid": "^9.0.1"
}
},
"node_modules/@baklavajs/engine": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@baklavajs/engine/-/engine-2.3.0.tgz",
"integrity": "sha512-coo/KufVCDU8AQ22DQQ/XoaV1sIcmrLK3KeFILOaw0b/J7gsfKNg2wGrFEGdf9z/hkQBVN4LWU+KJ+NS/iLRiw==",
"dependencies": {
"@baklavajs/core": "^2.3.0",
"@baklavajs/events": "^2.3.0"
}
},
"node_modules/@baklavajs/events": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@baklavajs/events/-/events-2.3.0.tgz",
"integrity": "sha512-1vAkeZya/e0p4T4WIqtM5hwAmapwK8OzeoFDXXuzuT8o88HyXG0+wrFjQjw0dnfo9fpEUVHUA9ooKyflKqGWuA=="
},
"node_modules/@baklavajs/interface-types": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@baklavajs/interface-types/-/interface-types-2.3.0.tgz",
"integrity": "sha512-TVtVnUgceNY5A6Nm8GF8OQiHp0HT1n6DsfzvnFUyGKXlGgCzwx6juTwDJlu6fHBTqFW/H6OoAgHvasfoJfY3Bg==",
"dependencies": {
"@baklavajs/core": "^2.3.0",
"@baklavajs/engine": "^2.3.0",
"@baklavajs/renderer-vue": "^2.3.0"
}
},
"node_modules/@baklavajs/renderer-vue": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@baklavajs/renderer-vue/-/renderer-vue-2.3.0.tgz",
"integrity": "sha512-FH00mmiw4x/PXMWT/+uQyptXpOD1xDjniXe5eVczMpSGtlXo4lDL5Xi8pRkOzxlTYFbpup+SJBQ20aoLUu1aew==",
"dependencies": {
"@baklavajs/core": "^2.3.0",
"@baklavajs/events": "^2.3.0"
}
},
"node_modules/@baklavajs/themes": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@baklavajs/themes/-/themes-2.3.0.tgz",
"integrity": "sha512-UGG8+3xCTTfMawWp+sCIu7JSdshc9GgKOrh7djAvPmVi5J3IDEyL0CN3QKP7R0JFbiwnJmsCwfD9ihkjOVU40g=="
},
"node_modules/@braintree/sanitize-url": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz",
@ -1033,6 +1081,18 @@
"proxy-from-env": "^1.1.0"
}
},
"node_modules/baklavajs": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/baklavajs/-/baklavajs-2.3.0.tgz",
"integrity": "sha512-LYDW3SzLqmOikzxW0LuYM04KMK1GsQ43W/TMpvx65oJrsLYaPsokWNvRvCsjiJS1Kb6RC8V2hDQAYig9iNY24Q==",
"dependencies": {
"@baklavajs/core": "^2.3.0",
"@baklavajs/engine": "^2.3.0",
"@baklavajs/interface-types": "^2.3.0",
"@baklavajs/renderer-vue": "^2.3.0",
"@baklavajs/themes": "^2.3.0"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",

View File

@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^1.3.6",
"baklavajs": "^2.3.0",
"feather-icons": "^4.29.0",
"flowbite": "^1.6.5",
"flowbite-vue": "^0.0.10",

View File

@ -5,12 +5,15 @@
<RouterLink :to="{ name: 'discussions' }" class="link-item dark:link-item-dark">
Discussions
</RouterLink>
<RouterLink :to="{ name: 'interactive' }" class="link-item dark:link-item-dark">
Interactive
</RouterLink>
<RouterLink :to="{ name: 'playground' }" class="link-item dark:link-item-dark">
Playground
</RouterLink>
<RouterLink :to="{ name: 'interactive' }" class="link-item dark:link-item-dark">
Interactive (under construction)
</RouterLink>
<RouterLink :to="{ name: 'nodes' }" class="link-item dark:link-item-dark">
Nodes (under construction)
</RouterLink>
<!--
<RouterLink :to="{ name: 'training' }" class="link-item dark:link-item-dark">

View File

@ -7,7 +7,7 @@ import TrainingView from '../views/TrainingView.vue'
import QuantizingView from '../views/QuantizingView.vue'
import DiscussionsView from '../views/DiscussionsView.vue'
import InteractiveView from '../views/InteractiveView.vue'
import NodesView from '../views/NodesView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@ -52,6 +52,11 @@ const router = createRouter({
name: 'interactive',
component: InteractiveView
},
{
path: '/',
name: 'nodes',
component: NodesView
},
],
// scrollBehavior

View File

@ -1918,23 +1918,23 @@ export default {
this.isCreated = true
},
async mounted() {
let serverAddress = "http://localhost:9600/";
try {
const response = await fetch('/get_server_address'); // Replace with the actual endpoint on your Flask server
serverAddress = await response.text();
if(serverAddress.includes('<')){
console.log(`Server address not found`)
serverAddress = "http://localhost:9600/"//process.env.VITE_LOLLMS_API
// let serverAddress = "http://localhost:9600/";
// try {
// const response = await fetch('/get_server_address'); // Replace with the actual endpoint on your Flask server
// serverAddress = await response.text();
// if(serverAddress.includes('<')){
// console.log(`Server address not found`)
// serverAddress = "http://localhost:9600/"//process.env.VITE_LOLLMS_API
}
console.log(`Server address: ${serverAddress}`)
} catch (error) {
console.error('Error fetching server address:', error);
// }
// console.log(`Server address: ${serverAddress}`)
// } catch (error) {
// console.error('Error fetching server address:', error);
// Handle error if necessary
serverAddress = "http://localhost:9600/"
}
this.host = `${serverAddress}`; // Construct the full server address dynamically
axios.defaults.baseURL = serverAddress
// serverAddress = "http://localhost:9600/"
// }
// this.host = `${serverAddress}`; // Construct the full server address dynamically
// axios.defaults.baseURL = serverAddress
//console.log('chatbox mnt',this.$refs)
this.$nextTick(() => {
feather.replace();