Repository navigation
feat(assets): write model_type: tag from discovery (FE-1084) #12972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d435968
01a51fc
86faaee
1897ec5
31c043e
979f01f
c8af4c5
7117caf
ccc6a1f
c34bef8
09877d7
ece07cc
d43ecf8
74e4e38
8c3b946
b1b7b78
0f71ca4
c848833
5101631
e0dfcd1
179e7a3
93249d3
8a80fee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import type { Ref } from 'vue' | |
| import { computed, ref, watch } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| import { useFeatureFlags } from '@/composables/useFeatureFlags' | ||
| import { st } from '@/i18n' | ||
| import { civitaiImportSource } from '@/platform/assets/importSources/civitaiImportSource' | ||
| import { huggingfaceImportSource } from '@/platform/assets/importSources/huggingfaceImportSource' | ||
|
|
@@ -11,7 +12,11 @@ import type { | |
| } from '@/platform/assets/schemas/assetSchema' | ||
| import { assetService } from '@/platform/assets/services/assetService' | ||
| import type { ImportSource } from '@/platform/assets/types/importSource' | ||
| import { getAssetFilename } from '@/platform/assets/utils/assetMetadataUtils' | ||
| import { | ||
| getAssetFilename, | ||
| stripModelTypePrefix, | ||
| toModelTypeTag | ||
| } from '@/platform/assets/utils/assetMetadataUtils' | ||
| import { validateSourceUrl } from '@/platform/assets/utils/importSourceUtil' | ||
| import { useAssetDownloadStore } from '@/stores/assetDownloadStore' | ||
| import { useAssetsStore } from '@/stores/assetsStore' | ||
|
|
@@ -68,6 +73,7 @@ export function useUploadModelWizard( | |
| options: UploadModelWizardOptions = {} | ||
| ) { | ||
| const { t } = useI18n() | ||
| const { flags } = useFeatureFlags() | ||
| const assetsStore = useAssetsStore() | ||
| const assetDownloadStore = useAssetDownloadStore() | ||
| const modelToNodeStore = useModelToNodeStore() | ||
|
|
@@ -271,19 +277,22 @@ export function useUploadModelWizard( | |
| } | ||
|
|
||
| function getImportedModelType(asset: AssetItem): string | undefined { | ||
| const knownType = asset.tags.find( | ||
| (tag) => | ||
| tag !== MODEL_ROOT_TAG && | ||
| const subtypeTags = asset.tags | ||
| .filter((tag) => tag !== MODEL_ROOT_TAG) | ||
| .map(stripModelTypePrefix) | ||
| return ( | ||
| subtypeTags.find((tag) => | ||
| modelTypes.value.some((type) => type.value === tag) | ||
| ) ?? subtypeTags[0] | ||
| ) | ||
| return knownType ?? asset.tags.find((tag) => tag !== MODEL_ROOT_TAG) | ||
| } | ||
|
|
||
| function blockMismatchedImportedModel( | ||
| asset: AssetItem, | ||
| requiredType: string | ||
| ): boolean { | ||
| if (asset.tags.includes(requiredType)) return false | ||
| if (asset.tags.map(stripModelTypePrefix).includes(requiredType)) | ||
| return false | ||
|
|
||
| const importedType = getImportedModelType(asset) | ||
| uploadStatus.value = 'error' | ||
|
|
@@ -317,7 +326,11 @@ export function useUploadModelWizard( | |
|
|
||
| try { | ||
| const modelType = resolvedModelType.value | ||
| const tags = modelType ? ['models', modelType] : ['models'] | ||
| const subtypeTag = | ||
| modelType && flags.supportsModelTypeTags | ||
| ? toModelTypeTag(modelType) | ||
| : modelType | ||
| const tags = subtypeTag ? [MODEL_ROOT_TAG, subtypeTag] : [MODEL_ROOT_TAG] | ||
|
synap5e marked this conversation as resolved.
Resolved
Comment on lines
+329
to
+333
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question — is the bare directory-path twin written synchronously? With
I checked whether anything rewrites these on the way out — That makes the import path's correctness rest entirely on the backend behaviour asserted in the doc comment at
The timing of that sync is what I want to pin down, because the upload path re-reads immediately.
Is the twin write part of the same transaction as the asset create? If it's eventually-consistent, this probably wants the FE to send both forms in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Answered comprehensively on #12948 (#12948 (comment)): cloud writes the twin synchronously in one Ent transaction; core (#14511) writes Posted by Claude Code on Simon's behalf. |
||
| const filename = | ||
| wizardData.value.metadata?.filename || | ||
| wizardData.value.metadata?.name || | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.