MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / fetchCloudCatalog

Function fetchCloudCatalog

src/stores/assistant.ts:138–168  ·  view source on GitHub ↗
(localeOverride?: string)

Source from the content-addressed store, hash-verified

136 // ==================== 云端市场 ====================
137
138 async function fetchCloudCatalog(localeOverride?: string): Promise<void> {
139 // 助手市场请求只依赖 locale,不应该反向修改选择页的筛选上下文。
140 const langPath = LOCALE_PATH_MAP[localeOverride || currentLocale.value] ?? 'en'
141 const url = `${CLOUD_MARKET_BASE_URL}/${langPath}/assistant.json`
142
143 cloudLoading.value = true
144 cloudError.value = null
145
146 try {
147 const result = await usePlatformService().fetchRemoteConfig(url)
148 if (!result.success || !result.data) {
149 cloudError.value = result.error || 'Failed to fetch cloud catalog'
150 cloudCatalog.value = []
151 return
152 }
153
154 const data = result.data as CloudAssistantItem[]
155 if (!Array.isArray(data)) {
156 cloudError.value = 'Invalid catalog format'
157 cloudCatalog.value = []
158 return
159 }
160
161 cloudCatalog.value = data.filter((item) => item.id && item.name && item.path)
162 } catch (error) {
163 cloudError.value = String(error)
164 cloudCatalog.value = []
165 } finally {
166 cloudLoading.value = false
167 }
168 }
169
170 async function importFromCloud(item: CloudAssistantItem): Promise<{ success: boolean; error?: string }> {
171 const mdUrl = `${CLOUD_MARKET_BASE_URL}${item.path}`

Callers

nothing calls this directly

Calls 2

usePlatformServiceFunction · 0.90
fetchRemoteConfigMethod · 0.65

Tested by

no test coverage detected