talemate/talemate_frontend/src/components/IntroRecentScenes.vue
veguAI 2f07248211
Prep 0.20.0 (#77)
* fix issue where recent save cover images would sometimes not load

* paraphrase prompt tweaks

* action_to_narration regenerate compatibility fixes

* sim suite add asnwer question instruction

* more sim suite tweaks

* refactor agent details display in agent bar

* visual agent progres (a1111 support)

* visual gen prompt tweaks

* openai compat client pass max_tokens

* world state sequential reinforcement max tokens tightened

* improve item names

* Improve item names

* attempt to remove "changed from.." notes when altering an existing character sheet

* prompt improvements for single character portraits

* visual agent progress

* fix issue where character.update wouldn't update long-term memory

* remove experimental flag for now

* add better instructions for updating existing character sheet

* background processing for agents, visual and tts

* fix selected voice not saving between restarts for elevenlabs

* lessen timeout

* clean up agent status logic

* conditional agent configs

* comfyui support

* visualization queue

* refactor visual styles, comfyui progress

* regen images
auto cover image assign
websocket handler plugin abstraction
agent websocket handler

* automatic1111 fixes
agent status and ready checks

* tweaks to character portrait prompt

* system prompt for visualize

* textgenwebui use temp smoothing on yi models

* comment out api key for now

* fixes issues with openai compat client for retaining api key and auto fixing urls

* update_reinforcment tweaks

* agent status emit from one place

* emit agent status as asyncio task

* remove debug output

* tts add openai support

* openai img gen support

* fix issue with confyui checkbox list not loading

* tts model selection for openai

* narrate_query include character sheet if character is referenced in query
improve visual character portrit generation prompt

* client implementation extra field support and runpod vllm client example

* relock

* fix issue where changing context length would cause next generation to error

* visual agent tweaks and auto gen character cover image in sim suite

* fix issue with readyness lock when there werent any clients defined

* load scene readiness fixes

* linting

* docs

* notes for the runpod vllm example
2024-02-16 13:57:45 +02:00

171 lines
No EOL
5.1 KiB
Vue

<template>
<v-card flat variant="text" v-if="hasRecentScenes()">
<v-card-title>
Quick load
</v-card-title>
<!--
horizontal scroll from config.recent_scenes.scenes
if sceneLoadingAvailable, clicking the scene should load it
scene object has the following properties:
- name
- path (path to load)
- filename (filename to display, sans extension)
- cover_image (cover image to request - asset id)
- date (date to display, iso format)
-->
<v-card-text v-if="config != null">
<div class="tiles">
<div class="tile" v-for="(scene, index) in recentScenes()" :key="index">
<v-card density="compact" elevation="7" @click="loadScene(scene)" color="primary" variant="outlined">
<v-card-title>
{{ scene.name }}
</v-card-title>
<v-card-subtitle>
{{ scene.filename }}
</v-card-subtitle>
<v-card-text>
<div class="cover-image-placeholder">
<v-img cover v-if="scene.cover_image != null && coverImages[scene.cover_image.id] != null" :src="getCoverImageSrc(scene.cover_image.id)"></v-img>
</div>
<p class="text-caption text-center text-grey-lighten-1">{{ prettyDate(scene.date) }}</p>
</v-card-text>
</v-card>
</div>
</div>
</v-card-text>
</v-card>
</template>
<script>
export default {
name: 'IntroRecentScenes',
props: {
sceneLoadingAvailable: Boolean,
config: Object,
},
inject: ['requestAssets', 'getWebsocket', 'registerMessageHandler'],
data() {
return {
coverImages: {},
}
},
emits: ['request-scene-load'],
watch: {
config(newVal) {
if(newVal != null) {
this.requestCoverImages();
}
},
},
methods: {
hasRecentScenes() {
return this.config != null && this.config.recent_scenes != null && this.config.recent_scenes.scenes != null && this.config.recent_scenes.scenes.length > 0;
},
prettyDate(date) {
// 2024-01-20T03:35:00.109492
let d = new Date(date);
return d.toLocaleString();
},
requestCoverImages() {
if(this.config.recent_scenes != null) {
if(this.config.recent_scenes.scenes != null) {
let coverImageIds = [];
for(let scene of this.config.recent_scenes.scenes) {
if(scene.cover_image != null) {
coverImageIds.push({
"path": scene.path,
"id": scene.cover_image.id,
"media_type": scene.cover_image.media_type,
"file_type": scene.cover_image.file_type,
});
}
}
this.requestAssets(coverImageIds);
}
}
},
loadScene(scene) {
this.$emit("request-scene-load", scene.path)
},
recentScenes() {
if(!this.config.recent_scenes) {
return [];
}
return this.config.recent_scenes.scenes;
},
getCachedCoverImage(assetId) {
if(this.coverImages[assetId]) {
return this.coverImages[assetId];
} else {
return null;
}
},
getCoverImageSrc(assetId) {
if(this.coverImages[assetId]) {
return 'data:'+this.coverImages[assetId].mediaType+';base64, '+this.coverImages[assetId].base64;
} else {
return null;
}
},
handleMessage(data) {
if(data.type === 'assets') {
for(let id in data.assets) {
let asset = data.assets[id];
this.coverImages[id] = {
base64: asset.base64,
mediaType: asset.mediaType,
};
}
}
},
},
mounted() {
this.requestCoverImages();
},
created() {
this.registerMessageHandler(this.handleMessage);
},
}
</script>
<style scoped>
.cover-image-placeholder {
position: relative;
height: 275px;
width: 100%;
background-color: transparent;
background-image: url('/src/assets/logo-13.1-backdrop.png');
background-repeat: no-repeat;
background-position: center;
background-size: cover;
overflow: hidden;
}
/* flud flex tiles with fixed width */
.tiles {
display: flex;
flex-wrap: wrap;
justify-content: left;
overflow: hidden;
}
.tile {
flex: 0 0 275px;
margin: 10px;
max-width: 275px;
}
</style>