Skip to content

🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"

TypeScript

fix: wire Agent drawer type selection from workbench buttons

Connor99d1b2cf4a09
diff --git a/web/src/components/agent/AgentDrawer.vue b/web/src/components/agent/AgentDrawer.vue
index 15b562c..05a3c35 100644
--- a/web/src/components/agent/AgentDrawer.vue
+++ b/web/src/components/agent/AgentDrawer.vue
@@ -20,7 +20,7 @@
</template>
<script setup lang="ts">
-import { toRef } from 'vue'
+import { toRef, watch } from 'vue'
import {
Sheet,
SheetContent,
@@ -36,6 +36,7 @@ const props = defineProps<{
open: boolean
dramaId: number
episodeId: number
+ initialAgentType?: AgentType
}>()
defineEmits<{
@@ -44,6 +45,11 @@ defineEmits<{
}>()
const { agentType, messages, streaming, currentStreamContent, sendMessage, clearMessages } = useAgentChat(props.dramaId, toRef(props, 'episodeId'))
+
+// Watch for external agent type changes
+watch(() => props.initialAgentType, (newType) => {
+ if (newType) agentType.value = newType
+})
</script>
<style scoped>
diff --git a/web/src/views/drama/episode/EpisodeWorkbench.vue b/web/src/views/drama/episode/EpisodeWorkbench.vue
index 43ffcfe..93506cd 100644
--- a/web/src/views/drama/episode/EpisodeWorkbench.vue
+++ b/web/src/views/drama/episode/EpisodeWorkbench.vue
@@ -113,6 +113,7 @@
v-model:open="agentOpen"
:drama-id="dramaId"
:episode-id="episodeNumber"
+ :initial-agent-type="agentInitType"
@apply="handleAgentApply"
/>
</div>
@@ -143,6 +144,7 @@ const imageGen = reactive(wb.imageGen)
const videoGen = reactive(wb.videoGen)
const agentOpen = ref(false)
+const agentInitType = ref<AgentType | undefined>(undefined)
const progressPct = computed(() => {
const p = table.progress
@@ -154,9 +156,8 @@ const goToCompose = () => router.push(`/drama/${dramaId}/episode/${episodeNumber
// --- Agent triggers: open drawer with pre-selected agent type ---
function openAgent(type: AgentType) {
+ agentInitType.value = type
agentOpen.value = true
- // AgentDrawer's useAgentChat exposes agentType — we set it via the drawer
- // For now we open drawer and let user interact. TODO: auto-send message
}
// --- Script Tab handlers ---