diff --git a/.memory/worklog.json b/.memory/worklog.json index 64b492e..1f007fb 100644 --- a/.memory/worklog.json +++ b/.memory/worklog.json @@ -1,11 +1,5 @@ { "entries": [ - { - "files_changed": 2, - "message": "Codex 会话活跃 · 最近命令:codex · 分支 main · 2 项未提交变更 · 最近提交:auto-save 2026-05-20 19:44 (~3)", - "ts": "2026-05-20T11:45:32Z", - "type": "session-heartbeat" - }, { "files_changed": 3, "hash": "3e7c165", @@ -3196,6 +3190,13 @@ "message": "auto-save 2026-05-27 17:18 (~9)", "hash": "9ab5417", "files_changed": 9 + }, + { + "ts": "2026-05-27T17:24:16+08:00", + "type": "commit", + "message": "auto-save 2026-05-27 17:24 (~4)", + "hash": "fb939b8", + "files_changed": 4 } ] } diff --git a/web/canvas-app/src/stores/models.js b/web/canvas-app/src/stores/models.js index dc6bcae..32e81a8 100644 --- a/web/canvas-app/src/stores/models.js +++ b/web/canvas-app/src/stores/models.js @@ -24,6 +24,7 @@ import { DEFAULT_VIDEO_DURATION } from '@/config/models' import { useModelConfig } from '@/hooks/useModelConfig' +import { useModelStore } from './pinia' // Loading state (always false for built-in models) | 加载状态 const loading = ref(false) @@ -38,10 +39,23 @@ const getModelConfigHook = () => { } } +const getPiniaModelStore = () => { + try { + return useModelStore() + } catch { + return null + } +} + /** * Initialize models (no-op for built-in) | 初始化模型 */ export const loadAllModels = async () => { + const modelStore = getPiniaModelStore() + if (modelStore) { + await modelStore.loadRuntimeModels?.() + return [...modelStore.allImageModels, ...modelStore.allVideoModels, ...modelStore.allChatModels] + } const modelConfig = getModelConfigHook() if (modelConfig) { return [...modelConfig.allImageModels.value, ...modelConfig.allVideoModels.value, ...modelConfig.allChatModels.value] @@ -53,6 +67,12 @@ export const loadAllModels = async () => { * Get model config by name | 根据名称获取模型配置 */ export const getModelConfig = (modelKey) => { + const modelStore = getPiniaModelStore() + if (modelStore) { + return modelStore.getImageModel(modelKey) || + modelStore.getVideoModel(modelKey) || + modelStore.getChatModel(modelKey) + } const modelConfig = getModelConfigHook() if (modelConfig) { return modelConfig.getImageModel(modelKey) || @@ -68,7 +88,7 @@ export const getModelConfig = (modelKey) => { * Returns options based on model's sizes array and quality */ export const getModelSizeOptions = (modelKey, quality = 'standard') => { - const model = IMAGE_MODELS.find(m => m.key === modelKey) + const model = getModelConfig(modelKey) || IMAGE_MODELS.find(m => m.key === modelKey) if (model?.sizeOptions) { return model.sizeOptions @@ -93,7 +113,7 @@ export const getModelSizeOptions = (modelKey, quality = 'standard') => { * Get quality options for image model | 获取图片模型画质选项 */ export const getModelQualityOptions = (modelKey) => { - const model = IMAGE_MODELS.find(m => m.key === modelKey) + const model = getModelConfig(modelKey) || IMAGE_MODELS.find(m => m.key === modelKey) return model?.qualities || [] } diff --git a/web/canvas-app/src/views/Canvas.vue b/web/canvas-app/src/views/Canvas.vue index f41aea2..f960004 100644 --- a/web/canvas-app/src/views/Canvas.vue +++ b/web/canvas-app/src/views/Canvas.vue @@ -319,7 +319,6 @@ const isApiConfigured = computed(() => !!modelStore.currentApiKey) // Initialize models on page load | 页面加载时初始化模型 onMounted(() => { loadAllModels() - modelStore.loadRuntimeModels() }) // Chat templates | 问答模板