基于 Gemini 3 Pro Image Preview API 的前端示例,提供「文本生成图片 / 多图合成 / 图片编辑」的一站式体验,使用 React 18 + Vite + Tailwind + Radix UI 构建。
如果你遇到了网络失败问题,建议先查看API供应商的连通质量喵,可能不管我的事喵老大
.
├─ api/
│ └─ proxy.cjs // 服务端转发:解决浏览器 CORS,带白名单
├─ proxy.allowlist.json // 服务端转发白名单(可直接修改)
├─ src/
│ ├─ main.tsx // React 挂载入口
│ ├─ App.tsx // 应用根组件与布局
│ ├─ index.css // 全局样式(Tailwind)
│ ├─ lib/utils.ts // 通用工具(类名合并)
│ ├─ types/gemini.ts // Gemini 请求/响应类型
│ └─ features/chat/
│ ├─ components/ // ChatHeader、PromptPanel、MessageList 等 UI 组件
│ ├─ hooks/useChatSession.ts // 状态管理与业务动作
│ ├─ services/geminiClient.ts // Gemini API 调用封装
│ ├─ services/request.ts // 按请求方式 client/server 发起请求
│ ├─ utils/ // apiConfig、files、session、thumb 等小工具
│ └─ types.ts // 聊天领域模型类型
├─ components/ // 通用组件(ImageLightbox、UI 基础件)
├─ index.html // Vite HTML 模板
├─ vite.config.js // Vite 配置与别名
├─ tailwind.config.js // Tailwind 设计令牌
├─ tsconfig.json // TS 编译与路径别名(@/*)
├─ vercel.json // Vercel 构建与输出配置
└─ package.json // 脚本与依赖
bash
npm installbash
npm run dev
# 默认 http://localhost:5173https://www.packyapi.com)与 API Key。localStorage。bash
npm run build
npm run preview # 本地预览 distbash
npx tsc --noEmitgoogle_search 增强生成。localStorage(如:gemini_api_url、gemini_api_key、api_type、request_mode 等)。client(客户端直连):浏览器直接请求你配置的 API URL;如果目标站点未开启 CORS,可能会出现跨域报错。server(服务端转发):前端请求站点自身的 /api/proxy,由服务端转发到目标 API(可绕过浏览器 CORS)。服务端不会保存 Key,但 Key 会随请求发给服务端用于转发。www.packyapi.com、api-slb.packyapi.com、poloai.top、jp.duckcoding.com、www.galaapi.com、privnode.com、jp.privnode.com、privcoding.cc。proxy.allowlist.json 后重新部署即可。PROXY_ALLOWLIST_HOSTNAMES、PROXY_ALLOWLIST_PROTOCOLS。blocked by CORS policy 的报错,建议优先使用「服务端转发」或使用支持 CORS 的 API 域名。$ claude mcp add gemini-3-pro-image-preview-demo \
-- python -m otcore.mcp_server <graph>