allow updationg of scene phase through director console

This commit is contained in:
vegu-ai-tools 2025-05-08 01:04:23 +03:00
parent 7501894399
commit f5fc58e971
3 changed files with 86 additions and 19 deletions

View file

@ -2,16 +2,24 @@
<!-- current phase --> <!-- current phase -->
<v-list-subheader> <v-list-subheader>
Current Phase <v-chip v-if="intent.name" size="x-small" label color="primary" class="ml-2">{{ intent.name }}</v-chip> Current Phase
</v-list-subheader> </v-list-subheader>
<v-card> <v-card>
<v-card-text> <v-card-text>
<div v-if="intent.name"> <v-select :items="sceneTypes" v-model="intent.phase.scene_type" label="Scene Type" class="text-caption" density="compact" @update:model-value="updateSceneIntent()"></v-select>
<p class="text-muted text-caption">{{ intent.intent }}</p> <v-textarea
</div> density="compact"
<div v-else class="text-muted text-caption"> v-model="intent.phase.intent"
No scene phase set class="text-caption"
</div> hide-details
rows="4"
max-rows="15"
auto-grow
:color="dirty['intent.phase.intent'] ? 'dirty' : ''"
@update:model-value="dirty['intent.phase.intent'] = true"
@blur="updateSceneIntent()"
></v-textarea>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn @click="openWorldStateManager('scene','director')" color="primary">Manage</v-btn> <v-btn @click="openWorldStateManager('scene','director')" color="primary">Manage</v-btn>
@ -48,6 +56,10 @@ export default {
}, },
props: { props: {
scene: Object, scene: Object,
open: {
type: Boolean,
default: false,
}
}, },
inject: [ inject: [
'openWorldStateManager', 'openWorldStateManager',
@ -55,28 +67,72 @@ export default {
'registerMessageHandler', 'registerMessageHandler',
'unregisterMessageHandler', 'unregisterMessageHandler',
], ],
computed: { watch: {
intent() { open(newVal) {
if(!this.scene || !this.scene.data || !this.scene.data.intent) { if(newVal) {
return { this.getSceneIntent();
name: null,
intent: null,
}
} }
return this.scene.data.intent; },
},
computed: {
sceneTypes() {
if(!this.intent || !this.intent.scene_types) {
return [];
}
const types = [];
for(const key in this.intent.scene_types) {
types.push({
value: this.intent.scene_types[key].id,
title: this.intent.scene_types[key].name,
});
}
return types;
} }
}, },
data() { data() {
return { return {
messages: [], messages: [],
max_messages: 20, max_messages: 20,
dirty: {},
intent: {
intent: null,
phase: {
intent: null,
scene_type: null,
},
scene_types: {},
start: 0,
},
} }
}, },
methods: { methods: {
clearMessages() { clearMessages() {
this.messages = []; this.messages = [];
}, },
updateSceneIntent() {
if(!this.intent || !this.intent.intent) {
return;
}
this.getWebsocket().send(JSON.stringify({
type: 'world_state_manager',
action: 'set_scene_intent',
...this.intent,
}));
},
getSceneIntent() {
this.getWebsocket().send(JSON.stringify({
type: 'world_state_manager',
action: 'get_scene_intent',
}));
},
handleMessage(message) { handleMessage(message) {
if (message.action === 'get_scene_intent') {
this.intent = message.data;
}
if(message.type != "director") { if(message.type != "director") {
return; return;
} }
@ -86,7 +142,7 @@ export default {
return; return;
} }
this.messages.push(message); this.messages.unshift(message);
// Keep messages within the max limit // Keep messages within the max limit
while(this.messages.length > this.max_messages) { while(this.messages.length > this.max_messages) {

View file

@ -129,10 +129,10 @@
</v-navigation-drawer> </v-navigation-drawer>
<!-- director console navigation drawer --> <!-- director console navigation drawer -->
<v-navigation-drawer v-model="directorConsoleDrawer" app location="right" width="400" disable-resize-watcher> <v-navigation-drawer v-model="directorConsoleDrawer" app location="right" :width="directorConsoleWidth" disable-resize-watcher>
<v-list> <v-list>
<v-list-subheader class="text-uppercase"><v-icon>mdi-bullhorn</v-icon> Director Console</v-list-subheader> <v-list-subheader class="text-uppercase"><v-icon>mdi-bullhorn</v-icon> Director Console</v-list-subheader>
<DirectorConsole :scene="scene" v-if="sceneActive" /> <DirectorConsole :scene="scene" v-if="sceneActive" :open="directorConsoleDrawer" />
</v-list> </v-list>
</v-navigation-drawer> </v-navigation-drawer>
@ -496,6 +496,17 @@ export default {
return false; return false;
},
directorConsoleWidth() {
// based on the screen width, set the width of the director console
const screenWidth = window.innerWidth;
if(screenWidth <= 1920) {
return 400;
} else if(screenWidth <= 2560) {
return 600;
} else {
return 800;
}
} }
}, },
mounted() { mounted() {

View file

@ -1,6 +1,6 @@
<template> <template>
<v-row> <v-row>
<v-col cols="12" ms="12" xl="8" xxl="5"> <v-col cols="12" ms="12" xl="8" xxl="6">
<v-form class="mt-4"> <v-form class="mt-4">
<v-row> <v-row>
<v-col cols="12" md="8" lg="6" xl="6"> <v-col cols="12" md="8" lg="6" xl="6">