You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
695 lines
14 KiB
695 lines
14 KiB
<script setup lang="ts">
|
|
import { useAuthSession } from "~/composables/useAuthSession";
|
|
|
|
definePageMeta({
|
|
layout: "home",
|
|
});
|
|
|
|
const { loggedIn, user } = useAuthSession();
|
|
const { siteName } = useGlobalConfig();
|
|
|
|
interface AgentItem {
|
|
id: number;
|
|
slug: string;
|
|
name: string;
|
|
description: string | null;
|
|
isDefault: number | null;
|
|
isCallable: number | null;
|
|
sortOrder: number | null;
|
|
}
|
|
|
|
const { data: agentsData } = await useFetch<{ code: number; data: { list: AgentItem[] } }>("/api/agents");
|
|
const agents = computed<AgentItem[]>(() => agentsData.value?.data?.list ?? []);
|
|
|
|
const defaultAgent = computed(() => agents.value.find((a) => a.isDefault === 1) ?? agents.value[0] ?? null);
|
|
|
|
function enterChat(slug: string) {
|
|
navigateTo(`/chat/${slug}`);
|
|
}
|
|
|
|
const features = [
|
|
{ icon: "lucide:message-square", title: "多轮对话", desc: "支持上下文记忆的连续对话,随时追问与深入探讨" },
|
|
{ icon: "lucide:wrench", title: "工具调用", desc: "Agent 可调用外部工具,检索文档、执行任务" },
|
|
{ icon: "lucide:history", title: "会话管理", desc: "登录后自动保存对话历史,随时回顾与继续" },
|
|
];
|
|
</script>
|
|
|
|
<template>
|
|
<div class="home-page">
|
|
<section class="hero-band">
|
|
<div class="hero-content">
|
|
<div class="hero-badge">
|
|
<Icon name="lucide:sparkles" />
|
|
<span>AI Agent</span>
|
|
</div>
|
|
<h1 class="hero-title">
|
|
遇见你的<br />
|
|
<span class="hero-accent">思考伙伴</span>
|
|
</h1>
|
|
<p class="hero-subtitle">
|
|
{{ siteName }} 提供智能 Agent 对话服务,无需登录即可体验,登录后可保存对话记录与个性化配置。
|
|
</p>
|
|
<div class="hero-actions">
|
|
<button
|
|
v-if="defaultAgent"
|
|
class="btn-primary"
|
|
@click="enterChat(defaultAgent.slug)"
|
|
>
|
|
<Icon name="lucide:arrow-right" />
|
|
开始对话
|
|
</button>
|
|
<NuxtLink v-if="!loggedIn" to="/auth/login" class="btn-secondary">
|
|
登录账号
|
|
</NuxtLink>
|
|
<NuxtLink v-else to="/agent-documents" class="btn-secondary">
|
|
我的文档
|
|
</NuxtLink>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hero-illustration">
|
|
<div class="mockup-card">
|
|
<div class="mockup-header">
|
|
<span class="mockup-dot" />
|
|
<span class="mockup-dot" />
|
|
<span class="mockup-dot" />
|
|
<span class="mockup-title">agent-chat</span>
|
|
</div>
|
|
<div class="mockup-body">
|
|
<div class="mockup-line user">
|
|
<span class="mockup-role">user</span>
|
|
<span class="mockup-text">帮我分析一下这段代码的性能瓶颈</span>
|
|
</div>
|
|
<div class="mockup-line assistant">
|
|
<span class="mockup-role">assistant</span>
|
|
<span class="mockup-text">好的,我来帮你分析。从代码结构来看,主要瓶颈在循环嵌套层...</span>
|
|
</div>
|
|
<div class="mockup-cursor">
|
|
<span class="cursor-blink" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section v-if="agents.length > 0" class="agents-section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">选择 Agent</h2>
|
|
<p class="section-desc">每个 Agent 拥有不同的能力与工具配置,选择适合你场景的 Agent 开始对话</p>
|
|
</div>
|
|
<div class="agents-grid">
|
|
<button
|
|
v-for="agent in agents"
|
|
:key="agent.id"
|
|
class="agent-card"
|
|
:class="{ 'is-default': agent.isDefault === 1 }"
|
|
@click="enterChat(agent.slug)"
|
|
>
|
|
<div class="agent-card-head">
|
|
<div class="agent-icon">
|
|
<Icon name="lucide:bot" />
|
|
</div>
|
|
<span v-if="agent.isDefault === 1" class="agent-badge">默认</span>
|
|
</div>
|
|
<h3 class="agent-name">{{ agent.name }}</h3>
|
|
<p class="agent-desc">{{ agent.description || "点击进入对话" }}</p>
|
|
<div class="agent-card-foot">
|
|
<span class="agent-enter">进入对话</span>
|
|
<Icon name="lucide:arrow-right" class="agent-arrow" />
|
|
</div>
|
|
</button>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="features-section">
|
|
<div class="section-head">
|
|
<h2 class="section-title">核心能力</h2>
|
|
<p class="section-desc">为每一次对话提供稳定、智能、可扩展的支撑</p>
|
|
</div>
|
|
<div class="features-grid">
|
|
<div v-for="f in features" :key="f.title" class="feature-card">
|
|
<div class="feature-icon">
|
|
<Icon :name="f.icon" />
|
|
</div>
|
|
<h3 class="feature-title">{{ f.title }}</h3>
|
|
<p class="feature-desc">{{ f.desc }}</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="cta-band">
|
|
<div class="cta-content">
|
|
<h2 class="cta-title">准备好开始了吗?</h2>
|
|
<p class="cta-subtitle">
|
|
{{ loggedIn ? `欢迎回来,${user?.username}` : '无需注册,即刻体验智能对话' }}
|
|
</p>
|
|
<button
|
|
v-if="defaultAgent"
|
|
class="btn-primary-on-coral"
|
|
@click="enterChat(defaultAgent.slug)"
|
|
>
|
|
<Icon name="lucide:sparkles" />
|
|
立即对话
|
|
</button>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.home-page {
|
|
flex: 1;
|
|
}
|
|
|
|
/* ── Hero ── */
|
|
|
|
.hero-band {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 48px;
|
|
align-items: center;
|
|
padding: 96px 0;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.hero-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
}
|
|
|
|
.hero-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
align-self: flex-start;
|
|
padding: 4px 12px;
|
|
background: var(--color-surface-card);
|
|
color: var(--color-ink);
|
|
border-radius: 9999px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
letter-spacing: 1.5px;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.hero-badge :deep(svg) {
|
|
font-size: 14px;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.hero-title {
|
|
font-family: var(--font-display);
|
|
font-size: 64px;
|
|
font-weight: 400;
|
|
line-height: 1.05;
|
|
letter-spacing: -1.5px;
|
|
color: var(--color-ink);
|
|
margin: 0;
|
|
}
|
|
|
|
.hero-accent {
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.hero-subtitle {
|
|
font-size: 16px;
|
|
line-height: 1.55;
|
|
color: var(--color-body);
|
|
margin: 0;
|
|
max-width: 480px;
|
|
}
|
|
|
|
.hero-actions {
|
|
display: flex;
|
|
gap: 12px;
|
|
margin-top: 8px;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
/* ── Buttons ── */
|
|
|
|
.btn-primary {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
height: 40px;
|
|
padding: 0 20px;
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-family: var(--font-body);
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: background 0.2s ease;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: var(--color-primary-active);
|
|
}
|
|
|
|
.btn-primary:active {
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
.btn-secondary {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
height: 40px;
|
|
padding: 0 20px;
|
|
background: var(--color-canvas);
|
|
color: var(--color-ink);
|
|
border: 1px solid var(--color-hairline);
|
|
border-radius: 8px;
|
|
font-family: var(--font-body);
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: border-color 0.2s ease;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
border-color: var(--color-primary);
|
|
}
|
|
|
|
/* ── Hero Mockup ── */
|
|
|
|
.hero-illustration {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.mockup-card {
|
|
width: 100%;
|
|
max-width: 480px;
|
|
background: var(--color-surface-dark);
|
|
border-radius: 16px;
|
|
overflow: hidden;
|
|
box-shadow: 0 24px 60px rgba(20, 20, 19, 0.18);
|
|
}
|
|
|
|
.mockup-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 14px 18px;
|
|
background: var(--color-surface-dark-elevated);
|
|
}
|
|
|
|
.mockup-dot {
|
|
width: 10px;
|
|
height: 10px;
|
|
border-radius: 50%;
|
|
background: var(--color-on-dark-soft);
|
|
opacity: 0.4;
|
|
}
|
|
|
|
.mockup-dot:nth-child(1) {
|
|
background: #e05555;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.mockup-dot:nth-child(2) {
|
|
background: #e0a955;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.mockup-dot:nth-child(3) {
|
|
background: #6bb36b;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.mockup-title {
|
|
margin-left: 8px;
|
|
font-family: "JetBrains Mono", ui-monospace, monospace;
|
|
font-size: 12px;
|
|
color: var(--color-on-dark-soft);
|
|
}
|
|
|
|
.mockup-body {
|
|
padding: 24px 20px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 18px;
|
|
min-height: 280px;
|
|
}
|
|
|
|
.mockup-line {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.mockup-role {
|
|
font-family: "JetBrains Mono", ui-monospace, monospace;
|
|
font-size: 11px;
|
|
color: var(--color-on-dark-soft);
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.mockup-text {
|
|
font-size: 14px;
|
|
line-height: 1.6;
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
.mockup-line.user .mockup-text {
|
|
color: var(--color-on-dark-soft);
|
|
}
|
|
|
|
.mockup-cursor {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
}
|
|
|
|
.cursor-blink {
|
|
width: 8px;
|
|
height: 16px;
|
|
background: var(--color-primary);
|
|
animation: blink 1s step-end infinite;
|
|
}
|
|
|
|
@keyframes blink {
|
|
50% {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
/* ── Section common ── */
|
|
|
|
.section-head {
|
|
text-align: center;
|
|
margin-bottom: 48px;
|
|
}
|
|
|
|
.section-title {
|
|
font-family: var(--font-display);
|
|
font-size: 36px;
|
|
font-weight: 400;
|
|
line-height: 1.15;
|
|
letter-spacing: -0.5px;
|
|
color: var(--color-ink);
|
|
margin: 0 0 12px;
|
|
}
|
|
|
|
.section-desc {
|
|
font-size: 16px;
|
|
line-height: 1.55;
|
|
color: var(--color-muted);
|
|
margin: 0;
|
|
max-width: 560px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
/* ── Agents section ── */
|
|
|
|
.agents-section {
|
|
padding: 96px 0;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.agents-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 24px;
|
|
}
|
|
|
|
.agent-card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
padding: 32px;
|
|
background: var(--color-surface-card);
|
|
border: 1px solid transparent;
|
|
border-radius: 12px;
|
|
text-align: left;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.agent-card:hover {
|
|
border-color: var(--color-primary);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.agent-card.is-default {
|
|
background: var(--color-surface-dark);
|
|
}
|
|
|
|
.agent-card.is-default .agent-name,
|
|
.agent-card.is-default .agent-desc,
|
|
.agent-card.is-default .agent-enter {
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
.agent-card.is-default .agent-desc {
|
|
color: var(--color-on-dark-soft);
|
|
}
|
|
|
|
.agent-card-head {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.agent-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 10px;
|
|
background: var(--color-canvas);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 20px;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.agent-card.is-default .agent-icon {
|
|
background: var(--color-surface-dark-elevated);
|
|
}
|
|
|
|
.agent-badge {
|
|
padding: 2px 10px;
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
border-radius: 9999px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
letter-spacing: 1px;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.agent-name {
|
|
font-family: var(--font-body);
|
|
font-size: 18px;
|
|
font-weight: 500;
|
|
color: var(--color-ink);
|
|
margin: 0;
|
|
}
|
|
|
|
.agent-desc {
|
|
font-size: 14px;
|
|
line-height: 1.55;
|
|
color: var(--color-muted);
|
|
margin: 0;
|
|
flex: 1;
|
|
}
|
|
|
|
.agent-card-foot {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.agent-enter {
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.agent-arrow {
|
|
font-size: 16px;
|
|
color: var(--color-primary);
|
|
transition: transform 0.2s ease;
|
|
}
|
|
|
|
.agent-card:hover .agent-arrow {
|
|
transform: translateX(4px);
|
|
}
|
|
|
|
/* ── Features ── */
|
|
|
|
.features-section {
|
|
padding: 96px 0;
|
|
background: var(--color-surface-soft);
|
|
}
|
|
|
|
.features-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 24px;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 0 24px;
|
|
}
|
|
|
|
.feature-card {
|
|
padding: 32px;
|
|
background: var(--color-canvas);
|
|
border: 1px solid var(--color-hairline);
|
|
border-radius: 12px;
|
|
}
|
|
|
|
.feature-icon {
|
|
width: 44px;
|
|
height: 44px;
|
|
border-radius: 10px;
|
|
background: var(--color-surface-card);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 22px;
|
|
color: var(--color-primary);
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.feature-title {
|
|
font-family: var(--font-body);
|
|
font-size: 18px;
|
|
font-weight: 500;
|
|
color: var(--color-ink);
|
|
margin: 0 0 8px;
|
|
}
|
|
|
|
.feature-desc {
|
|
font-size: 14px;
|
|
line-height: 1.55;
|
|
color: var(--color-muted);
|
|
margin: 0;
|
|
}
|
|
|
|
/* ── CTA band ── */
|
|
|
|
.cta-band {
|
|
padding: 96px 24px;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.cta-content {
|
|
background: var(--color-primary);
|
|
border-radius: 12px;
|
|
padding: 64px;
|
|
text-align: center;
|
|
color: var(--color-on-primary);
|
|
}
|
|
|
|
.cta-title {
|
|
font-family: var(--font-display);
|
|
font-size: 28px;
|
|
font-weight: 400;
|
|
letter-spacing: -0.3px;
|
|
margin: 0 0 12px;
|
|
}
|
|
|
|
.cta-subtitle {
|
|
font-size: 16px;
|
|
line-height: 1.55;
|
|
opacity: 0.85;
|
|
margin: 0 0 32px;
|
|
}
|
|
|
|
.btn-primary-on-coral {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
height: 44px;
|
|
padding: 0 28px;
|
|
background: var(--color-canvas);
|
|
color: var(--color-ink);
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-family: var(--font-body);
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: transform 0.15s ease;
|
|
}
|
|
|
|
.btn-primary-on-coral:hover {
|
|
transform: scale(1.02);
|
|
}
|
|
|
|
.btn-primary-on-coral:active {
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
/* ── Responsive ── */
|
|
|
|
@media (max-width: 1024px) {
|
|
.hero-band {
|
|
grid-template-columns: 1fr;
|
|
gap: 40px;
|
|
padding: 64px 24px;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 48px;
|
|
}
|
|
|
|
.agents-grid,
|
|
.features-grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.hero-band {
|
|
padding: 48px 16px;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 36px;
|
|
}
|
|
|
|
.hero-subtitle {
|
|
font-size: 15px;
|
|
}
|
|
|
|
.agents-section,
|
|
.features-section {
|
|
padding: 64px 16px;
|
|
}
|
|
|
|
.agents-grid,
|
|
.features-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 28px;
|
|
}
|
|
|
|
.cta-content {
|
|
padding: 40px 24px;
|
|
}
|
|
|
|
.cta-title {
|
|
font-size: 22px;
|
|
}
|
|
|
|
.features-grid {
|
|
padding: 0 16px;
|
|
}
|
|
}
|
|
</style>
|
|
|