mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
chore: update dexie v4(#342)
This commit is contained in:
parent
b6a96f73a2
commit
302c8206fb
@ -70,7 +70,7 @@ A. 大家都知道,对于一般的插件/库而言,一个封装好的npm包
|
||||
|
||||
#### Q. 关于 AI PPT
|
||||
|
||||
A. 我不想蹭AI的热度,但无奈太多人将AI看得太重了,于是我做了这个DEMO(它真的没那么复杂),目前此功能仅作参考,内部实现了最基础的AIPPT生成逻辑,即:模板定制 + AI生成数据与模板结合 + 配图替换。为控制成本暂时只能做到这里,但为了达到生产环节的效果,你还需要做更多,例如更多的模板、更细致的AI工作流程。
|
||||
A. 首先需要说明,AIPPT不是PPTist的重点,现在或以后都不是,它只是PPTist众多功能中非常小的一部分而已,并且是比较简单一部分,你可以理解为这只是一个跟风的小功能点,我不想蹭AI的热度,但无奈太多人将AI看得太重要太复杂了,于是我做了这个DEMO(它真的没那么复杂),目前此功能仅作参考,内部实现了最基础的AIPPT生成逻辑,即:模板定制 + AI生成数据与模板结合 + 配图替换。为控制成本暂时只能做到这里,但为了达到生产环节的效果,你还需要做更多,例如更多的模板、更细致的AI工作流程。
|
||||
|
||||
注:配图替换仅提供方法,不提供实际演示功能,你需要自己提供图片源接入(如AI文生图、图库搜索匹配等方法)
|
||||
|
||||
|
17
package-lock.json
generated
17
package-lock.json
generated
@ -13,7 +13,7 @@
|
||||
"axios": "^1.7.9",
|
||||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dexie": "3.0.3",
|
||||
"dexie": "^4.0.11",
|
||||
"echarts": "^5.5.1",
|
||||
"file-saver": "^2.0.5",
|
||||
"hfmath": "^0.0.2",
|
||||
@ -2301,12 +2301,9 @@
|
||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
|
||||
},
|
||||
"node_modules/dexie": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/dexie/-/dexie-3.0.3.tgz",
|
||||
"integrity": "sha512-BSFhGpngnCl1DOr+8YNwBDobRMH0ziJs2vts69VilwetHYOtEDcLqo7d/XiIphM0tJZ2rPPyAGd31lgH2Ln3nw==",
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
}
|
||||
"version": "4.0.11",
|
||||
"resolved": "https://registry.npmmirror.com/dexie/-/dexie-4.0.11.tgz",
|
||||
"integrity": "sha512-SOKO002EqlvBYYKQSew3iymBoN2EQ4BDw/3yprjh7kAfFzjBYkaMNa/pZvcA7HSWlcKSQb9XhPe3wKyQ0x4A8A=="
|
||||
},
|
||||
"node_modules/dir-glob": {
|
||||
"version": "3.0.1",
|
||||
@ -6947,9 +6944,9 @@
|
||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
|
||||
},
|
||||
"dexie": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/dexie/-/dexie-3.0.3.tgz",
|
||||
"integrity": "sha512-BSFhGpngnCl1DOr+8YNwBDobRMH0ziJs2vts69VilwetHYOtEDcLqo7d/XiIphM0tJZ2rPPyAGd31lgH2Ln3nw=="
|
||||
"version": "4.0.11",
|
||||
"resolved": "https://registry.npmmirror.com/dexie/-/dexie-4.0.11.tgz",
|
||||
"integrity": "sha512-SOKO002EqlvBYYKQSew3iymBoN2EQ4BDw/3yprjh7kAfFzjBYkaMNa/pZvcA7HSWlcKSQb9XhPe3wKyQ0x4A8A=="
|
||||
},
|
||||
"dir-glob": {
|
||||
"version": "3.0.1",
|
||||
|
@ -18,7 +18,7 @@
|
||||
"axios": "^1.7.9",
|
||||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dexie": "3.0.3",
|
||||
"dexie": "^4.0.11",
|
||||
"echarts": "^5.5.1",
|
||||
"file-saver": "^2.0.5",
|
||||
"hfmath": "^0.0.2",
|
||||
|
@ -38,7 +38,7 @@ export const useSnapshotStore = defineStore('snapshot', {
|
||||
|
||||
const newFirstSnapshot = {
|
||||
index: slidesStore.slideIndex,
|
||||
slides: slidesStore.slides,
|
||||
slides: JSON.parse(JSON.stringify(slidesStore.slides)),
|
||||
}
|
||||
await db.snapshots.add(newFirstSnapshot)
|
||||
this.setSnapshotCursor(0)
|
||||
@ -63,7 +63,7 @@ export const useSnapshotStore = defineStore('snapshot', {
|
||||
// 添加新快照
|
||||
const snapshot = {
|
||||
index: slidesStore.slideIndex,
|
||||
slides: slidesStore.slides,
|
||||
slides: JSON.parse(JSON.stringify(slidesStore.slides)),
|
||||
}
|
||||
await db.snapshots.add(snapshot)
|
||||
|
||||
@ -83,7 +83,7 @@ export const useSnapshotStore = defineStore('snapshot', {
|
||||
db.snapshots.update(allKeys[snapshotLength - 2] as number, { index: slidesStore.slideIndex })
|
||||
}
|
||||
|
||||
await db.snapshots.bulkDelete(needDeleteKeys)
|
||||
await db.snapshots.bulkDelete(needDeleteKeys as number[])
|
||||
|
||||
this.setSnapshotCursor(snapshotLength - 1)
|
||||
this.setSnapshotLength(snapshotLength)
|
||||
|
@ -1,14 +1,15 @@
|
||||
import Dexie from 'dexie'
|
||||
import Dexie, { type EntityTable } from 'dexie'
|
||||
import { databaseId } from '@/store/main'
|
||||
import type { Slide } from '@/types/slides'
|
||||
import { LOCALSTORAGE_KEY_DISCARDED_DB } from '@/configs/storage'
|
||||
|
||||
export interface writingBoardImg {
|
||||
id: string
|
||||
id: number
|
||||
dataURL: string
|
||||
}
|
||||
|
||||
export interface Snapshot {
|
||||
id: number
|
||||
index: number
|
||||
slides: Slide[]
|
||||
}
|
||||
@ -41,19 +42,14 @@ export const deleteDiscardedDB = async () => {
|
||||
localStorage.removeItem(LOCALSTORAGE_KEY_DISCARDED_DB)
|
||||
}
|
||||
|
||||
class PPTistDB extends Dexie {
|
||||
public snapshots: Dexie.Table<Snapshot, number>
|
||||
public writingBoardImgs: Dexie.Table<writingBoardImg, number>
|
||||
|
||||
public constructor() {
|
||||
super(`${databaseNamePrefix}_${databaseId}_${new Date().getTime()}`)
|
||||
this.version(1).stores({
|
||||
snapshots: '++id',
|
||||
writingBoardImgs: '++id',
|
||||
})
|
||||
this.snapshots = this.table('snapshots')
|
||||
this.writingBoardImgs = this.table('writingBoardImgs')
|
||||
}
|
||||
const db = new Dexie(`${databaseNamePrefix}_${databaseId}_${new Date().getTime()}`) as Dexie & {
|
||||
snapshots: EntityTable<Snapshot, 'id'>,
|
||||
writingBoardImgs: EntityTable<writingBoardImg, 'id'>,
|
||||
}
|
||||
|
||||
export const db = new PPTistDB()
|
||||
db.version(1).stores({
|
||||
snapshots: '++id',
|
||||
writingBoardImgs: '++id',
|
||||
})
|
||||
|
||||
export { db }
|
Loading…
x
Reference in New Issue
Block a user