Fixed apps zoo

This commit is contained in:
Saifeddine ALOUI 2024-07-30 01:12:54 +02:00
parent 019a69fb01
commit dd0c3888cb
4 changed files with 18 additions and 9 deletions

View File

@ -24,9 +24,10 @@ class AuthRequest(BaseModel):
client_id: str
class AppInfo:
def __init__(self, uid: str, name: str, icon: str, category:str, description: str, author:str, version:str, model_name:str, disclaimer:str):
def __init__(self, uid: str, name: str, folder_name: str, icon: str, category:str, description: str, author:str, version:str, model_name:str, disclaimer:str, installed: bool):
self.uid = uid
self.name = name
self.folder_name = folder_name
self.icon = icon
self.category = category
self.description = description
@ -34,6 +35,7 @@ class AppInfo:
self.version = version
self.model_name = model_name
self.disclaimer = disclaimer
self.installed = installed
@router.get("/apps")
async def list_apps():
@ -60,19 +62,24 @@ async def list_apps():
version = data.get('version', '')
model_name = data.get('model_name', '')
disclaimer = data.get('disclaimer', 'No disclaimer provided.')
installed = True
else:
installed = False
if icon_path.exists():
uid = str(uuid.uuid4())
apps.append(AppInfo(
uid=uid,
name=application_name,
folder_name = app_name.name,
icon=f"/apps/{app_name.name}/icon",
category=category,
description=description,
author=author,
version=version,
model_name=model_name,
disclaimer=disclaimer
disclaimer=disclaimer,
installed=installed
))
return apps
@ -205,14 +212,16 @@ def load_apps_data():
description_data = yaml.safe_load(file)
apps.append(AppInfo(
uid=str(uuid.uuid4()),
name=item,
name=description_data.get("name",item),
folder_name=item,
icon=icon_url,
category=description_data.get('category', 'generic'),
description=description_data.get('description', ''),
author=description_data.get('author', ''),
version=description_data.get('version', ''),
model_name=description_data.get('model_name', ''),
disclaimer=description_data.get('disclaimer', 'No disclaimer provided.')
disclaimer=description_data.get('disclaimer', 'No disclaimer provided.'),
installed=True
))
return apps

File diff suppressed because one or more lines are too long

2
web/dist/index.html vendored
View File

@ -6,7 +6,7 @@
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-c8b4e1bc.js"></script>
<script type="module" crossorigin src="/assets/index-6a853d50.js"></script>
<link rel="stylesheet" href="/assets/index-5b307d27.css">
</head>
<body>

View File

@ -192,12 +192,12 @@ export default {
async handleAppClick(app) {
if (app.installed) {
this.selectedApp = app;
const response = await axios.post(`/apps/${app.name}/code`, {
const response = await axios.post(`/apps/${app.folder_name}/code`, {
client_id: this.$store.state.client_id,
});
this.appCode = response.data;
} else {
this.showMessage(`Please install ${app.name} to view its code.`, false);
this.showMessage(`Please install ${app.folder_name} to view its code.`, false);
}
},
backToZoo() {
@ -252,7 +252,7 @@ export default {
try {
const response = await axios.post('/open_app_in_vscode', {
client_id: this.$store.state.client_id,
app_name: app.name,
app_name: app.folder_name,
});
this.showMessage(response.data.message, true);
} catch (error) {