iT邦幫忙

2026 iThome 鐵人賽

DAY 13
0
Build on Google AI

用 Google AI 生態系 30 天從零打造一個全棧 AI SaaS 服務系列 第 13 篇

Day 13 -【Google Stitch】AI 介面生成實戰:用自然語言疾速打造 OmniVibe AI 現代化 Dashboard 前端原型

  • 分享至 

  • xImage
  •  

在剛結束的第二篇章(Day 06 - Day 12)中,我們完成了 OmniVibe AI 後端大腦的全面武裝:從 Gemini 1.5 的長文本消化、原生影音辨識、JSON Schema 結構化輸出、Agent 工具調用到上下文快取降本。

現在,我們正式邁入**【第三篇:介面疾速生成與全棧基礎建設(Day 13 - Day 19)】**!

在傳統開發流程中,寫完後端 API 後,工程師往往會卡在另一個巨大瓶頸 —— 前端刻畫面。
為了做出一個像樣的 SaaS 控制台,你必須手寫大量 Flexbox / Grid 佈局、微調 Tailwind 類別、拼湊表單元件、調整響應式斷點。這段「像素推擠(Pixel Pushing)」的過程往往消耗數天甚至數週的時間,完全違背了 Vibe Coding(氛圍編程) 極速驗證、人機協作的核心精神。

在 Vibe Coding 的時代,我們不再需要從空白的 page.tsx 開始手刻按鈕與側邊欄。
今天,我們將引進 Google 生態系中專注於介面生成的利器 —— Google Stitch,示範如何透過高密度的自然語言描述,在數分鐘內直接催生出一款具備高顏值、現代感且符合 SaaS 生產力質感的 Dashboard 前端原型!


🎨 什麼是 Google Stitch?Vibe Coding 介面生成新範式

Google Stitch 是一個專為現代開發者與產品設計師打造的 AI 介面生成與原型工作流工具。它將大語言模型的代碼理解力與設計系統(Design Systems)進行了深度融合。

以往使用純文字叫一般 LLM 刻介面,常見問題包括:

  1. 風格拼裝感嚴重:缺乏統一的 Design Tokens,顏色對比突兀,排版缺乏層次。
  2. 缺乏組件思維:產出的代碼往往是一大坨難以維護的單一 HTML/JSX,沒有妥善拆分出 Sidebar、Dropzone、Tab、Card 等可複用元件。
  3. 無響應式與狀態考慮:忽略了行動端折疊、Loading Skeleton 骨架屏以及 Empty State(空狀態)。
graph LR
    subgraph 傳統前端開發
        A[手繪 Wireframe] --> B[Figma 繪製 UI]
        B --> C[人工切版 HTML/CSS]
        C --> D[逐行套入 React]
    end

    subgraph Stitch Vibe Coding 工作流
        E[PRD 核心規格] --> F[Stitch 自然語言 Prompt]
        F --> G[生成高保真互動 UI 原型]
        G --> H[一鍵導出 Tailwind/React 元件]
    end

透過 Stitch,我們只需要將 Day 02 梳理出的 PRD 核心流程轉譯為「設計語意 Prompt」,AI 就能直接渲染出具備現代深色模式(Dark Mode)、玻璃擬態(Glassmorphism)與微互動細節的完整儀表板。


📐 OmniVibe AI 儀表板設計規格拆解

在向 Stitch 下達 Prompt 前,我們先把 OmniVibe AI 的儀表板版面配置(Layout)在腦海中解構為四大區塊:

介面區塊 核心功能 視覺與互動要求
頂部導航 (Top Navbar) 專案名稱、搜尋欄、用戶頭像、Token 額度即時徽章(Pro Badge) 半透明毛玻璃背景、固定置頂、吸睛的用量計量條
左側功能導航 (Sidebar) 切換「新專案」、「多模態資產庫」、「歷程紀錄」、「訂閱設定」 可折疊收合設計、活動分頁高亮指示、底層展示登出按鈕
中央核心工作區 (Workspace) 1. 拖曳上傳區(支援 MP4 / MP3 / PDF)

