Add dialogue ratio configuration to chat generation

- Introduced `dialogue_ratio` field in `ChatCreateGenerateArcPayload` to allow customizable dialogue percentage.
- Updated `SceneToolsDirector.vue` to include a new slider for setting the dialogue ratio.
- Adjusted the `openScenePlanDialog` method to initialize the dialogue ratio based on the current configuration.
- Ensured the dialogue ratio is passed correctly when creating a new chat arc.
This commit is contained in:
vegu-ai-tools
2026-03-29 14:25:20 +03:00
parent 46350c0095
commit 24b40019c5
2 changed files with 20 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ class ChatRemoveMessagePayload(pydantic.BaseModel):
class ChatCreateGenerateArcPayload(pydantic.BaseModel):
instructions: str
beat_count: int = 8
dialogue_ratio: float | None = None
class ChatRegeneratePayload(pydantic.BaseModel):
@@ -446,6 +447,9 @@ class DirectorChatWebsocketMixin:
async def handle_chat_create_generate_arc(self, data: dict):
payload = ChatCreateGenerateArcPayload(**data)
if payload.dialogue_ratio is not None:
self.director.actions["chat"].config["generate_arc_dialogue_ratio"].value = payload.dialogue_ratio
chat = self.director.chat_create_generate_arc(
payload.instructions,
payload.beat_count,

View File

@@ -62,10 +62,22 @@
:min="3"
:max="24"
:step="1"
thumb-label
thumb-label="always"
color="primary"
class="mt-4"
></v-slider>
<v-slider
v-model="scenePlanDialogueRatio"
label="Dialogue ratio"
:min="0"
:max="100"
:step="10"
thumb-label="always"
color="primary"
class="mt-4"
>
<template v-slot:thumb-label="{ modelValue }">{{ modelValue }}%</template>
</v-slider>
<!-- Warning: narrator progress_story generation length too low -->
<v-alert
@@ -130,6 +142,7 @@ export default {
scenePlanDialog: false,
scenePlanInstructions: '',
scenePlanBeats: 8,
scenePlanDialogueRatio: 40,
minRecommendedNarratorLength: 1024,
}
},
@@ -213,6 +226,7 @@ export default {
openScenePlanDialog() {
this.scenePlanInstructions = '';
this.scenePlanBeats = 8;
this.scenePlanDialogueRatio = Math.round((this.agentStatus?.director?.actions?.chat?.config?.generate_arc_dialogue_ratio?.value ?? 0.4) * 100);
this.scenePlanDialog = true;
},
@@ -223,6 +237,7 @@ export default {
action: 'chat_create_generate_arc',
instructions: this.scenePlanInstructions,
beat_count: this.scenePlanBeats,
dialogue_ratio: this.scenePlanDialogueRatio / 100,
}));
this.openDirectorConsole();
},