This commit is contained in:
Saifeddine ALOUI 2024-07-28 20:07:35 +02:00
parent 8b0d03500b
commit c8fe962139
9 changed files with 69 additions and 45 deletions

@ -1 +1 @@
Subproject commit 9e4159c1103e61b5178d32ac2f16aa762376520d
Subproject commit 0d9b7ad5e0b62d9d983a9906f218c4ad686fc7fe

View File

@ -1229,7 +1229,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
self.update_message(client_id, "✍ warming up ...", msg_type=MSG_TYPE.MSG_TYPE_STEP_START)
# prepare query and reception
self.discussion_messages, self.current_message, tokens, context_details, internet_search_infos = self.prepare_query(client_id, message_id, is_continue, n_tokens=self.config.min_n_predict, generation_type=generation_type, force_using_internet=force_using_internet)
self.discussion_messages, self.current_message, tokens, context_details, internet_search_infos = self.prepare_query(client_id, message_id, is_continue, n_tokens=self.config.min_n_predict, generation_type=generation_type, force_using_internet=force_using_internet, previous_chunk = client.generated_text if is_continue else "")
ASCIIColors.info(f"prompt has {self.config.ctx_size-context_details['available_space']} tokens")
ASCIIColors.info(f"warmup for generating up to {min(context_details['available_space'],self.config.max_n_predict)} tokens")
self.prepare_reception(client_id)

File diff suppressed because one or more lines are too long

8
web/dist/assets/index-14315572.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

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<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-11efc659.js"></script>
<link rel="stylesheet" href="/assets/index-0db1108c.css">
<script type="module" crossorigin src="/assets/index-767b56d7.js"></script>
<link rel="stylesheet" href="/assets/index-14315572.css">
</head>
<body>
<div id="app"></div>

View File

@ -12,7 +12,7 @@
</pre>
<div class="flex flex-row bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel p-2 rounded-lg shadow-sm">
<span class="text-2xl mr-2">{{ language }}</span>
<span class="text-2xl mr-2">{{ language.trim() }}</span>
<button @click="copyCode"
:title="isCopied ? 'Copied!' : 'Copy code'"
:class="isCopied ? 'bg-green-500' : ''"
@ -25,22 +25,22 @@
:class="isExecuting?'bg-green-500':''">
<i data-feather="play-circle"></i>
</button>
<button v-if="['airplay', 'mermaid', 'graphviz', 'dot', 'javascript', 'html', 'html5', 'svg', 'css'].includes(language)" ref="btn_code_exec_in_new_tab" @click="executeCode_in_new_tab" title="execute"
<button v-if="['airplay', 'mermaid', 'graphviz', 'dot', 'javascript', 'html', 'html5', 'svg', 'css'].includes(language.trim())" ref="btn_code_exec_in_new_tab" @click="executeCode_in_new_tab" title="execute"
class="px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"
:class="isExecuting?'bg-green-500':''">
<i data-feather="airplay"></i>
</button>
<button v-if="['python', 'latex', 'html'].includes(language)" @click="openFolder" title="open code project folder"
<button @click="openFolder" title="open code project folder"
class="px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"
>
<i data-feather="folder"></i>
</button>
<button v-if="['python', 'latex', 'html'].includes(language)" @click="openFolderVsCode" title="open code project folder in vscode"
<button v-if="['python', 'latex', 'html'].includes(language.trim())" @click="openFolderVsCode" title="open code project folder in vscode"
class="px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"
>
<img src="@/assets/vscode_black.svg" width="25" height="25">
</button>
<button v-if="['python', 'latex', 'html'].includes(language)" @click="openVsCode" title="open code in vscode"
<button v-if="['python', 'latex', 'html'].includes(language.trim())" @click="openVsCode" title="open code in vscode"
class="px-2 py-1 mr-2 mb-2 text-left text-sm font-medium rounded-lg hover:bg-primary dark:hover:bg-primary text-white transition-colors duration-200"
>
<img src="@/assets/vscode.svg" width="25" height="25">

