mirror of
https://github.com/vegu-ai/talemate.git
synced 2025-12-16 03:37:51 +01:00
Add writing style template selection to CharacterCardImport component and update scene loading logic to apply selected template
This commit is contained in:
@@ -137,6 +137,9 @@ class CharacterCardImportOptions(pydantic.BaseModel):
|
|||||||
player_character_existing: str | None = None # detected character name
|
player_character_existing: str | None = None # detected character name
|
||||||
player_character_import: PlayerCharacterImport | None = None
|
player_character_import: PlayerCharacterImport | None = None
|
||||||
|
|
||||||
|
# Scene settings
|
||||||
|
writing_style_template: str | None = None # Format: "group__template_uid"
|
||||||
|
|
||||||
# Internal: track pending asset transfers (deferred until scene name is set)
|
# Internal: track pending asset transfers (deferred until scene name is set)
|
||||||
_pending_asset_transfers: list[AssetTransfer] = pydantic.PrivateAttr(
|
_pending_asset_transfers: list[AssetTransfer] = pydantic.PrivateAttr(
|
||||||
default_factory=list
|
default_factory=list
|
||||||
@@ -1098,6 +1101,10 @@ async def load_scene_from_character_card(
|
|||||||
# Set scene name: use spec's name field if available, otherwise use first character name
|
# Set scene name: use spec's name field if available, otherwise use first character name
|
||||||
scene.name = scene_name if scene_name else first_character.name
|
scene.name = scene_name if scene_name else first_character.name
|
||||||
|
|
||||||
|
# Set writing style template if provided
|
||||||
|
if import_options.writing_style_template:
|
||||||
|
scene.writing_style_template = import_options.writing_style_template
|
||||||
|
|
||||||
# Initialize memory and load character book entries (only once, for first character)
|
# Initialize memory and load character book entries (only once, for first character)
|
||||||
await _initialize_scene_memory(
|
await _initialize_scene_memory(
|
||||||
scene,
|
scene,
|
||||||
|
|||||||
@@ -90,6 +90,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
<v-card elevation="0" class="mt-3">
|
||||||
|
<v-card-text>
|
||||||
|
<v-select
|
||||||
|
v-model="options.writing_style_template"
|
||||||
|
:items="writingStyleItems"
|
||||||
|
label="Writing Style"
|
||||||
|
hint="Optional: Select a writing style template to apply to the scene."
|
||||||
|
persistent-hint
|
||||||
|
clearable
|
||||||
|
density="compact"
|
||||||
|
variant="outlined"
|
||||||
|
></v-select>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" md="4">
|
<v-col cols="12" md="4">
|
||||||
<v-card elevation="0">
|
<v-card elevation="0">
|
||||||
@@ -327,6 +341,9 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'CharacterCardImport',
|
name: 'CharacterCardImport',
|
||||||
|
props: {
|
||||||
|
templates: Object,
|
||||||
|
},
|
||||||
inject: ['getWebsocket', 'registerMessageHandler', 'appConfig'],
|
inject: ['getWebsocket', 'registerMessageHandler', 'appConfig'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -345,6 +362,7 @@ export default {
|
|||||||
generate_episode_titles: true,
|
generate_episode_titles: true,
|
||||||
setup_shared_context: false,
|
setup_shared_context: false,
|
||||||
selected_character_names: [],
|
selected_character_names: [],
|
||||||
|
writing_style_template: null,
|
||||||
},
|
},
|
||||||
resolveCallback: null,
|
resolveCallback: null,
|
||||||
fileData: null,
|
fileData: null,
|
||||||
@@ -400,6 +418,7 @@ export default {
|
|||||||
generate_episode_titles: true,
|
generate_episode_titles: true,
|
||||||
setup_shared_context: false,
|
setup_shared_context: false,
|
||||||
selected_character_names: [],
|
selected_character_names: [],
|
||||||
|
writing_style_template: null,
|
||||||
};
|
};
|
||||||
this.analysis = null;
|
this.analysis = null;
|
||||||
this.analysisError = null;
|
this.analysisError = null;
|
||||||
@@ -610,6 +629,17 @@ export default {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
writingStyleItems() {
|
||||||
|
if (!this.templates || !this.templates.by_type || !this.templates.by_type.writing_style) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const items = Object.values(this.templates.by_type.writing_style).map(t => ({
|
||||||
|
value: `${t.group}__${t.uid}`,
|
||||||
|
title: t.name,
|
||||||
|
props: { subtitle: t.description }
|
||||||
|
}));
|
||||||
|
return items;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.registerMessageHandler(this.handleMessage);
|
this.registerMessageHandler(this.handleMessage);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
<CharacterCardImport ref="characterCardImportModal"></CharacterCardImport>
|
<CharacterCardImport ref="characterCardImportModal" :templates="worldStateTemplates"></CharacterCardImport>
|
||||||
</v-list>
|
</v-list>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -63,7 +63,8 @@ export default {
|
|||||||
CharacterCardImport,
|
CharacterCardImport,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
sceneLoadingAvailable: Boolean
|
sceneLoadingAvailable: Boolean,
|
||||||
|
worldStateTemplates: Object,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cols () {
|
cols () {
|
||||||
|
|||||||
@@ -121,6 +121,7 @@
|
|||||||
<LoadScene
|
<LoadScene
|
||||||
ref="loadScene"
|
ref="loadScene"
|
||||||
:scene-loading-available="ready && connected"
|
:scene-loading-available="ready && connected"
|
||||||
|
:world-state-templates="worldStateTemplates"
|
||||||
@loading="sceneStartedLoading" />
|
@loading="sceneStartedLoading" />
|
||||||
</v-tabs-window-item>
|
</v-tabs-window-item>
|
||||||
<v-tabs-window-item :transition="false" :reverse-transition="false" value="main">
|
<v-tabs-window-item :transition="false" :reverse-transition="false" value="main">
|
||||||
|
|||||||
Reference in New Issue
Block a user