2. 風格範本選擇器(Threads / 腳本 / 摘要) | 支援點擊與 Drag-and-Drop、視覺化上傳進度條、範本卡片選取反饋 |
| 右側成果展示面板 (Inspector Panel) | 1. Tab 切換(核心洞見 / 爆款貼文 / 短影音腳本)

2. 一鍵複製與 Markdown 匯出按鈕 | 階層清晰的卡片式設計、內文支援 Syntax 高亮、極致排版細節 |


💬 實戰:向 Google Stitch 下達高保真生成 Prompt

為了產出符合現代頂級 SaaS(如 Linear, Raycast, Vercel)質感的 UI,Prompt 必須包含:色彩主題(Color Palette)、字型排版(Typography)、元件階層與互動狀態。

以下是我們在 Google Stitch 中輸入的正式 Prompt:

Create a modern, high-production-value SaaS Dashboard interface for "OmniVibe AI" — a multimodal AI content distillation platform.

1. Visual Style & Theme:
- Dark mode first aesthetic: Deep slate background (#090D16, #0F172A), border lines (#1E293B), with subtle glowing accents using Google AI Indigo and Violet (#6366F1, #8B5CF6).
- Typography: Inter or Geist Sans, crisp contrast, proper visual hierarchy using muted grays for secondary labels.
- Subtle glassmorphism on floating panels (backdrop-blur-md, bg-white/5).

2. Layout Structure:
- Desktop Layout: 3-column architecture (Collapsible Left Sidebar, Central Ingestion Workspace, Right Output Preview Panel).
- Left Sidebar:
  * Brand Logo: "OmniVibe AI" with an electric violet spark icon.
  * Nav items: "Distill Studio" (Active), "Asset Library", "History", "API & Webhooks", "Billing".
  * Bottom widget: User profile card with avatar and dynamic "Tokens Remaining: 85,000 / 100,000" visual progress bar.

- Central Workspace (Content Ingestion):
  * Header: "Create New Distillation", subtitle "Drop any long video, podcast audio, or whitepaper PDF."
  * Drag-and-Drop Zone: Large, dashed border area with hover state. Displays icons for MP4, MP3, PDF with a clear "Browse files" button and a max 100MB badge.
  * Template Selector: 3 selectable pill cards below the dropzone:
    [1. Viral Threads/X Thread] [2. 60s Reel Script] [3. Executive Memo]
  * Primary Action: Big gradient button "Start AI Distillation (⌘ + Enter)" with a subtle glowing hover effect.

- Right Panel (Live Result & Output):
  * Top Tabs: [Key Takeaways] [Social Posts] [Short Clips] [Raw JSON]
  * Content Card: Clean markdown layout rendering extracted insights, bold punchlines, and clip timestamps ().
  * Action Bar: Quick action buttons: "Copy to Clipboard", "Export Markdown", "Regenerate".

3. Component Design:
- Use modern Tailwind CSS classes and clean accessible semantic elements.
- Ensure state indicators: active border highlights, loading spinners, and tooltip triggers.


⚡ Stitch 生成結果深度檢視

在 Stitch 執行生成後,畫面即刻渲染出令人驚豔的現代化儀表板原型:

+----------------------------------------------------------------------------------------------------+
|  OmniVibe AI   [Search projects...        ]                        [⚡ Pro: 85k Tokens]  [Avatar]  |
+--------------+------------------------------------------------------+------------------------------+
| 🚀 Studio    |  Create New Distillation                             |  Results: AI Trends 2026.pdf |
| 📁 Library   |  Drop your long-form media to extract golden nuggets |  [Takeaways] [Posts] [Clips] |
| 🕒 History   |  +------------------------------------------------+  | ---------------------------- |
| ⚙️ Settings  |  |           [ Upload Icon (Cloud) ]              |  | 💡 Core Takeaways:           |
|              |  |   Drag & drop MP4, MP3 or PDF files here       |  | 1. Long context models are   |
|              |  |   or [ Browse Files ] (Max 100MB)              |  |    replacing traditional RAG |
|              |  +------------------------------------------------+  | 2. Audio & Video direct ingestion|
|              |  Select Output Persona:                              | 3. Context caching saves 75% |
|              |  [ ✨ Threads Viral ] [ 🎬 Reels Script ] [ 📑 Memo] | ---------------------------- |
| [ Clay Lin ] |                                                      | [ 📋 Copy ]   [ ⬇️ Export ]  |
| [ 85% Left ] |  [⚡ Start AI Distillation                    ]      | [ 🔄 Re-run with Cache     ] |
+--------------+------------------------------------------------------+------------------------------+

關鍵設計亮點分析:

  1. 資訊密度恰到好處:中心工作區維持專注的輸入管線,右側直接承接輸出成果,使用者無需在頁面間反覆跳轉。
  2. 微狀態(Micro-states)就位:包括拖曳上傳時的邊框高亮(Dashed Accent Border)、模板被選中時的發光陰影,皆已被自動寫入樣式規則中。
  3. 商業轉化無痕植入:左下角的 Token 配額進度條與頂部的 Pro Badge 形成視覺呼應,當用戶額度即將用盡時,可無縫引導點擊進入 Stripe 訂閱升級頁面。

📦 導出為代碼資產:準備登陸 Next.js

在 Stitch 介面右上方,點擊 Export Code。
Stitch 支援將畫面一鍵轉換為純淨的 Tailwind CSS + React JSX 代碼片段。

我們將導出的 UI 代碼依據職責進行拆解,在專案的 src/components/dashboard 目錄下建立好骨架檔案:

src/
└── components/
    └── dashboard/
        ├── AppSidebar.tsx      # 左側折疊導航欄
        ├── TopNavbar.tsx       # 頂部狀態與 Token 指示列
        ├── DropzoneArea.tsx    # 支援拖曳的多模態上傳區
        ├── TemplatePicker.tsx  # 提煉風格卡片選擇器
        └── ResultViewer.tsx    # 結構化產出預覽與分頁切換卡片

透過這種方式,原本需要手刻兩天、調整樣式三天的前端儀表板,在不到 20 分鐘內就完成了具備專業級 UI/UX 質感的標準雛形!


🎯 總結與明日預告

今天我們打破了「工程師不懂設計,畫面只能刻得像後台管理系統」的宿命:

  1. 掌握了利用 Google Stitch 進行自然語言 UI 原型生成的完整工作流。
  2. 透過精確的 Prompt 技巧,規範了 OmniVibe AI 專屬的深色調科技感、佈局架構與微狀態細節。
  3. 成功產出並導出了可供後續重構的 React + Tailwind CSS 介面代碼資產。

但原型終究只是靜態的骨架。在真實的生產環境中,我們需要元件具備極致的無障礙支援、優雅的動畫過渡,以及與 Next.js 15 App Router 的完美相容。

👉 明天(Day 14),我們將進入【元件化重構篇】:實戰將 Stitch 原型全面移植至 Next.js 15 + Tailwind CSS + shadcn/ui!看我們如何用代碼進行模組化重構,打造出具備生產級程式碼品質的前端核心!

我們明天見!🔥


上一篇
Day 12 -【快取省成本】實戰 Context Caching 上下文快取:長文本與影音重複分析現省 75%,打造可持續獲利的 AI SaaS!
下一篇
Day 14 -【元件化重構】將 Stitch 原型全面移植至 Next.js 15 + Tailwind CSS + shadcn/ui:打造生產級模組化 UI
系列文
用 Google AI 生態系 30 天從零打造一個全棧 AI SaaS 服務 共 18 篇
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言