Files
ai-novel-studio/app/components/RunControls.vue
T
jocay 3c9b65d982 AI 小说工坊:主编 + 作家多模型协作写作应用
- Nuxt 4 + Nuxt UI 4 + AI SDK 7 + Drizzle/SQLite
- 主编规划大纲与章节简报、选派作家;作家流式写入章节文件并实时推送前端
- 逐章确认模式(默认)与自动模式;摘要与故事记忆
- 酒馆角色卡(PNG/JSON,V1-V3)与世界书导入
- 自定义最高优先级系统提示词、审稿/修改/多版本、任务日志与提示词检视
- 模拟 LLM 服务与端到端测试脚本

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:04:40 +08:00

51 lines
1.9 KiB
Vue

<script setup lang="ts">
/** 流水线控制:继续写作 / 停止 / 模式切换 */
const store = useProjectStore()
const { project, running, runningLabel, connected } = store
const settings = computed(() => project.value!.settings)
const pendingChapter = computed(() => store.chapters.value.find(c => c.status === 'written'))
async function toggleAuto(v: boolean) {
await store.saveProject({ settings: { ...settings.value, autoMode: v } })
}
const starting = ref(false)
async function run() {
starting.value = true
try { await store.run() }
finally { starting.value = false }
}
</script>
<template>
<div class="flex items-center gap-2">
<UTooltip :text="connected ? '实时连接正常' : '实时连接断开,正在重连…'">
<span class="size-2 rounded-full" :class="connected ? 'bg-success' : 'bg-error animate-pulse'" />
</UTooltip>
<USwitch
:model-value="settings.autoMode"
label="自动模式"
:disabled="running"
size="sm"
@update:model-value="toggleAuto"
/>
<template v-if="running">
<UBadge color="warning" variant="subtle" icon="i-lucide-loader-circle" :ui="{ leadingIcon: 'animate-spin' }" class="max-w-64 truncate">
{{ runningLabel || '运行中' }}
</UBadge>
<UButton icon="i-lucide-square" label="停止" color="error" variant="soft" size="sm" @click="store.stop()" />
</template>
<UTooltip v-else :text="pendingChapter ? `第${pendingChapter.index}章待确认,请先在章节中确认` : (settings.autoMode ? `自动连续写作,最多 ${settings.autoChapterLimit} 章` : '主编规划/写简报 → 作家写下一章,写完后暂停等你确认')">
<UButton
icon="i-lucide-play"
:label="settings.autoMode ? '开始自动写作' : '继续下一章'"
size="sm"
:loading="starting"
:disabled="!!pendingChapter && !settings.autoMode"
@click="run"
/>
</UTooltip>
</div>
</template>