Enhance AI Video Assistant platform with new Makefile for development commands, update CORS origins for local access, and implement API client for credential management. Add seed data for model credentials and refactor ComponentsModelsPage to utilize API for dynamic data loading. Update Next.js configuration for Turbopack compatibility.
This commit is contained in:
45
Makefile
Normal file
45
Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
# AI Video Assistant 平台 —— 开发常用命令
|
||||
#
|
||||
# 用法:make <目标>,例如 make up / make db-seed。
|
||||
# 多数目标是对 docker compose 的薄封装,集中沉淀平时手敲的开发脚本。
|
||||
|
||||
# 容器内执行 psql 的固定前缀(postgres/postgres/postgres,见 docker-compose.yaml)
|
||||
PSQL = docker compose exec -T postgres psql -U postgres -d postgres
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
.PHONY: help up down restart logs api-logs db db-list db-seed db-clear db-reset
|
||||
|
||||
help: ## 列出所有可用目标
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
||||
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
# ---- 服务编排 ----
|
||||
up: ## 起 postgres + api + ui
|
||||
docker compose up -d
|
||||
|
||||
down: ## 停掉所有服务(保留数据卷)
|
||||
docker compose down
|
||||
|
||||
restart: ## 重建 api 容器(改了 env/CORS 后用)
|
||||
docker compose up -d --force-recreate api
|
||||
|
||||
logs: ## 跟随全部服务日志
|
||||
docker compose logs -f
|
||||
|
||||
api-logs: ## 只看后端日志
|
||||
docker compose logs -f api
|
||||
|
||||
# ---- 数据库 ----
|
||||
db: ## 进入交互式 psql
|
||||
docker compose exec postgres psql -U postgres -d postgres
|
||||
|
||||
db-list: ## 列出模型凭证(key 明文,仅本地调试用)
|
||||
@$(PSQL) -c "SELECT id, name, type, interface_type, is_default FROM provider_credentials ORDER BY id;"
|
||||
|
||||
db-seed: ## 灌入 12 条模型凭证种子(幂等)
|
||||
$(PSQL) < backend/db/seed_credentials.sql
|
||||
|
||||
db-clear: ## 清空模型凭证表
|
||||
$(PSQL) -c "TRUNCATE provider_credentials;"
|
||||
|
||||
db-reset: db-clear db-seed ## 清空后重新灌种子
|
||||
Reference in New Issue
Block a user