Web优化 2

This commit is contained in:
2026-06-12 14:36:41 +08:00
parent 7e9df04bf8
commit 61a1a4d368
31 changed files with 551 additions and 918 deletions
@@ -15,21 +15,11 @@
:disabled="creating"
@update:value="onSelectConversation"
/>
<NButton
size="small"
type="primary"
secondary
@click="openCreateForm"
>
新建会话
</NButton>
<NButton size="small" type="primary" secondary @click="openCreateForm"> 新建会话 </NButton>
</div>
<!-- 新建会话表单 -->
<div
v-if="showCreateForm"
class="space-y-2 mb-3 border rounded p-3"
>
<div v-if="showCreateForm" class="space-y-2 mb-3 border rounded p-3">
<ModelSelector v-model:model-value="newModelId" />
<NInput
v-model:value="newSystemPrompt"
@@ -44,12 +34,7 @@
:autosize="{ minRows: 1, maxRows: 4 }"
/>
<div class="flex justify-end gap-2">
<NButton
size="small"
@click="showCreateForm = false"
>
取消
</NButton>
<NButton size="small" @click="showCreateForm = false"> 取消 </NButton>
<NButton
size="small"
type="primary"
@@ -80,18 +65,12 @@
@answer-question="onAnswerQuestion"
/>
</div>
<div
v-else
class="flex-1 flex items-center justify-center text-neutral-400 text-sm"
>
<div v-else class="flex-1 flex items-center justify-center text-neutral-400 text-sm">
选择历史会话或新建会话开始与 AI 讨论本阶段内容
</div>
<!-- 输入区 -->
<div
v-if="session.currentConversation.value"
class="border-t pt-3 flex gap-2"
>
<div v-if="session.currentConversation.value" class="border-t pt-3 flex gap-2">
<NInput
v-model:value="draft"
type="textarea"
@@ -108,13 +87,7 @@
>
发送
</NButton>
<NButton
v-else
type="warning"
@click="session.cancelMessage"
>
中断
</NButton>
<NButton v-else type="warning" @click="session.cancelMessage"> 中断 </NButton>
</div>
<SaveArtifactModal
@@ -134,6 +107,7 @@ import { NButton, NCard, NInput, NSelect } from 'naive-ui'
import { chatApi, type ChatMessage, type Conversation } from '@/api/chat'
import type { Artifact, ArtifactPhase, Requirement } from '@/api/projects'
import { formatDateTime } from '@/utils/date'
import { useConversationSession } from '@/composables/useConversationSession'
import { buildRequirementSystemPrompt } from '@/constants/requirementPhasePrompts'
import {
@@ -181,7 +155,7 @@ const saveSource = ref<ChatMessage | null>(null)
const conversationOptions = computed(() =>
conversations.value.map((c) => ({
label: `${c.title || '(未命名)'} · ${new Date(c.updated_at).toLocaleString('zh-CN', { hour12: false })}`,
label: `${c.title || '(未命名)'} · ${formatDateTime(c.updated_at)}`,
value: c.id,
})),
)