diff --git a/README.md b/README.md index f2412eb..224e4ff 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ ./run.sh ``` -默认访问 http://127.0.0.1:8081 +默认访问 http://127.0.0.1:8082 ## 数据库 diff --git a/docs/README.md b/docs/README.md index 4bb3ba2..cb2c79e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -336,7 +336,6 @@ ssw-ontology/ ## 10. 当前状态与注意事项 - 当前代码已完成 Object / Property / Link / Action / Function / Interface 元数据,以及 Dynamic Security 运行时治理。 -- 默认端口是 `8080`;本机若被 Trustee KBS 占用,可使用 `HTTP_PORT=8081`。 - 前端改动后必须重新构建并重新编译 Go 二进制,原因是前端静态资源被 `//go:embed` 内嵌。 - `script` / `external_api` Function 类型目前只完成元数据定义,尚未提供通用脚本沙箱或外部 HTTP 执行器。 - 当前 MCP 仍暴露 6 个查询工具;Interface 元数据已登记,但并不自动替代 MCP 工具清单。 diff --git a/run.sh b/run.sh index 90e6729..43249e7 100755 --- a/run.sh +++ b/run.sh @@ -13,8 +13,8 @@ if [ ! -x bin/server ]; then fi export DATABASE_URL="${DATABASE_URL:-postgres://dacli:dacli123@localhost:15432/shangshu?sslmode=disable}" -# 默认 8081(8080 在本机被 Trustee KBS 占用;如需其他端口可用环境变量覆盖) -export HTTP_PORT="${HTTP_PORT:-8081}" +# 默认 8082(8080 在本机被 Trustee KBS 占用;如需其他端口可用环境变量覆盖) +export HTTP_PORT="${HTTP_PORT:-8082}" # 脚本即位于仓库根目录,REPO_ROOT 取脚本所在目录(目录已扁平化,不再需要 cd ..) REPO_ROOT="$(cd "$(dirname "$0")" && pwd)" export ARCHIVE_DIR="${ARCHIVE_DIR:-${REPO_ROOT}/archive}" diff --git a/web/src/views/AIView.vue b/web/src/views/AIView.vue index a456c3f..efba96e 100644 --- a/web/src/views/AIView.vue +++ b/web/src/views/AIView.vue @@ -266,7 +266,9 @@ function extractConns(conns) { async function doExtract() { extract.value.loading = true const n = extract.value.rows.length || extract.value.conns.length - const tipId = ElMessage({ message: `正在抽取 ${n} 个文件(30~90 秒,请勿关闭)…`, type: 'info', duration: 0 }) + // Element Plus: ElMessage() 返回的就是 MessageHandler 实例, 可直接调 .close(); + // ElMessage.close(id) 旧 API 在新版本里被移除, 用 try/catch 兜底防止 toast 异常阻塞 UI. + const tip = ElMessage({ message: `正在抽取 ${n} 个文件(30~90 秒,请勿关闭)…`, type: 'info', duration: 0 }) try { let r if (extract.value.rows.length) { @@ -274,13 +276,27 @@ async function doExtract() { } else { r = await api.kmExtractConnections({ ids: extract.value.conns.map(x => x.id), mode: extract.value.mode, directive: extract.value.directive }) } - const ok = (r.results || []).filter(x => x.status === 'applied' || x.status === 'reviewed').length - ElMessage.success(`提取完成:${ok}/${ (r.results || []).length } 成功`) - extract.value.show = false + const results = (r && r.results) || [] + const ok = results.filter(x => x.status === 'applied' || x.status === 'reviewed').length + const failed = results.filter(x => x.status === 'failed' || x.status === 'error') + if (failed.length && failed.length === results.length) { + ElMessage.error(`提取失败:${failed.map(x => x.error || x.rel_path).join('; ')}`) + } else if (failed.length) { + ElMessage.warning(`提取完成:${ok}/${results.length} 成功,${failed.length} 失败(${failed.map(x => x.rel_path || x.id).join(',')})`) + } else { + ElMessage.success(`提取完成:${ok}/${results.length} 成功`) + } loadAll(); loadConns() - } catch (e) { ElMessage.error(e.message || '提取失败') } - ElMessage.close(tipId) - extract.value.loading = false + } catch (e) { + ElMessage.error(e.message || '提取失败') + } finally { + // 不管成功/失败/异常, 一律关闭弹窗 + 清除 loading, 防止 UI 卡死 + try { tip && typeof tip.close === 'function' && tip.close() } catch {} + extract.value.show = false + extract.value.loading = false + extract.value.rows = [] + extract.value.conns = [] + } } async function deleteRows(rows) {