fix
This commit is contained in:
@@ -70,7 +70,7 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
|
||||
const location = useLocation()
|
||||
|
||||
interface FileMapType {
|
||||
imageFiles?: FileType[]
|
||||
imageFiles?: FileMetadata[]
|
||||
paths?: string[]
|
||||
}
|
||||
|
||||
@@ -195,19 +195,19 @@ const DmxapiPage: FC<{ Options: string[] }> = ({ Options }) => {
|
||||
const currentFiles = prevFileMap.imageFiles || []
|
||||
const currentPaths = prevFileMap.paths || []
|
||||
|
||||
let newFiles: FileType[]
|
||||
let newFiles: FileMetadata[]
|
||||
let newPaths: string[]
|
||||
|
||||
if (index !== undefined) {
|
||||
// 替换指定索引的图片
|
||||
newFiles = [...currentFiles]
|
||||
newFiles[index] = file as FileType
|
||||
newFiles[index] = file as FileMetadata
|
||||
|
||||
newPaths = [...currentPaths]
|
||||
newPaths[index] = path
|
||||
} else {
|
||||
// 添加新图片到最后
|
||||
newFiles = [...currentFiles, file as FileType]
|
||||
newFiles = [...currentFiles, file as FileMetadata]
|
||||
newPaths = [...currentPaths, path]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DeleteOutlined } from '@ant-design/icons'
|
||||
import IcImageUp from '@renderer/assets/images/paintings/ic_ImageUp.svg'
|
||||
import { useTheme } from '@renderer/context/ThemeProvider'
|
||||
import type { FileType } from '@renderer/types'
|
||||
import { FileMetadata } from '@renderer/types'
|
||||
import { Popconfirm, Upload } from 'antd'
|
||||
import { Button } from 'antd'
|
||||
import type { RcFile, UploadProps } from 'antd/es/upload'
|
||||
@@ -10,7 +10,7 @@ import styled from 'styled-components'
|
||||
|
||||
interface ImageUploaderProps {
|
||||
fileMap: {
|
||||
imageFiles?: FileType[]
|
||||
imageFiles?: FileMetadata[]
|
||||
paths?: string[]
|
||||
}
|
||||
maxImages: number
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CacheService } from '@renderer/services/CacheService'
|
||||
import { FileType, TokenFluxPainting } from '@renderer/types'
|
||||
import { FileMetadata, TokenFluxPainting } from '@renderer/types'
|
||||
|
||||
import type { TokenFluxModel } from '../config/tokenFluxConfig'
|
||||
|
||||
@@ -230,7 +230,7 @@ export class TokenFluxService {
|
||||
})
|
||||
)
|
||||
|
||||
return downloadedFiles.filter((file): file is FileType => file !== null)
|
||||
return downloadedFiles.filter((file): file is FileMetadata => file !== null)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ const persistedReducer = persistReducer(
|
||||
{
|
||||
key: 'cherry-studio',
|
||||
storage,
|
||||
version: 111,
|
||||
version: 112,
|
||||
blacklist: ['runtime', 'messages', 'messageBlocks'],
|
||||
migrate
|
||||
},
|
||||
|
||||
@@ -1563,7 +1563,7 @@ const migrateConfig = {
|
||||
return state
|
||||
}
|
||||
},
|
||||
'111': (state: RootState) => {
|
||||
'112': (state: RootState) => {
|
||||
try {
|
||||
if (!state.preprocess) {
|
||||
state.preprocess = {
|
||||
|
||||
@@ -201,7 +201,7 @@ export const cleanupMultipleBlocks = (dispatch: AppDispatch, blockIds: string[])
|
||||
return isEmpty(files) ? [] : files
|
||||
}
|
||||
|
||||
const cleanupFiles = async (files: FileType[]) => {
|
||||
const cleanupFiles = async (files: FileMetadata[]) => {
|
||||
await Promise.all(files.map((file) => FileManager.deleteFile(file.id, false)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user