Skip to content

Commit d5f6d96

Browse files
refactor: remove redunant assetService function
1 parent 1c32bf0 commit d5f6d96

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

src/platform/assets/components/UploadModelDialog.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,15 @@ onMounted(() => {
249249

250250
<style scoped>
251251
.upload-model-dialog {
252-
min-width: 600px;
252+
width: 90vw;
253+
max-width: 800px;
253254
min-height: 400px;
254255
}
256+
257+
@media (min-width: 640px) {
258+
.upload-model-dialog {
259+
width: auto;
260+
min-width: 600px;
261+
}
262+
}
255263
</style>

src/platform/assets/schemas/assetSchema.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,27 @@ const zModelFile = z.object({
3434
})
3535

3636
// Asset metadata from download URL
37+
const zValidationError = z.object({
38+
code: z.string(),
39+
message: z.string(),
40+
field: z.string()
41+
})
42+
43+
const zValidationResult = z.object({
44+
is_valid: z.boolean(),
45+
errors: z.array(zValidationError).optional(),
46+
warnings: z.array(zValidationError).optional()
47+
})
48+
3749
const zAssetMetadata = z.object({
3850
content_length: z.number(),
3951
final_url: z.string(),
4052
content_type: z.string().optional(),
4153
filename: z.string().optional(),
4254
name: z.string().optional(),
4355
tags: z.array(z.string()).optional(),
44-
preview_url: z.string().optional()
56+
preview_url: z.string().optional(),
57+
validation: zValidationResult.optional()
4558
})
4659

4760
// Filename validation schema

src/platform/assets/services/assetService.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function createAssetService() {
260260
async function getAssetMetadata(url: string): Promise<AssetMetadata> {
261261
const encodedUrl = encodeURIComponent(url)
262262
const res = await api.fetchApi(
263-
`${ASSETS_ENDPOINT}/metadata?url=${encodedUrl}`
263+
`${ASSETS_ENDPOINT}/remote-metadata?url=${encodedUrl}`
264264
)
265265

266266
if (!res.ok) {
@@ -310,24 +310,6 @@ function createAssetService() {
310310
return await res.json()
311311
}
312312

313-
/**
314-
* Gets available model types from the server
315-
*
316-
* @returns Promise<ModelFolder[]> - List of model types with their folder mappings
317-
* @throws Error if request fails
318-
*/
319-
async function getModelTypes(): Promise<ModelFolder[]> {
320-
const res = await api.fetchApi('/experiment/models')
321-
322-
if (!res.ok) {
323-
throw new Error(
324-
`Failed to fetch model types: Server returned ${res.status}`
325-
)
326-
}
327-
328-
return await res.json()
329-
}
330-
331313
return {
332314
getAssetModelFolders,
333315
getAssetModels,
@@ -337,8 +319,7 @@ function createAssetService() {
337319
getAssetsByTag,
338320
deleteAsset,
339321
getAssetMetadata,
340-
uploadAssetFromUrl,
341-
getModelTypes
322+
uploadAssetFromUrl
342323
}
343324
}
344325

0 commit comments

Comments
 (0)