mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 13:01:59 +03:00
chore: bump version (#2787)
This commit is contained in:
parent
18fad62f5c
commit
5164c8c1f9
@ -41,18 +41,18 @@
|
||||
"@electron-forge/maker-squirrel": "^6.1.1",
|
||||
"@electron-forge/maker-zip": "^6.1.1",
|
||||
"@electron-forge/shared-types": "^6.1.1",
|
||||
"@electron/remote": "2.0.9",
|
||||
"@electron/remote": "2.0.10",
|
||||
"@toeverything/infra": "workspace:*",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"cross-env": "7.0.3",
|
||||
"electron": "=25.0.1",
|
||||
"electron": "^25.1.1",
|
||||
"electron-log": "^5.0.0-beta.24",
|
||||
"electron-squirrel-startup": "1.0.0",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"esbuild": "^0.17.19",
|
||||
"esbuild": "^0.18.2",
|
||||
"fs-extra": "^11.1.1",
|
||||
"jotai": "^2.1.1",
|
||||
"jotai": "^2.2.0",
|
||||
"playwright": "=1.33.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"undici": "^5.22.1",
|
||||
@ -68,7 +68,7 @@
|
||||
"lodash-es": "^4.17.21",
|
||||
"nanoid": "^4.0.2",
|
||||
"rxjs": "^7.8.1",
|
||||
"yjs": "^13.6.1"
|
||||
"yjs": "^13.6.2"
|
||||
},
|
||||
"build": {
|
||||
"protocols": [
|
||||
|
@ -14,12 +14,12 @@
|
||||
"postinstall": "prisma generate"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/server": "^4.7.1",
|
||||
"@apollo/server": "^4.7.3",
|
||||
"@nestjs/apollo": "^11.0.6",
|
||||
"@nestjs/common": "^9.4.2",
|
||||
"@nestjs/core": "^9.4.2",
|
||||
"@nestjs/common": "^9.4.3",
|
||||
"@nestjs/core": "^9.4.3",
|
||||
"@nestjs/graphql": "^11.0.6",
|
||||
"@nestjs/platform-express": "^9.4.2",
|
||||
"@nestjs/platform-express": "^9.4.3",
|
||||
"@node-rs/bcrypt": "^1.7.1",
|
||||
"@prisma/client": "^4.15.0",
|
||||
"dotenv": "^16.1.4",
|
||||
@ -33,18 +33,18 @@
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/testing": "^9.4.2",
|
||||
"@nestjs/testing": "^9.4.3",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/jsonwebtoken": "^9.0.2",
|
||||
"@types/lodash-es": "^4.17.7",
|
||||
"@types/node": "^18.16.16",
|
||||
"@types/node": "^18.16.18",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"c8": "^7.14.0",
|
||||
"c8": "^8.0.0",
|
||||
"nodemon": "^2.0.22",
|
||||
"supertest": "^6.3.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.1.3",
|
||||
"vitest": "^0.31.4"
|
||||
"vitest": "^0.32.0"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"exec": "node",
|
||||
|
@ -28,57 +28,57 @@
|
||||
"@dnd-kit/core": "^6.0.8",
|
||||
"@dnd-kit/sortable": "^7.0.2",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/react": "^11.11.0",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@mui/material": "^5.13.3",
|
||||
"@mui/material": "^5.13.5",
|
||||
"@react-hookz/web": "^23.0.1",
|
||||
"@sentry/nextjs": "^7.54.0",
|
||||
"@sentry/nextjs": "^7.55.2",
|
||||
"@toeverything/hooks": "workspace:*",
|
||||
"@toeverything/infra": "workspace:*",
|
||||
"@toeverything/plugin-infra": "workspace:*",
|
||||
"cmdk": "^0.2.0",
|
||||
"css-spring": "^4.1.0",
|
||||
"graphql": "^16.6.0",
|
||||
"jotai": "^2.1.1",
|
||||
"jotai": "^2.2.0",
|
||||
"jotai-devtools": "^0.5.3",
|
||||
"lit": "^2.7.5",
|
||||
"lottie-web": "^5.12.0",
|
||||
"lottie-web": "^5.12.2",
|
||||
"next-themes": "^0.2.1",
|
||||
"react": "18.3.0-canary-16d053d59-20230506",
|
||||
"react-dom": "18.3.0-canary-16d053d59-20230506",
|
||||
"react-is": "^18.2.0",
|
||||
"react-resizable-panels": "^0.0.48",
|
||||
"react-resizable-panels": "^0.0.51",
|
||||
"rxjs": "^7.8.1",
|
||||
"swr": "^2.1.5",
|
||||
"y-protocols": "^1.0.5",
|
||||
"yjs": "^13.6.1",
|
||||
"yjs": "^13.6.2",
|
||||
"zod": "^3.21.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@perfsee/webpack": "^1.8.1",
|
||||
"@perfsee/webpack": "^1.8.2",
|
||||
"@redux-devtools/extension": "^3.2.5",
|
||||
"@rich-data/viewer": "^2.15.6",
|
||||
"@sentry/webpack-plugin": "^1.20.1",
|
||||
"@swc-jotai/debug-label": "^0.0.10",
|
||||
"@swc-jotai/react-refresh": "^0.0.8",
|
||||
"@types/react": "^18.2.6",
|
||||
"@types/react-dom": "^18.2.4",
|
||||
"@types/react": "^18.2.12",
|
||||
"@types/react-dom": "^18.2.5",
|
||||
"@types/webpack-env": "^1.18.1",
|
||||
"@vanilla-extract/css": "^1.11.0",
|
||||
"@vanilla-extract/css": "^1.11.1",
|
||||
"@vanilla-extract/next-plugin": "=2.1.2",
|
||||
"dotenv": "^16.1.4",
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-next": "^13.4.4",
|
||||
"eslint-config-next": "^13.4.5",
|
||||
"eslint-plugin-unicorn": "^47.0.0",
|
||||
"next": "=13.4.2",
|
||||
"next-debug-local": "^0.1.5",
|
||||
"next-router-mock": "^0.9.3",
|
||||
"next-router-mock": "^0.9.6",
|
||||
"raw-loader": "^4.0.2",
|
||||
"redux": "^4.2.1",
|
||||
"swc-plugin-coverage-instrument": "^0.0.18",
|
||||
"typescript": "^5.1.3",
|
||||
"webpack": "^5.85.0"
|
||||
"webpack": "^5.87.0"
|
||||
},
|
||||
"stableVersion": "0.0.0"
|
||||
}
|
||||
|
18
package.json
18
package.json
@ -51,20 +51,20 @@
|
||||
"@faker-js/faker": "^8.0.2",
|
||||
"@istanbuljs/schema": "^0.1.3",
|
||||
"@magic-works/i18n-codegen": "^0.5.0",
|
||||
"@perfsee/sdk": "^1.8.1",
|
||||
"@perfsee/sdk": "^1.8.2",
|
||||
"@playwright/test": "=1.33.0",
|
||||
"@taplo/cli": "^0.5.2",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@toeverything/infra": "workspace:*",
|
||||
"@toeverything/plugin-infra": "workspace:*",
|
||||
"@types/eslint": "^8.40.0",
|
||||
"@types/node": "^18.16.16",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
||||
"@typescript-eslint/parser": "^5.59.8",
|
||||
"@types/eslint": "^8.40.2",
|
||||
"@types/node": "^18.16.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
||||
"@typescript-eslint/parser": "^5.59.11",
|
||||
"@vanilla-extract/vite-plugin": "^3.8.2",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"@vitest/coverage-istanbul": "^0.31.4",
|
||||
"@vitest/ui": "^0.31.4",
|
||||
"@vitest/coverage-istanbul": "^0.32.0",
|
||||
"@vitest/ui": "^0.32.0",
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
@ -80,7 +80,7 @@
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^13.2.2",
|
||||
"madge": "^6.1.0",
|
||||
"msw": "^1.2.1",
|
||||
"msw": "^1.2.2",
|
||||
"nanoid": "^4.0.2",
|
||||
"nx": "16.3.2",
|
||||
"nyc": "^15.1.0",
|
||||
@ -92,7 +92,7 @@
|
||||
"vite": "^4.3.9",
|
||||
"vite-plugin-istanbul": "^4.1.0",
|
||||
"vite-tsconfig-paths": "^4.2.0",
|
||||
"vitest": "^0.31.4",
|
||||
"vitest": "^0.32.0",
|
||||
"vitest-fetch-mock": "^0.2.2",
|
||||
"vitest-mock-extended": "^1.1.3"
|
||||
},
|
||||
|
@ -23,12 +23,12 @@
|
||||
"@dnd-kit/core": "^6.0.8",
|
||||
"@dnd-kit/sortable": "^7.0.2",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/react": "^11.11.0",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@mui/base": "5.0.0-beta.3",
|
||||
"@mui/base": "5.0.0-beta.4",
|
||||
"@mui/icons-material": "^5.11.16",
|
||||
"@mui/material": "^5.13.3",
|
||||
"@mui/material": "^5.13.5",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@radix-ui/react-avatar": "^1.0.3",
|
||||
"@radix-ui/react-collapsible": "^1.0.3",
|
||||
@ -40,13 +40,13 @@
|
||||
"@vanilla-extract/dynamic": "^2.0.3",
|
||||
"clsx": "^1.2.1",
|
||||
"dayjs": "^1.11.8",
|
||||
"jotai": "^2.1.1",
|
||||
"jotai": "^2.2.0",
|
||||
"lit": "^2.7.5",
|
||||
"lottie-web": "^5.12.0",
|
||||
"lottie-web": "^5.12.2",
|
||||
"react": "18.3.0-canary-16d053d59-20230506",
|
||||
"react-datepicker": "^4.12.0",
|
||||
"react-datepicker": "^4.13.0",
|
||||
"react-dom": "18.3.0-canary-16d053d59-20230506",
|
||||
"react-error-boundary": "^4.0.9",
|
||||
"react-error-boundary": "^4.0.10",
|
||||
"react-is": "^18.2.0",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
@ -57,14 +57,14 @@
|
||||
"@blocksuite/icons": "^2.1.19",
|
||||
"@blocksuite/lit": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"@blocksuite/store": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"@types/react": "^18.2.6",
|
||||
"@types/react": "^18.2.12",
|
||||
"@types/react-datepicker": "^4.11.2",
|
||||
"@types/react-dnd": "^3.0.2",
|
||||
"@types/react-dom": "18.2.4",
|
||||
"@vanilla-extract/css": "^1.11.0",
|
||||
"@types/react-dom": "18.2.5",
|
||||
"@vanilla-extract/css": "^1.11.1",
|
||||
"typescript": "^5.1.3",
|
||||
"vite": "^4.3.9",
|
||||
"yjs": "^13.6.1"
|
||||
"yjs": "^13.6.2"
|
||||
},
|
||||
"version": "0.7.0-canary.17"
|
||||
}
|
||||
|
@ -26,11 +26,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/debug": "workspace:*",
|
||||
"i18next": "^22.5.0",
|
||||
"i18next": "^22.5.1",
|
||||
"react-i18next": "^12.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.16.16",
|
||||
"@types/node": "^18.16.18",
|
||||
"@types/prettier": "^2.7.3",
|
||||
"prettier": "^2.8.8",
|
||||
"ts-node": "^10.9.1",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"jotai": "^2.1.1"
|
||||
"jotai": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/blocks": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
@ -11,7 +11,7 @@
|
||||
"@blocksuite/global": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"@blocksuite/store": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"lottie-web": "^5.12.0"
|
||||
"lottie-web": "^5.12.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@blocksuite/blocks": "*",
|
||||
|
@ -16,8 +16,8 @@
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "^2.16.1",
|
||||
"@types/node": "^18.16.16",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@types/node": "^18.16.18",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"rxjs": "^7.8.1",
|
||||
"ts-node": "^10.9.1",
|
||||
|
@ -23,10 +23,10 @@
|
||||
"@blocksuite/global": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"@blocksuite/store": "0.0.0-20230607055421-9b20fcaf-nightly",
|
||||
"jotai": "^2.1.1"
|
||||
"jotai": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jotai": "^2.1.1",
|
||||
"jotai": "^2.2.0",
|
||||
"vite": "^4.3.9",
|
||||
"vite-plugin-dts": "^2.3.0"
|
||||
},
|
||||
|
@ -9,23 +9,23 @@
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@storybook/addon-actions": "^7.0.18",
|
||||
"@storybook/addon-essentials": "^7.0.18",
|
||||
"@storybook/addon-interactions": "^7.0.18",
|
||||
"@storybook/addon-links": "^7.0.18",
|
||||
"@storybook/addon-storysource": "^7.0.18",
|
||||
"@storybook/blocks": "^7.0.18",
|
||||
"@storybook/builder-vite": "^7.0.18",
|
||||
"@storybook/addon-actions": "^7.0.20",
|
||||
"@storybook/addon-essentials": "^7.0.20",
|
||||
"@storybook/addon-interactions": "^7.0.20",
|
||||
"@storybook/addon-links": "^7.0.20",
|
||||
"@storybook/addon-storysource": "^7.0.20",
|
||||
"@storybook/blocks": "^7.0.20",
|
||||
"@storybook/builder-vite": "^7.0.20",
|
||||
"@storybook/jest": "^0.1.0",
|
||||
"@storybook/react": "^7.0.18",
|
||||
"@storybook/react-vite": "^7.0.18",
|
||||
"@storybook/react": "^7.0.20",
|
||||
"@storybook/react-vite": "^7.0.20",
|
||||
"@storybook/test-runner": "^0.10.0",
|
||||
"@storybook/testing-library": "^0.1.0",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"concurrently": "^8.1.0",
|
||||
"concurrently": "^8.2.0",
|
||||
"jest-mock": "^29.5.0",
|
||||
"serve": "^14.2.0",
|
||||
"storybook": "^7.0.18",
|
||||
"storybook": "^7.0.20",
|
||||
"storybook-dark-mode": "^3.0.0",
|
||||
"wait-on": "^7.0.1"
|
||||
},
|
||||
|
@ -24,19 +24,19 @@
|
||||
"@toeverything/hooks": "workspace:*",
|
||||
"@toeverything/plugin-infra": "workspace:*",
|
||||
"@toeverything/y-indexeddb": "workspace:*",
|
||||
"firebase": "^9.22.1",
|
||||
"jotai": "^2.1.1",
|
||||
"firebase": "^9.22.2",
|
||||
"jotai": "^2.2.0",
|
||||
"js-base64": "^3.7.5",
|
||||
"ky": "^0.33.3",
|
||||
"lib0": "^0.2.78",
|
||||
"react": "18.3.0-canary-16d053d59-20230506",
|
||||
"react-dom": "18.3.0-canary-16d053d59-20230506",
|
||||
"y-protocols": "^1.0.5",
|
||||
"yjs": "^13.6.1",
|
||||
"yjs": "^13.6.2",
|
||||
"zod": "^3.21.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ws": "^8.5.4",
|
||||
"@types/ws": "^8.5.5",
|
||||
"next": "=13.4.2",
|
||||
"ws": "^8.13.0"
|
||||
},
|
||||
|
@ -10,7 +10,7 @@
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
"@toeverything/plugin-infra": "workspace:*",
|
||||
"foxact": "^0.2.7",
|
||||
"foxact": "^0.2.8",
|
||||
"link-preview-js": "^3.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -9,17 +9,17 @@
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
"@toeverything/plugin-infra": "workspace:*",
|
||||
"langchain": "^0.0.92",
|
||||
"marked": "^5.0.4",
|
||||
"langchain": "^0.0.95",
|
||||
"marked": "^5.1.0",
|
||||
"marked-gfm-heading-id": "^3.0.4",
|
||||
"marked-mangle": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/marked": "^5.0.0",
|
||||
"@types/react": "^18.2.6",
|
||||
"@types/react-dom": "^18.2.4",
|
||||
"@types/react": "^18.2.12",
|
||||
"@types/react-dom": "^18.2.5",
|
||||
"idb": "^7.1.1",
|
||||
"jotai": "^2.1.1",
|
||||
"jotai": "^2.2.0",
|
||||
"react": "18.3.0-canary-16d053d59-20230506",
|
||||
"react-dom": "18.3.0-canary-16d053d59-20230506",
|
||||
"zod": "^3.21.4"
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
PromptTemplate,
|
||||
SystemMessagePromptTemplate,
|
||||
} from 'langchain/prompts';
|
||||
import { type LLMResult } from 'langchain/schema';
|
||||
|
||||
import { IndexedDBChatMessageHistory } from './langchain/message-history';
|
||||
import { chatPrompt, followupQuestionPrompt } from './prompts';
|
||||
@ -45,13 +44,7 @@ export async function createChatAI(
|
||||
openAIApiKey: openAIApiKey,
|
||||
callbacks: [
|
||||
{
|
||||
async handleLLMStart(
|
||||
llm: { name: string },
|
||||
prompts: string[],
|
||||
runId: string,
|
||||
parentRunId?: string,
|
||||
extraParams?: Record<string, unknown>
|
||||
) {
|
||||
async handleLLMStart(llm, prompts, runId, parentRunId, extraParams) {
|
||||
console.log(
|
||||
'handleLLMStart',
|
||||
llm,
|
||||
@ -62,21 +55,13 @@ export async function createChatAI(
|
||||
);
|
||||
window.dispatchEvent(new CustomEvent('llm-start'));
|
||||
},
|
||||
async handleLLMNewToken(
|
||||
token: string,
|
||||
runId: string,
|
||||
parentRunId?: string
|
||||
) {
|
||||
async handleLLMNewToken(token, runId, parentRunId) {
|
||||
console.log('handleLLMNewToken', token, runId, parentRunId);
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('llm-new-token', { detail: { token } })
|
||||
);
|
||||
},
|
||||
async handleLLMEnd(
|
||||
output: LLMResult,
|
||||
runId: string,
|
||||
parentRunId?: string
|
||||
) {
|
||||
async handleLLMEnd(output, runId, parentRunId) {
|
||||
console.log('handleLLMEnd', output, runId, parentRunId);
|
||||
},
|
||||
},
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { DBSchema, IDBPDatabase } from 'idb';
|
||||
import { openDB } from 'idb';
|
||||
import { ChatMessageHistory } from 'langchain/memory';
|
||||
import {
|
||||
AIChatMessage,
|
||||
type BaseChatMessage,
|
||||
BaseChatMessageHistory,
|
||||
ChatMessage,
|
||||
HumanChatMessage,
|
||||
type StoredMessage,
|
||||
@ -38,9 +38,9 @@ interface ChatMessageDBV2 extends ChatMessageDBV1 {
|
||||
|
||||
export const conversationHistoryDBName = 'affine-copilot-chat';
|
||||
|
||||
export class IndexedDBChatMessageHistory extends BaseChatMessageHistory {
|
||||
export class IndexedDBChatMessageHistory extends ChatMessageHistory {
|
||||
public id: string;
|
||||
private messages: BaseChatMessage[] = [];
|
||||
private chatMessages: BaseChatMessage[] = [];
|
||||
|
||||
private readonly dbPromise: Promise<IDBPDatabase<ChatMessageDBV2>>;
|
||||
private readonly initPromise: Promise<void>;
|
||||
@ -48,7 +48,7 @@ export class IndexedDBChatMessageHistory extends BaseChatMessageHistory {
|
||||
constructor(id: string) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.messages = [];
|
||||
this.chatMessages = [];
|
||||
this.dbPromise = openDB<ChatMessageDBV2>('affine-copilot-chat', 2, {
|
||||
upgrade(database, oldVersion) {
|
||||
if (oldVersion === 0) {
|
||||
@ -68,7 +68,7 @@ export class IndexedDBChatMessageHistory extends BaseChatMessageHistory {
|
||||
.objectStore('chat');
|
||||
const chat = await objectStore.get(id);
|
||||
if (chat != null) {
|
||||
this.messages = chat.messages.map(message => {
|
||||
this.chatMessages = chat.messages.map(message => {
|
||||
switch (message.type) {
|
||||
case 'ai':
|
||||
return new AIChatMessage(message.data.content);
|
||||
@ -112,9 +112,9 @@ export class IndexedDBChatMessageHistory extends BaseChatMessageHistory {
|
||||
return [];
|
||||
}
|
||||
|
||||
protected async addMessage(message: BaseChatMessage): Promise<void> {
|
||||
override async addMessage(message: BaseChatMessage): Promise<void> {
|
||||
await this.initPromise;
|
||||
this.messages.push(message);
|
||||
this.chatMessages.push(message);
|
||||
const db = await this.dbPromise;
|
||||
const objectStore = db.transaction('chat', 'readwrite').objectStore('chat');
|
||||
const chat = await objectStore.get(this.id);
|
||||
@ -129,23 +129,23 @@ export class IndexedDBChatMessageHistory extends BaseChatMessageHistory {
|
||||
}
|
||||
}
|
||||
|
||||
async addAIChatMessage(message: string): Promise<void> {
|
||||
override async addAIChatMessage(message: string): Promise<void> {
|
||||
await this.addMessage(new AIChatMessage(message));
|
||||
}
|
||||
|
||||
async addUserMessage(message: string): Promise<void> {
|
||||
override async addUserMessage(message: string): Promise<void> {
|
||||
await this.addMessage(new HumanChatMessage(message));
|
||||
}
|
||||
|
||||
async clear(): Promise<void> {
|
||||
override async clear(): Promise<void> {
|
||||
await this.initPromise;
|
||||
this.messages = [];
|
||||
this.chatMessages = [];
|
||||
const db = await this.dbPromise;
|
||||
const objectStore = db.transaction('chat', 'readwrite').objectStore('chat');
|
||||
await objectStore.delete(this.id);
|
||||
}
|
||||
|
||||
async getMessages(): Promise<BaseChatMessage[]> {
|
||||
return this.initPromise.then(() => this.messages);
|
||||
override async getMessages(): Promise<BaseChatMessage[]> {
|
||||
return this.initPromise.then(() => this.chatMessages);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user