auto-save 2026-05-27 17:29 (~3)

This commit is contained in:
2026-05-27 17:29:45 +08:00
parent fb939b8fcf
commit 6ac548a937
3 changed files with 29 additions and 9 deletions

View File

@@ -1,11 +1,5 @@
{ {
"entries": [ "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, "files_changed": 3,
"hash": "3e7c165", "hash": "3e7c165",
@@ -3196,6 +3190,13 @@
"message": "auto-save 2026-05-27 17:18 (~9)", "message": "auto-save 2026-05-27 17:18 (~9)",
"hash": "9ab5417", "hash": "9ab5417",
"files_changed": 9 "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
} }
] ]
} }

View File

@@ -24,6 +24,7 @@ import {
DEFAULT_VIDEO_DURATION DEFAULT_VIDEO_DURATION
} from '@/config/models' } from '@/config/models'
import { useModelConfig } from '@/hooks/useModelConfig' import { useModelConfig } from '@/hooks/useModelConfig'
import { useModelStore } from './pinia'
// Loading state (always false for built-in models) | 加载状态 // Loading state (always false for built-in models) | 加载状态
const loading = ref(false) 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) | 初始化模型 * Initialize models (no-op for built-in) | 初始化模型
*/ */
export const loadAllModels = async () => { export const loadAllModels = async () => {
const modelStore = getPiniaModelStore()
if (modelStore) {
await modelStore.loadRuntimeModels?.()
return [...modelStore.allImageModels, ...modelStore.allVideoModels, ...modelStore.allChatModels]
}
const modelConfig = getModelConfigHook() const modelConfig = getModelConfigHook()
if (modelConfig) { if (modelConfig) {
return [...modelConfig.allImageModels.value, ...modelConfig.allVideoModels.value, ...modelConfig.allChatModels.value] return [...modelConfig.allImageModels.value, ...modelConfig.allVideoModels.value, ...modelConfig.allChatModels.value]
@@ -53,6 +67,12 @@ export const loadAllModels = async () => {
* Get model config by name | 根据名称获取模型配置 * Get model config by name | 根据名称获取模型配置
*/ */
export const getModelConfig = (modelKey) => { export const getModelConfig = (modelKey) => {
const modelStore = getPiniaModelStore()
if (modelStore) {
return modelStore.getImageModel(modelKey) ||
modelStore.getVideoModel(modelKey) ||
modelStore.getChatModel(modelKey)
}
const modelConfig = getModelConfigHook() const modelConfig = getModelConfigHook()
if (modelConfig) { if (modelConfig) {
return modelConfig.getImageModel(modelKey) || return modelConfig.getImageModel(modelKey) ||
@@ -68,7 +88,7 @@ export const getModelConfig = (modelKey) => {
* Returns options based on model's sizes array and quality * Returns options based on model's sizes array and quality
*/ */
export const getModelSizeOptions = (modelKey, quality = 'standard') => { 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) { if (model?.sizeOptions) {
return model.sizeOptions return model.sizeOptions
@@ -93,7 +113,7 @@ export const getModelSizeOptions = (modelKey, quality = 'standard') => {
* Get quality options for image model | 获取图片模型画质选项 * Get quality options for image model | 获取图片模型画质选项
*/ */
export const getModelQualityOptions = (modelKey) => { 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 || [] return model?.qualities || []
} }

View File

@@ -319,7 +319,6 @@ const isApiConfigured = computed(() => !!modelStore.currentApiKey)
// Initialize models on page load | 页面加载时初始化模型 // Initialize models on page load | 页面加载时初始化模型
onMounted(() => { onMounted(() => {
loadAllModels() loadAllModels()
modelStore.loadRuntimeModels()
}) })
// Chat templates | 问答模板 // Chat templates | 问答模板