mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-20 04:47:55 +00:00
Upgraded
This commit is contained in:
parent
8eaded6234
commit
695b874380
@ -19,6 +19,7 @@ from lollms.paths import LollmsPaths
|
||||
from lollms.helpers import ASCIIColors, trace_exception
|
||||
from lollms.app import LollmsApplication
|
||||
from lollms.utilities import File64BitsManager, PromptReshaper
|
||||
from lollms.media import WebcamImageSender
|
||||
from safe_store import TextVectorizer, VectorizationMethod, VisualizationMethod
|
||||
import threading
|
||||
from tqdm import tqdm
|
||||
@ -178,6 +179,8 @@ class LoLLMsAPI(LollmsApplication):
|
||||
}
|
||||
}
|
||||
|
||||
self.webcam = WebcamImageSender(socketio)
|
||||
|
||||
# =========================================================================================
|
||||
# Socket IO stuff
|
||||
# =========================================================================================
|
||||
@ -210,6 +213,16 @@ class LoLLMsAPI(LollmsApplication):
|
||||
|
||||
ASCIIColors.error(f'Client {request.sid} disconnected')
|
||||
|
||||
|
||||
@socketio.on('start_webcam_video_stream')
|
||||
def start_webcam_video_stream():
|
||||
self.webcam.start_capture()
|
||||
|
||||
@socketio.on('stop_webcam_video_stream')
|
||||
def stop_webcam_video_stream():
|
||||
self.webcam.stop_capture()
|
||||
|
||||
|
||||
@socketio.on('upgrade_vectorization')
|
||||
def upgrade_vectorization():
|
||||
if self.config.data_vectorization_activate and self.config.use_discussions_history:
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8b2b885e63a6a675fe34bb8c2d559cc7fd0ed61a
|
||||
Subproject commit 04bd34f1e6aa93974a7d8855552bbb7cc50722cb
|
8
web/dist/assets/index-4ffd8c20.css
vendored
8
web/dist/assets/index-4ffd8c20.css
vendored
File diff suppressed because one or more lines are too long
8
web/dist/assets/index-98356d8a.css
vendored
Normal file
8
web/dist/assets/index-98356d8a.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
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-b2f552bf.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-4ffd8c20.css">
|
||||
<script type="module" crossorigin src="/assets/index-d408a8bd.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-98356d8a.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -100,7 +100,7 @@ export default {
|
||||
const codeContent = document.createElement('pre');
|
||||
const codeContentCode = document.createElement('code');
|
||||
codeContentCode.classList.add('code-content');
|
||||
codeContentCode.innerHTML = hljs.highlight(validLanguage, trimmedCode).value;
|
||||
codeContentCode.innerHTML = hljs.highlight(trimmedCode, {language: validLanguage, ignoreIllegals: true }).value;
|
||||
codeContent.appendChild(codeContentCode);
|
||||
codeContainer.appendChild(lineNumbersContainer);
|
||||
codeContainer.appendChild(codeContent);
|
||||
|
63
web/src/components/FloatingFrame.vue
Normal file
63
web/src/components/FloatingFrame.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div class="floating-frame">
|
||||
<img v-if="isVideoActive" :src="imageDataUrl" alt="Webcam Frame" width="300" height="300" />
|
||||
<div class="controls">
|
||||
<button @click="startVideoStream">Activate Video</button>
|
||||
<button @click="stopVideoStream">Deactivate Video</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import socket from '@/services/websocket.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isVideoActive: false,
|
||||
imageDataUrl: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
startVideoStream() {
|
||||
this.isVideoActive = true;
|
||||
socket.emit('start_webcam_video_stream');
|
||||
},
|
||||
stopVideoStream() {
|
||||
this.isVideoActive = false;
|
||||
this.imageData = null;
|
||||
socket.emit('stop_webcam_video_stream');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
socket.on('image', (imageBase64) => {
|
||||
if (this.isVideoActive) {
|
||||
this.imageDataUrl = 'data:image/jpeg;base64,' + imageBase64;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.floating-frame {
|
||||
margin: 15px;
|
||||
float: left;
|
||||
width: 200px;
|
||||
height: auto;
|
||||
border: 1px solid #000;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
z-index: 5000;
|
||||
}
|
||||
|
||||
.floating-frame img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.controls {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -382,7 +382,7 @@ export const store = createStore({
|
||||
|
||||
extensions.sort((a, b) => a.name.localeCompare(b.name))
|
||||
|
||||
commit('setActiveExtensions', this.state.config.extensions);
|
||||
//commit('setActiveExtensions', this.state.config.extensions);
|
||||
|
||||
console.log("Done loading extensions")
|
||||
|
||||
|
@ -1,24 +1,39 @@
|
||||
<template>
|
||||
<div ref="webglContainer">
|
||||
<div v-if="!personality.scene_path && (!personality.avatar || personality.avatar === '')">
|
||||
<div class="flex-col">
|
||||
<div v-if="!activePersonality.scene_path" class="text-center">
|
||||
<!-- Display text when there's no scene_path or empty avatar -->
|
||||
Personality does not have a 3d avatar.
|
||||
</div>
|
||||
<div v-if="(!activePersonality.avatar || activePersonality.avatar === '')" class="text-center">
|
||||
Personality does not have an avatar.
|
||||
</div>
|
||||
</div>
|
||||
<FloatingFrame />
|
||||
</div>
|
||||
<div ref="webglContainer">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as THREE from 'three';
|
||||
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
||||
import { TextureLoader } from 'three';
|
||||
import FloatingFrame from '@/components/FloatingFrame.vue';
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
activePersonality: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
personality: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
components: {
|
||||
FloatingFrame
|
||||
},
|
||||
computed: {
|
||||
isReady:{
|
||||
get() {
|
||||
@ -34,7 +49,7 @@
|
||||
while (this.isReady === false) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100)); // Wait for 100ms
|
||||
}
|
||||
console.log("ready")
|
||||
console.log("Personality:", this.personality)
|
||||
this.initWebGLScene();
|
||||
this.updatePersonality();
|
||||
},
|
||||
@ -72,17 +87,17 @@
|
||||
const { mountedPersArr, config } = this.$store.state;
|
||||
|
||||
// Get the active personality based on active_personality_id
|
||||
const activePersonality = mountedPersArr[config.active_personality_id];
|
||||
this.activePersonality = mountedPersArr[config.active_personality_id];
|
||||
|
||||
// Check if the active personality has an avatar
|
||||
if (activePersonality.avatar) {
|
||||
this.showBoxWithAvatar(activePersonality.avatar);
|
||||
if (this.activePersonality.avatar) {
|
||||
this.showBoxWithAvatar(this.activePersonality.avatar);
|
||||
} else {
|
||||
this.showDefaultCube();
|
||||
}
|
||||
|
||||
// Update the personality property
|
||||
this.$emit('update:personality', activePersonality);
|
||||
this.$emit('update:personality', this.activePersonality);
|
||||
},
|
||||
loadScene(scenePath) {
|
||||
const loader = new GLTFLoader();
|
||||
@ -136,7 +151,6 @@
|
||||
|
||||
<style>
|
||||
#webglContainer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit da337352ac0d4f77ea3057bf1b086a1288b8ae85
|
||||
Subproject commit 850cd32ad27fbc64ed2a770cda7cc7a2e0f8f87a
|
Loading…
Reference in New Issue
Block a user