- Update Makefile to include new database seed commands for assistants and credentials. - Refactor assistant model to use explicit fields instead of a config dictionary, improving data integrity and clarity. - Implement new seeding SQL script for assistants, ensuring dependencies on credentials are respected. - Modify backend routes and frontend components to accommodate the new assistant structure, including direct field access for prompt, API URL, and keys. - Enhance the AssistantPage component to handle the new data structure and streamline the save process for different assistant types.
52 lines
1.9 KiB
Makefile
52 lines
1.9 KiB
Makefile
# 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-seed-credentials db-seed-assistants 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;"
|
|
@$(PSQL) -c "SELECT id, name, type FROM assistants ORDER BY id;"
|
|
|
|
db-seed-credentials: ## 灌入 12 条模型凭证种子(幂等)
|
|
$(PSQL) < backend/db/seed_credentials.sql
|
|
|
|
db-seed-assistants: ## 灌入 知识库 + 助手 种子(幂等;依赖凭证已就绪)
|
|
$(PSQL) < backend/db/seed_assistants.sql
|
|
|
|
db-seed: db-seed-credentials db-seed-assistants ## 全量灌种子(凭证→知识库→助手,幂等,可重复执行)
|
|
|
|
db-clear: ## 清空 助手/知识库/凭证 三表(按依赖顺序)
|
|
$(PSQL) -c "TRUNCATE assistants, knowledge_bases, provider_credentials CASCADE;"
|
|
|
|
db-reset: db-clear db-seed ## 清空后重新灌全部种子
|