新版框架不再使用backend文件夹,修复受影响的代码
This commit is contained in:
parent
ebe92eb140
commit
ea83cd03ba
@ -20,8 +20,8 @@ function resolveComponent(componentType) {
|
||||
function discoverNodeMetadata() {
|
||||
// 使用 import.meta.glob 获取所有节点JSON文件
|
||||
// 注意:Vite 要求以 './' 或 '/' 开头,别名在 glob 中不可用
|
||||
// 从当前文件路径 ../../../../../../../ 指向到项目根,再进入 backend/nodes 目录(core 比原 features 深一层)
|
||||
const modulesNew = import.meta.glob('../../../../../../backend/apps/jingrow/jingrow/ai/pagetype/local_ai_agent/nodes/**/*.json', { eager: true })
|
||||
// 从当前文件路径 ../../../../../../../ 指向到项目根,再进入 apps/jingrow/nodes 目录(core 比原 features 深一层)
|
||||
const modulesNew = import.meta.glob('../../../../../../apps/jingrow/jingrow/ai/pagetype/local_ai_agent/nodes/**/*.json', { eager: true })
|
||||
|
||||
const metadataMap = {}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* @returns {Promise<Object>} Schema配置对象
|
||||
*/
|
||||
|
||||
const LOCAL_NODE_SCHEMAS_NEW = import.meta.glob('../../../../../../backend/apps/jingrow/jingrow/ai/pagetype/local_ai_agent/nodes/*/*.json', { eager: true });
|
||||
const LOCAL_NODE_SCHEMAS_NEW = import.meta.glob('../../../../../../apps/jingrow/jingrow/ai/pagetype/local_ai_agent/nodes/*/*.json', { eager: true });
|
||||
|
||||
function loadLocalSchemaByConvention(nodeType) {
|
||||
try {
|
||||
|
||||
@ -119,7 +119,6 @@ export const getNodeList = async (page: number = 1, pageSize: number = 10): Prom
|
||||
}
|
||||
}
|
||||
|
||||
// 导出节点定义(写入 backend/nodes/{type}/{type}.json)
|
||||
export const exportNodeDefinition = async (payload: { metadata: any; schema: any }): Promise<{ success: boolean; path?: string }> => {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
|
||||
@ -64,7 +64,7 @@ const frontendPath = computed(() =>
|
||||
)
|
||||
const backendPath = computed(() =>
|
||||
appName.value && slug.value !== ''
|
||||
? `backend/apps/${appName.value}/${appName.value}/${dotToSlash(moduleName.value)}/pagetype/${slug.value}/${slug.value}.py`
|
||||
? `${appName.value}/apps/${appName.value}/${appName.value}/${dotToSlash(moduleName.value)}/pagetype/${slug.value}/${slug.value}.py`
|
||||
: ''
|
||||
)
|
||||
|
||||
|
||||
@ -217,10 +217,9 @@ const uninstallApp = async (app: any) => {
|
||||
|
||||
const getAppTypeText = (type: string) => {
|
||||
switch (type) {
|
||||
case 'backend': return t('Backend Only')
|
||||
case 'frontend': return t('Frontend Only')
|
||||
case 'both': return t('Full Stack')
|
||||
default: return t('Unknown')
|
||||
default: return t('Backend Only')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ async def get_local_apps(request: Request):
|
||||
app_info = {
|
||||
'name': app_dir.name,
|
||||
'path': str(app_dir),
|
||||
'type': 'both' if (app_dir / "frontend").exists() else 'backend',
|
||||
'type': 'both' if (app_dir / "frontend").exists() else app_dir.name,
|
||||
'title': app_dir.name.replace('_', ' ').title(),
|
||||
'description': '',
|
||||
'publisher': '',
|
||||
@ -142,7 +142,7 @@ async def get_local_apps(request: Request):
|
||||
local_apps.append({
|
||||
'name': app_dir.name,
|
||||
'path': str(app_dir),
|
||||
'type': 'backend',
|
||||
'type': app_dir.name,
|
||||
'title': app_dir.name.replace('_', ' ').title(),
|
||||
'description': '',
|
||||
'publisher': '',
|
||||
@ -170,7 +170,7 @@ async def install_local_app(request: Request, app_name: str):
|
||||
current = Path(__file__).resolve()
|
||||
root = current.parents[4] # 调整路径层级
|
||||
apps_dir = root / "apps" # 新的apps目录
|
||||
app_dir = backend_dir / app_name
|
||||
app_dir = apps_dir / app_name
|
||||
|
||||
if not app_dir.exists():
|
||||
raise HTTPException(status_code=404, detail=f"App '{app_name}' not found")
|
||||
@ -290,8 +290,8 @@ async def uninstall_app(request: Request, app_name: str):
|
||||
|
||||
# 检查应用是否存在
|
||||
backend_dir, frontend_dir = get_app_directories()
|
||||
backend_app_dir = backend_dir / app_name
|
||||
frontend_app_dir = frontend_dir / app_name
|
||||
backend_app_dir = backend_dir / app_name / app_name
|
||||
frontend_app_dir = frontend_dir / app_name / "frontend"
|
||||
|
||||
if not backend_app_dir.exists() and not frontend_app_dir.exists():
|
||||
raise HTTPException(status_code=404, detail=f"应用 {app_name} 不存在")
|
||||
@ -339,8 +339,8 @@ async def get_app_info(request: Request, app_name: str):
|
||||
|
||||
try:
|
||||
backend_dir, frontend_dir = get_app_directories()
|
||||
backend_app_dir = backend_dir / app_name
|
||||
frontend_app_dir = frontend_dir / app_name
|
||||
backend_app_dir = backend_dir / app_name / app_name
|
||||
frontend_app_dir = frontend_dir / app_name / "frontend"
|
||||
|
||||
app_info = {
|
||||
'name': app_name,
|
||||
|
||||
@ -38,7 +38,7 @@ def get_app_directories():
|
||||
|
||||
apps_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
return apps_dir
|
||||
return apps_dir, apps_dir
|
||||
|
||||
|
||||
@handle_errors
|
||||
@ -103,7 +103,7 @@ def analyze_package(temp_dir: str) -> Dict[str, Any]:
|
||||
@handle_errors
|
||||
def install_files(temp_dir: str, app_name: str, package_info: Dict[str, Any], is_backend: bool) -> Dict[str, Any]:
|
||||
"""安装文件到指定目录"""
|
||||
apps_dir = get_app_directories()
|
||||
apps_dir, _ = get_app_directories()
|
||||
app_dir = apps_dir / app_name
|
||||
|
||||
# 创建应用目录结构
|
||||
@ -111,8 +111,8 @@ def install_files(temp_dir: str, app_name: str, package_info: Dict[str, Any], is
|
||||
shutil.rmtree(app_dir)
|
||||
app_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 创建backend和frontend子目录
|
||||
backend_dir = app_dir / "backend"
|
||||
# 创建app_name和frontend子目录
|
||||
backend_dir = app_dir / app_name
|
||||
frontend_dir = app_dir / "frontend"
|
||||
backend_dir.mkdir(parents=True, exist_ok=True)
|
||||
frontend_dir.mkdir(parents=True, exist_ok=True)
|
||||
@ -185,7 +185,7 @@ def cleanup_temp_dir(temp_dir: str):
|
||||
|
||||
def is_app_installed(app_name: str) -> bool:
|
||||
"""检查应用是否已安装"""
|
||||
apps_dir = get_app_directories()
|
||||
apps_dir, _ = get_app_directories()
|
||||
app_dir = apps_dir / app_name
|
||||
return app_dir.exists()
|
||||
|
||||
@ -193,7 +193,7 @@ def is_app_installed(app_name: str) -> bool:
|
||||
def get_installed_apps() -> List[Dict[str, Any]]:
|
||||
"""获取已安装的应用列表"""
|
||||
apps = []
|
||||
apps_dir = get_app_directories()
|
||||
apps_dir, _ = get_app_directories()
|
||||
|
||||
# 扫描apps目录
|
||||
if apps_dir.exists():
|
||||
@ -206,14 +206,14 @@ def get_installed_apps() -> List[Dict[str, Any]]:
|
||||
'exists': True
|
||||
}
|
||||
|
||||
# 检查是否有backend和frontend
|
||||
backend_dir = app_dir / "backend"
|
||||
# 检查是否有app_name和frontend
|
||||
backend_dir = app_dir / app_dir.name
|
||||
frontend_dir = app_dir / "frontend"
|
||||
|
||||
if backend_dir.exists() and frontend_dir.exists():
|
||||
app_info['type'] = 'both'
|
||||
elif backend_dir.exists():
|
||||
app_info['type'] = 'backend'
|
||||
app_info['type'] = app_dir.name
|
||||
elif frontend_dir.exists():
|
||||
app_info['type'] = 'frontend'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user