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(core): not using Internet search after user selects document or file (#10058)
akumatus397887e3b504
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 3b1fc613cd..62a98b2f1d 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@@ -363,7 +363,10 @@ export class ChatPanelInput extends SignalWatcher(WithDisposable(LitElement)) {const { images, status } = this.chatContextValue;const hasImages = images.length > 0;const maxHeight = hasImages ? 272 + 2 : 200 + 2;- const networkDisabled = !!this.chatContextValue.images.length;+ const networkDisabled =+ !!this.chatContextValue.images.length ||+ !!this.chatContextValue.chips.filter(chip => chip.state !== 'candidate')+ .length;const networkActive = !!this.networkSearchConfig.enabled.value;const uploadDisabled = networkActive && !networkDisabled;return html`<style>diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsxindex d965ebe791..ee12ce4d9d 100644--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx@@ -51,8 +51,9 @@ export function setupAIProvider(globalDialogService: GlobalDialogService,networkSearchService: AINetworkSearchService) {- function getChatPrompt(attachments?: (string | File | Blob)[]) {- if (attachments?.length) {+ function getChatPrompt(options: BlockSuitePresets.ChatOptions) {+ const { attachments, docs } = options;+ if (attachments?.length || docs?.length) {return 'Chat With AFFiNE AI';}const { enabled, visible } = networkSearchService;@@ -60,19 +61,16 @@ export function setupAIProvider(? 'Search With AFFiNE AI': 'Chat With AFFiNE AI';}- async function getChatSessionId(- workspaceId: string,- docId: string,- attachments?: (string | File | Blob)[]- ) {+ async function getChatSessionId(options: BlockSuitePresets.ChatOptions) {const userId = (await AIProvider.userInfo)?.id;if (!userId) {throw new UnauthorizedError();}+ const { workspaceId, docId } = options;const storeKey = `${userId}:${workspaceId}:${docId}`;- const promptName = getChatPrompt(attachments);+ const promptName = getChatPrompt(options);if (!chatSessions.has(storeKey)) {chatSessions.set(storeKey, {getSessionId: createChatSession({@@ -114,9 +112,7 @@ export function setupAIProvider(//#region actionsAIProvider.provide('chat', options => {- const sessionId =- options.sessionId ??- getChatSessionId(options.workspaceId, options.docId, options.attachments);+ const sessionId = options.sessionId ?? getChatSessionId(options);const { input, docs, ...rest } = options;const params = docs?.length? {