Skip to content

Commit a1f6c2a

Browse files
committed
docs(readme): add supabase migration and switch guide
1 parent d0fcdf3 commit a1f6c2a

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,59 @@ providers:
173173
- **关闭(默认)**:图片逐张生成,适合有速率限制的 API
174174
- **开启**:图片并行生成(最多15张同时),速度更快
175175

176+
### 切换到 Supabase 存储(可选)
177+
178+
默认使用 YAML + 本地历史记录存储。若要切换到 Supabase,请按以下步骤:
179+
180+
1. 创建 Supabase 表结构
181+
182+
在 Supabase SQL Editor 依次执行:
183+
- `backend/migrations/create_history_records.sql`
184+
- `backend/migrations/create_xiaohongshu_posts.sql`
185+
186+
> `create_history_records.sql` 已包含 `app_configs` 表(用于配置存储)。
187+
188+
2. 创建 Storage Bucket
189+
190+
- 在 Supabase Storage 创建 bucket:`renderink-images`
191+
- 建议设置为 public(便于图片直链访问)
192+
193+
3. 配置环境变量(`.env`)
194+
195+
```env
196+
SUPABASE_URL=https://<your-project>.supabase.co
197+
SUPABASE_KEY=<your-service-role-key>
198+
199+
# 配置存储切换(text/image/firecrawl 配置存到 Supabase)
200+
CONFIG_STORAGE_MODE=supabase
201+
CONFIG_SUPABASE_TABLE=app_configs
202+
203+
# 历史记录存储切换
204+
HISTORY_STORAGE_MODE=supabase
205+
```
206+
207+
4. (可选)迁移本地 history 数据到 Supabase
208+
209+
```bash
210+
uv run python -m backend.migrations.migrate_local_to_supabase
211+
```
212+
213+
5. 重启后端服务
214+
215+
```bash
216+
uv run python backend/app.py
217+
```
218+
219+
6. 验证是否生效
220+
221+
- 后端启动日志出现:`配置存储模式: supabase (SupabaseConfigStore)`
222+
- Supabase 的 `app_configs` 表出现配置数据
223+
- 生成历史后,`history_records` 和 `renderink-images` 有新增记录
224+
225+
说明:
226+
- `.env` 用于系统级配置(Supabase、限流、认证等)
227+
- 模型 `api_key/base_url/model` 仍建议通过设置页或 YAML 配置管理
228+
176229
---
177230

178231
## 注意事项

0 commit comments

Comments
 (0)