()
| 148 | // ==================== 云端市场 ==================== |
| 149 | |
| 150 | async function fetchCloudCatalog(): Promise<void> { |
| 151 | const langPath = LOCALE_PATH_MAP[currentLocale.value] ?? 'en' |
| 152 | const url = `${CLOUD_MARKET_BASE_URL}/${langPath}/skill.json` |
| 153 | |
| 154 | cloudLoading.value = true |
| 155 | cloudError.value = null |
| 156 | |
| 157 | try { |
| 158 | const result = await usePlatformService().fetchRemoteConfig(url) |
| 159 | if (!result.success || !result.data) { |
| 160 | cloudError.value = result.error || 'Failed to fetch cloud catalog' |
| 161 | cloudCatalog.value = [] |
| 162 | return |
| 163 | } |
| 164 | |
| 165 | const data = result.data as CloudSkillItem[] |
| 166 | if (!Array.isArray(data)) { |
| 167 | cloudError.value = 'Invalid catalog format' |
| 168 | cloudCatalog.value = [] |
| 169 | return |
| 170 | } |
| 171 | |
| 172 | cloudCatalog.value = data.filter((item) => item.id && item.name && item.path) |
| 173 | } catch (error) { |
| 174 | cloudError.value = String(error) |
| 175 | cloudCatalog.value = [] |
| 176 | } finally { |
| 177 | cloudLoading.value = false |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | async function importFromCloud(item: CloudSkillItem): Promise<{ success: boolean; error?: string }> { |
| 182 | const mdUrl = `${CLOUD_MARKET_BASE_URL}${item.path}` |
nothing calls this directly
no test coverage detected