主流程

This commit is contained in:
2026-06-10 18:27:08 +08:00
parent b20435c027
commit 6eca9c053b
@@ -37,6 +37,12 @@
placeholder="system prompt(已自动注入需求上下文,可修改)" placeholder="system prompt(已自动注入需求上下文,可修改)"
:autosize="{ minRows: 4, maxRows: 10 }" :autosize="{ minRows: 4, maxRows: 10 }"
/> />
<NInput
v-model:value="newFirstMessage"
type="textarea"
placeholder="首条消息(创建后自动发送;留空则只建会话不发送)"
:autosize="{ minRows: 1, maxRows: 4 }"
/>
<div class="flex justify-end gap-2"> <div class="flex justify-end gap-2">
<NButton <NButton
size="small" size="small"
@@ -137,6 +143,10 @@ const PHASE_TITLE: Record<ArtifactPhase, string> = {
auditing: '评审', auditing: '评审',
} }
// 新建会话默认首条消息:system prompt 仅随请求下发不产生消息,必须有一条
// 用户消息才能触发 AI 开始输出,"创建并开始"靠它兑现。
const DEFAULT_FIRST_MESSAGE = '请开始本阶段工作。'
const props = defineProps<{ const props = defineProps<{
slug: string slug: string
requirement: Requirement requirement: Requirement
@@ -155,6 +165,7 @@ const conversations = ref<Conversation[]>([])
const showCreateForm = ref(false) const showCreateForm = ref(false)
const newModelId = ref<string | undefined>(undefined) const newModelId = ref<string | undefined>(undefined)
const newSystemPrompt = ref('') const newSystemPrompt = ref('')
const newFirstMessage = ref(DEFAULT_FIRST_MESSAGE)
const creating = ref(false) const creating = ref(false)
const draft = ref('') const draft = ref('')
const scrollEl = ref<HTMLElement | null>(null) const scrollEl = ref<HTMLElement | null>(null)
@@ -180,6 +191,7 @@ function openCreateForm() {
props.requirement, props.requirement,
props.prevArtifact, props.prevArtifact,
) )
newFirstMessage.value = DEFAULT_FIRST_MESSAGE
showCreateForm.value = true showCreateForm.value = true
} }
@@ -196,6 +208,8 @@ async function onCreateConversation() {
showCreateForm.value = false showCreateForm.value = false
await loadConversations() await loadConversations()
await session.openConversation(conv.id) await session.openConversation(conv.id)
const first = newFirstMessage.value.trim()
if (first) await session.sendMessage(first)
} finally { } finally {
creating.value = false creating.value = false
} }