From 8c8ce1d8815700c19e30f320bac6180bc651d85f Mon Sep 17 00:00:00 2001 From: yun-zhi-ztl Date: Sat, 14 Mar 2026 19:59:26 +0800 Subject: [PATCH] fix(publish): clarify duplicate version upload errors --- web/src/i18n/locales/en.json | 2 ++ web/src/i18n/locales/zh.json | 2 ++ web/src/pages/dashboard/publish.tsx | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 61980879..1f10da9f 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -472,6 +472,8 @@ "error": "Publish Failed", "timeoutTitle": "Publish timed out", "timeoutDescription": "The publish request took too long. Please check the skill list later or try again.", + "versionExistsTitle": "Version already exists", + "versionExistsDescription": "This skill version has already been published. Update the version in SKILL.md, rebuild the package, and upload it again.", "selectRequired": "Please select namespace and file" }, "toast": { diff --git a/web/src/i18n/locales/zh.json b/web/src/i18n/locales/zh.json index e5c9583c..ee3fd5af 100644 --- a/web/src/i18n/locales/zh.json +++ b/web/src/i18n/locales/zh.json @@ -472,6 +472,8 @@ "error": "发布失败", "timeoutTitle": "发布请求超时", "timeoutDescription": "本次发布等待时间过长,请稍后到技能列表确认结果,或重新尝试发布。", + "versionExistsTitle": "版本号已存在", + "versionExistsDescription": "当前技能版本已经发布过,请修改 SKILL.md 中的 version 后重新打包上传。", "selectRequired": "请选择命名空间和文件" }, "toast": { diff --git a/web/src/pages/dashboard/publish.tsx b/web/src/pages/dashboard/publish.tsx index d9578f31..5230524c 100644 --- a/web/src/pages/dashboard/publish.tsx +++ b/web/src/pages/dashboard/publish.tsx @@ -10,6 +10,16 @@ import { useMyNamespaces, usePublishSkill } from '@/shared/hooks/use-skill-queri import { toast } from '@/shared/lib/toast' import { ApiError } from '@/api/client' +function isVersionExistsMessage(message?: string): boolean { + if (!message) { + return false + } + + return message.includes('error.skill.version.exists') + || message.includes('Version already exists') + || message.includes('版本已存在') +} + export function PublishPage() { const { t } = useTranslation() const navigate = useNavigate() @@ -44,6 +54,15 @@ export function PublishPage() { toast.error(t('publish.timeoutTitle'), t('publish.timeoutDescription')) return } + + if (error instanceof ApiError && isVersionExistsMessage(error.serverMessage || error.message)) { + toast.error( + t('publish.versionExistsTitle'), + t('publish.versionExistsDescription'), + ) + return + } + toast.error(t('publish.error'), error instanceof Error ? error.message : '') } }