mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-30 03:18:02 +08:00
feat: built in prompt libary (#15)
* feat: custom prompt * chore: update package.json
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
"generate-tokens": "node scripts/system-token/convert-tokens.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@appflowyinc/ai-chat": "0.1.26",
|
||||
"@appflowyinc/ai-chat": "0.1.30",
|
||||
"@appflowyinc/editor": "^0.1.10",
|
||||
"@atlaskit/pragmatic-drag-and-drop": "1.5.2",
|
||||
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "2.1.0",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
'@appflowyinc/ai-chat':
|
||||
specifier: 0.1.26
|
||||
version: 0.1.26(@appflowyinc/editor@0.1.10(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(slate-history@0.100.0(slate@0.101.5))(slate-react@0.101.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(slate@0.101.5))(slate@0.101.5)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5)))(@emotion/is-prop-valid@1.3.1)(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(axios@1.9.0)(dompurify@3.2.5)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5))
|
||||
specifier: 0.1.30
|
||||
version: 0.1.30(@appflowyinc/editor@0.1.10(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(slate-history@0.100.0(slate@0.101.5))(slate-react@0.101.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(slate@0.101.5))(slate@0.101.5)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5)))(@emotion/is-prop-valid@1.3.1)(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(axios@1.9.0)(dompurify@3.2.5)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5))
|
||||
'@appflowyinc/editor':
|
||||
specifier: ^0.1.10
|
||||
version: 0.1.10(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(slate-history@0.100.0(slate@0.101.5))(slate-react@0.101.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(slate@0.101.5))(slate@0.101.5)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5))
|
||||
@@ -632,8 +632,8 @@ packages:
|
||||
'@antfu/utils@8.1.1':
|
||||
resolution: {integrity: sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==}
|
||||
|
||||
'@appflowyinc/ai-chat@0.1.26':
|
||||
resolution: {integrity: sha512-qU40ZSSc5EK1Lo8g/ev7PryDwv4QOgMiGYJv8gE9ZSU6dmxfVn1G3WlR8hWM/e8np5jYq2f9T48S9wYjgIuFdg==}
|
||||
'@appflowyinc/ai-chat@0.1.30':
|
||||
resolution: {integrity: sha512-hSZk/q4g7pOWS3oAA8np+a2WMWmiQgEGUtLJGyj1hbUv6Y/rv4qHvvSz+yTzPOz9YFoypMgfryOGSaxMTr8F0w==}
|
||||
peerDependencies:
|
||||
'@appflowyinc/editor': ^0.1.7
|
||||
axios: ^1.7.9
|
||||
@@ -8718,7 +8718,7 @@ snapshots:
|
||||
|
||||
'@antfu/utils@8.1.1': {}
|
||||
|
||||
'@appflowyinc/ai-chat@0.1.26(@appflowyinc/editor@0.1.10(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(slate-history@0.100.0(slate@0.101.5))(slate-react@0.101.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(slate@0.101.5))(slate@0.101.5)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5)))(@emotion/is-prop-valid@1.3.1)(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(axios@1.9.0)(dompurify@3.2.5)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5))':
|
||||
'@appflowyinc/ai-chat@0.1.30(@appflowyinc/editor@0.1.10(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(slate-history@0.100.0(slate@0.101.5))(slate-react@0.101.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(slate@0.101.5))(slate@0.101.5)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5)))(@emotion/is-prop-valid@1.3.1)(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(axios@1.9.0)(dompurify@3.2.5)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5))':
|
||||
dependencies:
|
||||
'@appflowyinc/editor': 0.1.10(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(i18next-resources-to-backend@1.2.1)(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react-i18next@14.1.3(i18next@22.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(slate-history@0.100.0(slate@0.101.5))(slate-react@0.101.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(slate@0.101.5))(slate@0.101.5)(ts-node@10.9.2(@types/node@20.17.47)(typescript@4.9.5))
|
||||
'@jest/globals': 29.7.0
|
||||
@@ -8729,7 +8729,7 @@ snapshots:
|
||||
'@radix-ui/react-radio-group': 1.3.6(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@radix-ui/react-select': 2.2.4(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@radix-ui/react-separator': 1.1.6(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@radix-ui/react-slot': 1.2.2(@types/react@18.3.21)(react@18.3.1)
|
||||
'@radix-ui/react-slot': 1.2.3(@types/react@18.3.21)(react@18.3.1)
|
||||
'@radix-ui/react-switch': 1.2.4(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@radix-ui/react-toast': 1.2.13(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@radix-ui/react-tooltip': 1.2.6(@types/react-dom@18.3.7(@types/react@18.3.21))(@types/react@18.3.21)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
|
||||
@@ -10,7 +10,7 @@ import { getScrollParent } from '@/components/global-comment/utils';
|
||||
import { notify } from '@/components/_shared/notify';
|
||||
import '@appflowyinc/ai-chat/style';
|
||||
|
||||
import { AIAssistantProvider, ContextPlaceholder, WriterRequest } from '@appflowyinc/ai-chat';
|
||||
import { AIAssistantProvider, ContextPlaceholder, PromptModalProvider, WriterRequest } from '@appflowyinc/ai-chat';
|
||||
import { EditorData } from '@appflowyinc/editor';
|
||||
import { Portal } from '@mui/material';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
@@ -172,33 +172,35 @@ function EditorOverlay({ viewId, workspaceId }: { viewId: string; workspaceId: s
|
||||
|
||||
return (
|
||||
<ErrorBoundary fallbackRender={() => null}>
|
||||
<AIAssistantProvider
|
||||
isGlobalDocument={!isRange}
|
||||
onInsertBelow={handleInsertBelow}
|
||||
onReplace={handleReplaceSelection}
|
||||
request={writerRequest}
|
||||
viewId={viewId}
|
||||
onExit={handleExit}
|
||||
scrollContainer={scrollerContainer || undefined}
|
||||
>
|
||||
<Toolbars />
|
||||
<Panels />
|
||||
<BlockPopover />
|
||||
<Portal container={container}>
|
||||
{absoluteHeight ? (
|
||||
<div
|
||||
style={{
|
||||
transform: 'translateY(-' + absoluteHeight + 'px)',
|
||||
}}
|
||||
className={'flex w-full'}
|
||||
>
|
||||
<PromptModalProvider>
|
||||
<AIAssistantProvider
|
||||
isGlobalDocument={!isRange}
|
||||
onInsertBelow={handleInsertBelow}
|
||||
onReplace={handleReplaceSelection}
|
||||
request={writerRequest}
|
||||
viewId={viewId}
|
||||
onExit={handleExit}
|
||||
scrollContainer={scrollerContainer || undefined}
|
||||
>
|
||||
<Toolbars />
|
||||
<Panels />
|
||||
<BlockPopover />
|
||||
<Portal container={container}>
|
||||
{absoluteHeight ? (
|
||||
<div
|
||||
style={{
|
||||
transform: 'translateY(-' + absoluteHeight + 'px)',
|
||||
}}
|
||||
className={'flex w-full'}
|
||||
>
|
||||
<ContextPlaceholder />
|
||||
</div>
|
||||
) : (
|
||||
<ContextPlaceholder />
|
||||
</div>
|
||||
) : (
|
||||
<ContextPlaceholder />
|
||||
)}
|
||||
</Portal>
|
||||
</AIAssistantProvider>
|
||||
)}
|
||||
</Portal>
|
||||
</AIAssistantProvider>
|
||||
</PromptModalProvider>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user