mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-06 08:15:57 +00:00
fix(publish): clarify duplicate version upload errors
This commit is contained in:
parent
f3cd59a6c0
commit
8c8ce1d881
3 changed files with 23 additions and 0 deletions
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -472,6 +472,8 @@
|
|||
"error": "发布失败",
|
||||
"timeoutTitle": "发布请求超时",
|
||||
"timeoutDescription": "本次发布等待时间过长,请稍后到技能列表确认结果,或重新尝试发布。",
|
||||
"versionExistsTitle": "版本号已存在",
|
||||
"versionExistsDescription": "当前技能版本已经发布过,请修改 SKILL.md 中的 version 后重新打包上传。",
|
||||
"selectRequired": "请选择命名空间和文件"
|
||||
},
|
||||
"toast": {
|
||||
|
|
|
|||
|
|
@ -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 : '')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue