diff --git a/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-input.ts b/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-input.ts
deleted file mode 100644
index d970b81a6a..0000000000
--- a/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-input.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-import { AIChatInput } from '../components/ai-chat-input';
-import type { ChatMessage } from '../components/ai-chat-messages';
-import { type AIError, AIProvider } from '../provider';
-import { readBlobAsURL } from '../utils/image';
-
-export class ChatPanelInput extends AIChatInput {
- send = async (text: string) => {
- const { status, markdown, images } = this.chatContextValue;
- if (status === 'loading' || status === 'transmitting') return;
- if (!text) return;
-
- try {
- const { doc } = this.host;
- const promptName = this.getPromptName();
-
- this.updateContext({
- images: [],
- status: 'loading',
- error: null,
- quote: '',
- markdown: '',
- });
-
- const attachments = await Promise.all(
- images?.map(image => readBlobAsURL(image))
- );
-
- const userInput = (markdown ? `${markdown}\n` : '') + text;
- this.updateContext({
- messages: [
- ...this.chatContextValue.messages,
- {
- id: '',
- role: 'user',
- content: userInput,
- createdAt: new Date().toISOString(),
- attachments,
- },
- {
- id: '',
- role: 'assistant',
- content: '',
- createdAt: new Date().toISOString(),
- },
- ],
- });
-
- // must update prompt name after local chat message is updated
- // otherwise, the unauthorized error can not be rendered properly
- await this.updatePromptName(promptName);
-
- const abortController = new AbortController();
- const sessionId = await this.getSessionId();
- if (!sessionId) return;
-
- const contexts = await this.getMatchedContexts(userInput);
- const stream = AIProvider.actions.chat?.({
- sessionId,
- input: userInput,
- contexts,
- docId: doc.id,
- attachments: images,
- workspaceId: doc.workspace.id,
- host: this.host,
- stream: true,
- signal: abortController.signal,
- where: 'chat-panel',
- control: 'chat-send',
- isRootSession: true,
- });
-
- if (stream) {
- this.updateContext({ abortController });
-
- for await (const text of stream) {
- const messages = [...this.chatContextValue.messages];
- const last = messages[messages.length - 1] as ChatMessage;
- last.content += text;
- this.updateContext({ messages, status: 'transmitting' });
- }
-
- this.updateContext({ status: 'success' });
-
- const { messages } = this.chatContextValue;
- const last = messages[messages.length - 1] as ChatMessage;
- if (!last.id) {
- const historyIds = await AIProvider.histories?.ids(
- doc.workspace.id,
- doc.id,
- { sessionId }
- );
- if (!historyIds || !historyIds[0]) return;
- last.id = historyIds[0].messages.at(-1)?.id ?? '';
- }
- }
- } catch (error) {
- this.updateContext({ status: 'error', error: error as AIError });
- } finally {
- this.updateContext({ abortController: null });
- }
- };
-}
-
-declare global {
- interface HTMLElementTagNameMap {
- 'chat-panel-input': ChatPanelInput;
- }
-}
diff --git a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts
index 616fd417d0..6926832e3c 100644
--- a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts
+++ b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts
@@ -1,4 +1,3 @@
-import './chat-panel-input';
import './chat-panel-messages';
import type {
@@ -640,7 +639,7 @@ export class ChatPanel extends SignalWatcher(
.docDisplayConfig=${this.docDisplayConfig}
.searchMenuConfig=${this.searchMenuConfig}
>
-