Skip to content

Commit b298bb4

Browse files
authored
feat: support ai writer (#69)
* feat: support ai writer * feat: support duplicate page * feat: support upgrade AI Max
1 parent 04bcc78 commit b298bb4

File tree

79 files changed

+1570
-491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1570
-491
lines changed

cypress.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { defineConfig } from 'cypress';
2-
import registerCodeCoverageTasks from '@cypress/code-coverage/task';
3-
4-
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
52

63
export default defineConfig({
74
env: {
@@ -16,8 +13,6 @@ export default defineConfig({
1613
bundler: 'vite',
1714
},
1815
setupNodeEvents(on, config) {
19-
registerCodeCoverageTasks(on, config);
20-
addMatchImageSnapshotPlugin(on, config);
2116
return config;
2217
},
2318
supportFile: 'cypress/support/component.ts',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"coverage": "pnpm run test:unit && pnpm run test:components"
1919
},
2020
"dependencies": {
21-
"@appflowyinc/ai-chat": "0.0.15",
22-
"@appflowyinc/editor": "^0.1.6",
21+
"@appflowyinc/ai-chat": "0.1.24",
22+
"@appflowyinc/editor": "^0.1.10",
2323
"@atlaskit/primitives": "^5.5.3",
2424
"@emoji-mart/data": "^1.1.2",
2525
"@emoji-mart/react": "^1.1.1",

pnpm-lock.yaml

Lines changed: 129 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/@types/translations/en.json

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@
264264
"questionBubble": {
265265
"shortcuts": "Shortcuts",
266266
"whatsNew": "What's new?",
267-
"help": "Help & Support",
267+
"documentation": "Help & documentation",
268+
"help": "Get support",
268269
"markdown": "Markdown",
269270
"debug": {
270271
"name": "Debug Info",
@@ -1687,7 +1688,9 @@
16871688
"aiWriter": "AI Writer",
16881689
"dateOrReminder": "Date or Reminder",
16891690
"photoGallery": "Photo Gallery",
1690-
"file": "File"
1691+
"file": "File",
1692+
"continueWriting": "Continue Writing",
1693+
"askAIAnything": "Ask AI Anything"
16911694
},
16921695
"subPage": {
16931696
"name": "Document",
@@ -2446,7 +2449,9 @@
24462449
"toggleListShortForm": "Toggle",
24472450
"quoteListShortForm": "Quote",
24482451
"mathEquationShortForm": "Formula",
2449-
"codeBlockShortForm": "Code"
2452+
"codeBlockShortForm": "Code",
2453+
"improveWriting": "Improve writing",
2454+
"askAI": "Ask AI Anything"
24502455
},
24512456
"favorite": {
24522457
"noFavorite": "No favorite page",
@@ -2978,6 +2983,21 @@
29782983
"priceIn": "Price in ",
29792984
"free": "Free",
29802985
"pro": "Pro",
2986+
"getAIMax": "Get AI Max",
2987+
"upgradeAIMax": "Upgrade to AI Max",
2988+
"unlock": "Unlock",
2989+
"AIMax": {
2990+
"label": "AI Max",
2991+
"removeTitle": "Remove AI Max",
2992+
"removeDescription": "Are you sure you want to remove AI Max? You will lose access to the features and benefits of AI Max immediately.",
2993+
"description": "Access the most advanced AI models including GPT-4o, GPT-o3-mini, DeepSeek R1, and Claude 3.5 Sonnet",
2994+
"pricing": "per member per month\nbilled annually",
2995+
"points": {
2996+
"first": "Unlimited AI responses",
2997+
"second": "Unlimited file uploads",
2998+
"third": "50 AI images per month"
2999+
}
3000+
},
29813001
"freeDescription": "For individuals up to 2 members to organize everything",
29823002
"proDescription": "For small teams to manage projects and team knowledge",
29833003
"proDuration": {
@@ -2995,15 +3015,17 @@
29953015
"three": "5 GB storage",
29963016
"four": "Intelligent search",
29973017
"five": "10 AI responses",
2998-
"six": "Mobile app",
2999-
"seven": "Real-time collaboration"
3018+
"six": "2 AI images",
3019+
"seven": "Mobile app",
3020+
"eight": "Real-time collaboration"
30003021
},
30013022
"proPoints": {
30023023
"first": "Unlimited storage",
30033024
"second": "Up to 10 workspace members",
30043025
"three": "Unlimited AI responses",
3005-
"four": "Unlimited file uploads",
3006-
"five": "Custom namespace"
3026+
"four": "10 AI images per month",
3027+
"five": "Unlimited file uploads",
3028+
"six": "Custom namespace"
30073029
},
30083030
"cancelPlan": {
30093031
"title": "Sorry to see you go",

src/application/database-yjs/__tests__/selector.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const wrapperCreator =
3535
databaseDoc={doc}
3636
rowDocMap={rowDocMap}
3737
readOnly={true}
38+
workspaceId={''}
3839
>
3940
{children}
4041
</DatabaseContextProvider>

src/application/database-yjs/context.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ export interface DatabaseContextState {
2626
navigateToView?: (viewId: string, blockId?: string) => Promise<void>;
2727
onRendered?: (height: number) => void;
2828
showActions?: boolean;
29+
workspaceId: string;
2930
}
3031

3132
export const DatabaseContext = createContext<DatabaseContextState | null>(null);
3233

3334
export const useDatabaseContext = () => {
3435
const context = useContext(DatabaseContext);
3536

36-
if (!context) {
37+
if(!context) {
3738
throw new Error('DatabaseContext is not provided');
3839
}
3940

@@ -89,7 +90,7 @@ export const useDatabaseView = () => {
8990
return viewId ? database?.get(YjsDatabaseKey.views)?.get(viewId) : undefined;
9091
};
9192

92-
export function useDatabaseFields () {
93+
export function useDatabaseFields() {
9394
const database = useDatabase();
9495

9596
return database.get(YjsDatabaseKey.fields);

src/application/services/js-services/http/http_api.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ export async function getChatMessages(workspaceId: string, chatId: string, limit
18551855
data?: RepeatedChatMessage;
18561856
message: string;
18571857
}>(url, {
1858-
params: { limit: limit},
1858+
params: { limit: limit },
18591859
});
18601860

18611861
const data = response?.data;
@@ -1866,3 +1866,17 @@ export async function getChatMessages(workspaceId: string, chatId: string, limit
18661866

18671867
return Promise.reject(data);
18681868
}
1869+
1870+
export async function duplicatePage(workspaceId: string, viewId: string) {
1871+
const url = `/api/workspace/${workspaceId}/page-view/${viewId}/duplicate`;
1872+
const response = await axiosInstance?.post<{
1873+
code: number;
1874+
message: string;
1875+
}>(url, {});
1876+
1877+
if(response?.data.code === 0) {
1878+
return;
1879+
}
1880+
1881+
return Promise.reject(response?.data);
1882+
}

0 commit comments

Comments
 (0)