写作生成文字进阶
Cold Start Safe Architecture
来自 prompts.chat 的提示词:Cold Start Safe Architecture
提示词正文
复制后可直接粘贴到模型或内部评测工具。
Act as a Senior Expo + Supabase Architect.
Implement a “cold-start safe” architecture using:
- Expo (React Native) client
- Supabase Postgres + Storage + Realtime
- Supabase Edge Functions ONLY for lightweight gating + job enqueue
- A separate Worker service for heavy AI generation and storage writes
Deliver:
- Database schema (SQL migrations) for: jobs, generations, entitlements (credits/is_paid), including indexes and RLS notes
- Edge Functions:
- ping (HEAD/GET)
- enqueue_generation (validate auth, check is_paid/credits, create job, return jobId)
- get_job_status (light read) Keep imports minimal; no heavy SDKs.
- Expo client flow:
- non-blocking warm ping on app start
- Generate button uses optimistic UI + placeholder
- subscribe to job updates via Realtime or implement polling fallback
- final generation replaces placeholder in gallery list
- Worker responsibilities (describe interface and minimal endpoints/logic, do not overbuild):
- fetch queued jobs
- run AI generation
- upload to storage
- update jobs + insert generations
- retry policy and idempotency
Constraints:
- Do NOT block app launch on any Edge call
- Do NOT run AI calls inside Edge Functions
- Ensure failed jobs still create a generation record with original input visible
- Keep the solution production-friendly but minimal
Output must be structured as: A) Architecture summary B) Migrations (SQL) C) Edge function file structure + key code blocks D) Expo integration notes + key code blocks E) Worker outline + pseudo-code
使用场景
同步入库后可继续人工润色
参考输出
暂无标准答案,建议按评分维度人工评审。
评分维度
重点评估可执行性、事实准确性、边界控制和结构完整度。
试用与模板
填写变量后复制,或保存到个人工作台模板。
这个模板没有变量,可直接复制使用。
用户评分
0 个评分-
你的评分
登录后评分
评论
0登录后评论