View File

@ -6,7 +6,7 @@
<div
v-for="app in combinedApps"
:key="app.uid"
class="app-card border rounded-lg shadow-lg p-4 cursor-pointer hover:shadow-xl transition"
class="app-card border rounded-lg shadow-lg p-4 cursor-pointer hover:shadow-xl transition w-80"
@click="handleAppClick(app)"
>
<img :src="app.icon" alt="App Icon" class="app-icon w-16 h-16 mx-auto mb-2 rounded-full border border-gray-300" />
@ -14,12 +14,15 @@
<p class="text-center text-sm text-gray-600">Author: {{ app.author }}</p>
<p class="text-center text-sm text-gray-600">Version: {{ app.version }}</p>
<label class="text-center text-sm text-gray-600" for="app-description">Description:</label>
<p id="app-description" class="text-center text-sm text-gray-600">{{ app.description }}</p>
<div class="description-container">
<p id="app-description" class="text-center text-sm text-gray-600">{{ app.description }}</p>
</div>
<p class="text-center text-sm text-gray-600">AI Model: {{ app.model_name }}</p>
<p class="text-center text-sm text-gray-600 italic">Disclaimer: {{ app.disclaimer }}</p>
<div class="flex justify-between mt-2">
<button v-if="!app.installed" @click.stop="installApp(app.name)" class="bg-blue-500 text-white px-2 py-1 rounded">Install</button>
<button v-if="app.installed" @click.stop="uninstallApp(app.name)" class="bg-red-500 text-white px-2 py-1 rounded">Uninstall</button>
<button v-else-if="app.existsInFolder" @click.stop="deleteApp(app.name)" class="bg-yellow-500 text-white px-2 py-1 rounded">Delete</button>
<button v-else @click.stop="installApp(app.name)" class="bg-blue-500 text-white px-2 py-1 rounded">Install</button>
</div>
</div>
</div>
@ -51,11 +54,11 @@ export default {
computed: {
combinedApps() {
const installedAppNames = this.apps.map(app => app.name);
const localAppsMap = new Map(this.apps.map(app => [app.name, { ...app, installed: true }]));
const localAppsMap = new Map(this.apps.map(app => [app.name, { ...app, installed: true, existsInFolder: true }]));
this.githubApps.forEach(app => {
if (!localAppsMap.has(app.name)) {
localAppsMap.set(app.name, { ...app, installed: false });
localAppsMap.set(app.name, { ...app, installed: false, existsInFolder: false });
}
});
@ -131,6 +134,20 @@ export default {
this.fetchApps(); // Refresh the app list
}
},
async deleteApp(appName) {
this.loading = true;
try {
await axios.post(`/delete/${appName}`, {
client_id: this.$store.state.client_id,
});
this.showMessage('Deletion succeeded!', true);
} catch (error) {
this.showMessage('Deletion failed.', false);
} finally {
this.loading = false;
this.fetchApps(); // Refresh the app list
}
},
showMessage(msg, success) {
this.message = msg;
this.successMessage = success;
@ -158,6 +175,9 @@ export default {
gap: 1rem;
width: 100%;
}
.app-card {
width: 80%; /* Increased width */
}
.app-icon {
border-radius: 50%; /* Rounded edges */
border: 2px solid #d1d5db; /* Light gray border */
@ -187,6 +207,10 @@ export default {
background-color: #fed7d7; /* Red background */
color: #c53030; /* Dark red text */
}
.description-container {
max-height: 50px; /* Limit height */
overflow-y: auto; /* Enable vertical scroll */
}
@keyframes fadeIn {
from {
opacity: 0;

@ -1 +1 @@
Subproject commit d60251156075278e62eb78c2a9beb05c3eb1690d
Subproject commit ca84652b8fbdd62ddb4cb52d606c15c26460fb65