mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 12:36:24 +08:00
fix(core): open ai chat for first time (#7291)
There are two issues here: 1. open right sidebar with chat 2. notify chat-panel of selected content The second issue will be fixed in a subsequent PR.
This commit is contained in:
@@ -401,6 +401,7 @@ const OthersAIGroup: AIItemGroupConfig = {
|
||||
icon: CommentIcon,
|
||||
handler: host => {
|
||||
const panel = getAIPanel(host);
|
||||
AIProvider.slots.requestOpenWithChat.emit();
|
||||
AIProvider.slots.requestContinueWithAIInChat.emit({ host });
|
||||
panel.hide();
|
||||
},
|
||||
@@ -410,6 +411,7 @@ const OthersAIGroup: AIItemGroupConfig = {
|
||||
icon: ChatWithAIIcon,
|
||||
handler: host => {
|
||||
const panel = getAIPanel(host);
|
||||
AIProvider.slots.requestOpenWithChat.emit();
|
||||
AIProvider.slots.requestContinueInChat.emit({
|
||||
host: host,
|
||||
show: true,
|
||||
|
||||
@@ -463,6 +463,7 @@ export function actionToResponse<T extends keyof BlockSuitePresets.AIActions>(
|
||||
handler: () => {
|
||||
reportResponse('result:continue-in-chat');
|
||||
const panel = getAIPanel(host);
|
||||
AIProvider.slots.requestOpenWithChat.emit();
|
||||
AIProvider.slots.requestContinueInChat.emit({
|
||||
host: host,
|
||||
show: true,
|
||||
|
||||
@@ -233,6 +233,7 @@ export function buildTextResponseConfig<
|
||||
icon: ChatWithAIIcon,
|
||||
handler: () => {
|
||||
reportResponse('result:continue-in-chat');
|
||||
AIProvider.slots.requestOpenWithChat.emit();
|
||||
AIProvider.slots.requestContinueInChat.emit({
|
||||
host: panel.host,
|
||||
show: true,
|
||||
|
||||
@@ -105,6 +105,7 @@ const othersGroup: AIItemGroupConfig = {
|
||||
showWhen: () => true,
|
||||
handler: host => {
|
||||
const panel = getAIPanel(host);
|
||||
AIProvider.slots.requestOpenWithChat.emit();
|
||||
AIProvider.slots.requestContinueWithAIInChat.emit({
|
||||
host,
|
||||
mode: 'edgeless',
|
||||
@@ -118,6 +119,7 @@ const othersGroup: AIItemGroupConfig = {
|
||||
showWhen: () => true,
|
||||
handler: host => {
|
||||
const panel = getAIPanel(host);
|
||||
AIProvider.slots.requestOpenWithChat.emit();
|
||||
AIProvider.slots.requestContinueInChat.emit({
|
||||
host: host,
|
||||
show: true,
|
||||
|
||||
@@ -80,6 +80,7 @@ export class AIProvider {
|
||||
private readonly slots = {
|
||||
// use case: when user selects "continue in chat" in an ask ai result panel
|
||||
// do we need to pass the context to the chat panel?
|
||||
requestOpenWithChat: new Slot(),
|
||||
requestContinueInChat: new Slot<{ host: EditorHost; show: boolean }>(),
|
||||
requestContinueWithAIInChat: new Slot<{
|
||||
host: EditorHost;
|
||||
|
||||
Reference in New Issue
Block a user