There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: increase image limit of copilot (#7756)
darkskygit5872b884a5ed
diff --git a/packages/backend/server/src/app.ts b/packages/backend/server/src/app.tsindex f8d1d88d60..07e4dbf1f7 100644--- a/packages/backend/server/src/app.ts+++ b/packages/backend/server/src/app.ts@@ -29,7 +29,7 @@ export async function createApp() {graphqlUploadExpress({// TODO(@darkskygit): dynamic limit by quota maybe?maxFileSize: 100 * 1024 * 1024,- maxFiles: 5,+ maxFiles: 32,}));diff --git a/packages/backend/server/src/plugins/copilot/providers/openai.ts b/packages/backend/server/src/plugins/copilot/providers/openai.tsindex 2c5edf0106..4bc8aedf64 100644--- a/packages/backend/server/src/plugins/copilot/providers/openai.ts+++ b/packages/backend/server/src/plugins/copilot/providers/openai.ts@@ -233,6 +233,7 @@ export class OpenAIProvideroptions: CopilotChatOptions = {}): AsyncIterable<string> {this.checkParams({ messages, model, options });+try {const result = await this.instance.chat.completions.create({diff --git a/packages/backend/server/src/plugins/copilot/session.ts b/packages/backend/server/src/plugins/copilot/session.tsindex a7f4424657..604cffec5b 100644--- a/packages/backend/server/src/plugins/copilot/session.ts+++ b/packages/backend/server/src/plugins/copilot/session.ts@@ -283,7 +283,13 @@ export class ChatSessionService {docId: true,parentSessionId: true,messages: {- select: { id: true, role: true, content: true, createdAt: true },+ select: {+ id: true,+ role: true,+ content: true,+ attachments: true,+ createdAt: true,+ },orderBy: { createdAt: 'asc' },},promptName: true,diff --git a/packages/backend/server/tests/copilot.spec.ts b/packages/backend/server/tests/copilot.spec.tsindex 1f488ec887..941b962699 100644--- a/packages/backend/server/tests/copilot.spec.ts+++ b/packages/backend/server/tests/copilot.spec.ts@@ -246,14 +246,16 @@ test('should be able to manage chat session', async t => {const s1 = (await session.get(sessionId))!;t.deepEqual(- // @ts-expect-error- s1.finish(params).map(({ id: _, createdAt: __, ...m }) => m),+ s1+ .finish(params)+ // @ts-expect-error+ .map(({ id: _, attachments: __, createdAt: ___, ...m }) => m),finalMessages,'should same as before message');t.deepEqual(// @ts-expect-error- s1.finish({}).map(({ id: _, createdAt: __, ...m }) => m),+ s1.finish({}).map(({ id: _, attachments: __, createdAt: ___, ...m }) => m),[{ content: 'hello ', params: {}, role: 'system' },{ content: 'hello', role: 'user' },@@ -325,7 +327,7 @@ test('should be able to fork chat session', async t => {const finalMessages = s2.finish(params) // @ts-expect-error- .map(({ id: _, createdAt: __, ...m }) => m);+ .map(({ id: _, attachments: __, createdAt: ___, ...m }) => m);t.deepEqual(finalMessages,[@@ -346,7 +348,7 @@ test('should be able to fork chat session', async t => {const finalMessages = s2.finish(params) // @ts-expect-error- .map(({ id: _, createdAt: __, ...m }) => m);+ .map(({ id: _, attachments: __, createdAt: ___, ...m }) => m);t.deepEqual(finalMessages,[@@ -364,7 +366,7 @@ test('should be able to fork chat session', async t => {const finalMessages = s3.finish(params) // @ts-expect-error- .map(({ id: _, createdAt: __, ...m }) => m);+ .map(({ id: _, attachments: __, createdAt: ___, ...m }) => m);t.deepEqual(finalMessages,[diff --git a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-input.ts b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-input.tsindex 6aac1f20dd..0122c5215e 100644--- a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-input.ts+++ b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-input.ts@@ -18,7 +18,7 @@ import { reportResponse } from '../utils/action-reporter';import { readBlobAsURL } from '../utils/image';import type { ChatContextValue, ChatMessage } from './chat-context';-const MaximumImageCount = 8;+const MaximumImageCount = 32;function getFirstTwoLines(text: string) {const lines = text.split('\n');