Refactor backend to support interface-definition driven model resources
- Introduce a new model structure for managing interface definitions and model resources, enhancing the backend's capability to handle various service integrations. - Update the Makefile to reflect changes in database seeding and resource management commands. - Remove the deprecated credentials management routes and replace them with a unified model registry API. - Modify existing routes and schemas to align with the new model structure, ensuring seamless integration with the frontend. - Enhance database seeding scripts to populate new model resources and their configurations. - Update README documentation to reflect the new architecture and usage instructions for model resources and interface definitions.
This commit is contained in:
18
Makefile
18
Makefile
@@ -7,7 +7,7 @@
|
||||
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
|
||||
.PHONY: help up down restart logs api-logs db db-list db-seed db-seed-model-resources db-seed-assistants db-clear db-reset
|
||||
|
||||
help: ## 列出所有可用目标
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
||||
@@ -33,19 +33,19 @@ api-logs: ## 只看后端日志
|
||||
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-list: ## 列出模型资源与助手
|
||||
@$(PSQL) -c "SELECT id, name, capability, interface_type, is_default FROM model_resources 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-model-resources: ## 灌入 12 条模型资源种子(幂等)
|
||||
$(PSQL) < backend/db/seed_model_resources.sql
|
||||
|
||||
db-seed-assistants: ## 灌入 知识库 + 助手 种子(幂等;依赖凭证已就绪)
|
||||
db-seed-assistants: ## 灌入 知识库 + 助手 种子(幂等;依赖模型资源已就绪)
|
||||
$(PSQL) < backend/db/seed_assistants.sql
|
||||
|
||||
db-seed: db-seed-credentials db-seed-assistants ## 全量灌种子(凭证→知识库→助手,幂等,可重复执行)
|
||||
db-seed: db-seed-model-resources db-seed-assistants ## 全量灌种子(模型资源→知识库→助手,幂等,可重复执行)
|
||||
|
||||
db-clear: ## 清空 助手/知识库/凭证 三表(按依赖顺序)
|
||||
$(PSQL) -c "TRUNCATE assistants, knowledge_bases, provider_credentials CASCADE;"
|
||||
db-clear: ## 清空 助手/知识库/模型资源(按依赖顺序)
|
||||
$(PSQL) -c "TRUNCATE assistant_model_bindings, assistants, knowledge_bases, model_resources CASCADE;"
|
||||
|
||||
db-reset: db-clear db-seed ## 清空后重新灌全部种子
|
||||
|
||||
Reference in New Issue
Block a user