重命名节点管理路由文件
This commit is contained in:
parent
651eb42c8b
commit
ec822037f8
@ -19,7 +19,7 @@ function resolveComponent(componentType) {
|
|||||||
// 发现所有节点的元数据(从API获取)
|
// 发现所有节点的元数据(从API获取)
|
||||||
async function discoverNodeMetadata() {
|
async function discoverNodeMetadata() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/jingrow/node-definitions/metadata');
|
const response = await fetch('/jingrow/node/metadata');
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
export async function loadNodeSchema(nodeType) {
|
export async function loadNodeSchema(nodeType) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/jingrow/node-definitions/schema/${nodeType}`);
|
const response = await fetch(`/jingrow/node/schema/${nodeType}`);
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success && result.data) {
|
if (result.success && result.data) {
|
||||||
|
|||||||
@ -122,7 +122,7 @@ export const getNodeList = async (page: number = 1, pageSize: number = 10): Prom
|
|||||||
export const exportNodeDefinition = async (payload: { metadata: any; schema: any }): Promise<{ success: boolean; path?: string }> => {
|
export const exportNodeDefinition = async (payload: { metadata: any; schema: any }): Promise<{ success: boolean; path?: string }> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`/jingrow/node-definitions/export`,
|
`/jingrow/node/export`,
|
||||||
payload,
|
payload,
|
||||||
{ headers: get_session_api_headers(), withCredentials: true }
|
{ headers: get_session_api_headers(), withCredentials: true }
|
||||||
)
|
)
|
||||||
@ -138,7 +138,7 @@ export const exportNodeDefinition = async (payload: { metadata: any; schema: any
|
|||||||
export const importLocalNodes = async (): Promise<{ success: boolean; matched: number; imported: number; skipped_existing: number; errors?: string[] }> => {
|
export const importLocalNodes = async (): Promise<{ success: boolean; matched: number; imported: number; skipped_existing: number; errors?: string[] }> => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`/jingrow/node-definitions/import-local`,
|
`/jingrow/node/import-local`,
|
||||||
{},
|
{},
|
||||||
{ headers: get_session_api_headers(), withCredentials: true }
|
{ headers: get_session_api_headers(), withCredentials: true }
|
||||||
)
|
)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post("/jingrow/node-definitions/export")
|
@router.post("/jingrow/node/export")
|
||||||
async def export_node_definition(payload: Dict[str, Any]):
|
async def export_node_definition(payload: Dict[str, Any]):
|
||||||
"""
|
"""
|
||||||
导出节点定义(metadata + schema)为 JSON 文件
|
导出节点定义(metadata + schema)为 JSON 文件
|
||||||
@ -42,7 +42,7 @@ async def export_node_definition(payload: Dict[str, Any]):
|
|||||||
raise HTTPException(status_code=400, detail=str(e))
|
raise HTTPException(status_code=400, detail=str(e))
|
||||||
|
|
||||||
|
|
||||||
@router.post("/jingrow/node-definitions/import-local")
|
@router.post("/jingrow/node/import-local")
|
||||||
async def import_local_node_definitions():
|
async def import_local_node_definitions():
|
||||||
"""
|
"""
|
||||||
扫描本地节点定义目录,按 metadata 去重后导入到 Local Ai Node。
|
扫描本地节点定义目录,按 metadata 去重后导入到 Local Ai Node。
|
||||||
@ -121,7 +121,7 @@ async def import_local_node_definitions():
|
|||||||
raise HTTPException(status_code=500, detail=str(e))
|
raise HTTPException(status_code=500, detail=str(e))
|
||||||
|
|
||||||
|
|
||||||
@router.get("/jingrow/node-definitions/metadata")
|
@router.get("/jingrow/node/metadata")
|
||||||
async def get_all_node_metadata():
|
async def get_all_node_metadata():
|
||||||
"""
|
"""
|
||||||
获取所有节点的元数据,用于流程编排界面
|
获取所有节点的元数据,用于流程编排界面
|
||||||
@ -170,7 +170,7 @@ async def get_all_node_metadata():
|
|||||||
raise HTTPException(status_code=500, detail=str(e))
|
raise HTTPException(status_code=500, detail=str(e))
|
||||||
|
|
||||||
|
|
||||||
@router.get("/jingrow/node-definitions/schema/{node_type}")
|
@router.get("/jingrow/node/schema/{node_type}")
|
||||||
async def get_node_schema(node_type: str):
|
async def get_node_schema(node_type: str):
|
||||||
"""
|
"""
|
||||||
获取指定节点类型的Schema配置
|
获取指定节点类型的Schema配置
|
||||||
@ -528,7 +528,7 @@ def _install_single_node_directory(node_dir: str) -> Dict[str, Any]:
|
|||||||
|
|
||||||
# 确定目标目录:apps/jingrow/jingrow/ai/nodes
|
# 确定目标目录:apps/jingrow/jingrow/ai/nodes
|
||||||
current_file = Path(__file__).resolve()
|
current_file = Path(__file__).resolve()
|
||||||
# node_definitions.py 位于 jingrow/api/
|
# node_management.py 位于 jingrow/api/
|
||||||
# parents[0] = jingrow/api, parents[1] = jingrow
|
# parents[0] = jingrow/api, parents[1] = jingrow
|
||||||
jingrow_root = current_file.parents[1] # jingrow
|
jingrow_root = current_file.parents[1] # jingrow
|
||||||
nodes_root = jingrow_root / "ai" / "nodes"
|
nodes_root = jingrow_root / "ai" / "nodes"
|
||||||
Loading…
x
Reference in New Issue
Block a user